Magento – Translate Validation Error Message of Date of Birth

localisation

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 1.7.0.2)

    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.

Best Answer

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.

Related Topic