Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Translate Form dropzone.js label and other messages

Solved by 01K View solution

Started by 01K 6 years ago · 1 replies · 2347 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 complanar, 6 days ago
6 140 16 hours ago
Support · by Rick Beebe, 6 days ago
2 100 2 days ago
Support · by blu3prince, 3 days ago
0 52 3 days ago
Support · by alex, 4 days ago
2 92 3 days ago
Support · by Marcel, 2 weeks ago
1 143 4 days ago