Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Translate Form dropzone.js label and other messages

Solved by 01K View solution

Started by 01K 6 years ago · 1 replies · 2394 views
6 years ago

As I understand the form plugin uses the dropzone.js for file attachment.

I can't find a solution how to translate default "drop your files here or click in this area " label into several languages? Other messages also should be translatable into multiple languages.

I thought that a:

TWIG
$(function() {

            Dropzone.options.dropzoneForm = {
                dictDefaultMessage: "{{ trans('messages.dict_default_message') }}",
                dictFallbackMessage: "{{ trans('messages.dict_fallback_message') }}",
                ...
            },
})

might be a possible solution, but it's not.

Any thoughts?

6 years ago Solution

Luckily it's translatable through a variables.
But there is a small bug. My website's default language is non English, but DropZone's default message is in English despite if I override the translation.
So, small workaround - additionally override English label:

YAML
en:
  PLUGIN_FORM:
    DROPZONE_DEFAULT_MESSAGE: "My new Text"

Suggested topics

Topic Participants Replies Views Activity
Support · by webmasterodp, 1 week ago
4 163 1 week ago
Support · by nwhitfield, 1 week ago
2 142 1 week ago
Support · by stell, 3 weeks ago
5 374 2 weeks ago
Support · by gravinator, 1 month ago
5 567 2 weeks ago
Support · by Gravver, 3 weeks ago
6 354 3 weeks ago