Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Translate Form dropzone.js label and other messages

Solved by 01K View solution

Started by 01K 6 years ago · 1 replies · 2506 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 TomW, 2 weeks ago
8 227 9 hours ago
Support · by alex, 2 months ago
8 667 24 hours ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 159 3 days ago
Support · by TomW, 6 days ago
2 106 5 days ago