Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Translate Form dropzone.js label and other messages

Solved by 01K View solution

Started by 01K 6 years ago · 1 replies · 2169 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 Thomas, 1 week ago
2 66 18 hours ago
Support · by Anna, 3 days ago
2 72 21 hours ago
Support · by Justin Young, 22 hours ago
1 40 22 hours ago
Support · by Duc , 1 week ago
2 76 6 days ago
Support · by Colin Hume, 1 week ago
2 70 6 days ago