Forums

Translate validation messages

jj135 20 Jan, 2014
Hi! When I use the new CF5, where can I translate the validation messages like 'Please enter a valid email.'? In this case I did use the Title field to show a custom message if the field is empty, but the e-mail is also validated on 'email' format and the validation message 'Please enter a valid email.' is shown. But I can't seem to figure out where to translate this. In the CF4 version there was a setting to select a language. Will this come back in CF5?
Max_admin 20 Jan, 2014
Hi jj135,

Enter some unique string in the field's Title box, like "REQUIRED_EMAIL", then go to the "Locales" tab and create 2 locales, one named "en_gb" and the other should have the language id of your language, say "fr_fr" for French, then enter this at the strings box:

REQUIRED_EMAIL=Please enter a valid email address


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jj135 21 Jan, 2014
Hi Max, thanks. But what if I check for both 'not empty' and 'email format'? This will first check if the field is empty and display a message 'Should not be empty..' and when some text is entered it checks for a valid e-mail address. If not 'Should be a valid...'. Is it possible to translate both messages?

And just wondering: Why use the Locales when I can enter the translation in the title field? Or is this just to keep translation in the same place? Or are there more benefits from using the locales?
Max_admin 21 Jan, 2014
Hi jj135,

If you have only 1 translation/language then you can write the text in the title field directly, the locales is for more than 1 languages.

Only 1 message is supported when translated, I will try to add a feature to translate the core messages, but for now, you may set a message like "A valid email address is required", which gives both meanings!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jj135 21 Jan, 2014
Hi Max, thanks for your explanation. Your suggestion for a 'combined' message is a good one. I'll use that for now.

Kind regards,
Jip Jonker
caratti 27 Apr, 2014
I need to translate to Portuguese Brazil all the messages like "This Field is Required", "Please enter a valid email" etc.
Where can I find the tags or constants to write the translated messages (example: REQUIRED_EMAIL: Este campo é origatório)
LESITOLOGUE 28 Apr, 2014
Hi

I have the same problem with CF5
I translated in french error messages but not 'This Field is Required',

Thank you for your help
Max_admin 28 Apr, 2014
1 Likes
Hello,

You can translate validations messages using the "Title" box in your field settings, I have this explained in the 2nd post in this topic.

But starting from the next release (v5 RC6), you will be able to translate ALL messages by adding a "Load JavaScript" after the "HTML" action and enter the translations:

GValidtaion.errors.required = "test required custom message";
GValidtaion.errors.email = "test email message";


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
maruchi 27 Aug, 2014
Hello!

This post has been very helpful to me 😉

I have a question. I'm very newbee at javascript and some joomla core isues. I'd like to know if is there any way to ask what language is active and use a structure "if .. then" in loadjavascript action. I mean something like
if [active language] is "es-es" then
GValidtaion.errors.required = "Campo requerido";
elseif [active language] is "pt-br" then
GValidtaion.errors.required = "blablabla";
endif

Thanks in advance!
Max_admin 28 Aug, 2014
That's not needed, you can instead do it this way:

in JS action:
GValidtaion.errors.required = "_REQUIRED_";


Then under the "Locales" tab, define all the languages you need, and translate the "_REQUIRED_" string there for each one!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
maruchi 28 Aug, 2014
Thank you very much for your fast answer.
It isn't work for me at the moment. I don't know what I'm doin wrong.
In locale tag I've tested "es-es" and "es-ES" cause i wasn't sure about right notation.

And in language strings I've tested this formats for __required__

#__required__# = "Campo obligatorio.";
"#__required__#" = "Campo obligatorio.";
#__required__# = Campo obligatorio.

In all cases loadjavascript action shows "__required__"

😢 🙄 🤨
Max_admin 28 Aug, 2014
Please try "es_es", and enter this in the "Language strings" box:
#__required__#=Campo obligatorio.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.