I got a problem to translate validation error message "Please enter a valid full date." in the edit account page. This message will be prompted when user leave Date of Birth field is empty.

That field was using js/varien/js.js to validating the user input. I failed to translate the error message which was assigned to a JavaScript variable namely, error.

(js.js code in Magento ver

    validate: function() {
    var error = false,
        day = parseInt(this.day.value.replace(/^0*/, '')) || 0,
        month = parseInt(this.month.value.replace(/^0*/, '')) || 0,
        year = parseInt(this.year.value) || 0;
    if (!day && !month && !year) {
        if (this.required) {
            error = 'This date is a required value.';          <------ (Line: 445)
        } else {
            this.full.value = '';
    } else if (!day || !month || !year) {
        error = 'Please enter a valid full date.';          <------ (Line: 450)

For above error messages, simply adding translation text into translate.csv did not work. Please help how to translate these strings without changing the core code.

3 Answers 3


Try to add translation part in locale file:

magento\app\locale\YOUR PACAKGE(like en_EN,fr_FR)\Mage_Core.csv

It will reflect when it will translating message. I have work with this so.

  • Just added to Mage_Core.csv, but no result. Should we touch the jstranslator.xml file ? I noticed those messages would be added via Javascript Translate object.
    – Leongelis
    Dec 27, 2013 at 8:53
  • I don't recommended that because it is core files so..
    – Keyul Shah
    Dec 27, 2013 at 9:01
  • Shared the same view. I also feel uncomfortable to edit the core. Any advice?
    – Leongelis
    Dec 27, 2013 at 9:06
  • I am finding some solutions and let you know ..
    – Keyul Shah
    Dec 27, 2013 at 9:09

You could create a new module containing the translations. In the translations you need to prefix the entry with the name of the core-module, e.g. Mage_Core::Advanced.

Using this technique you can change translations without changing a core file due to the order that Magento is reading the translation files. The technique is described in detail here: http://www.code4business.de/magento-core-texte-uebersetzen/


These messages are translated with the JavaScript Translator object, which is initialized based on jstranslator.xml files. These again use the normal translation methods, so as soon as the string to be translated is included in a jstranslator.xml file, you can use translate.csv as usual

These particular translations are coming from Mage_Core and are present in jstranslator.xml (you can verify that this is working if you search for the string in the HTML source code in your browser. You should find it in the Translator initialization`).

This is what you have to place in app/design/frontend/[package]/[theme]/[language]/translate.csv:

"Mage_Core::This date is a required value.","..."
"Mage_Core::Please enter a valid full date.","..."


There is actually a bug in the translation files: In "Please enter a valid full date" the period at the end is missing, so you need to add jstranslator.xml in an own module and change the string there.

It's explained here: Please enter a valid full date translate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.