1

We want to translate "Please enter a valid full date", but when we edit the csv file, nothing happens.

This is the default Magento validation line in the one page checkout. When a user enters the data of birth incorrect, Magento displays the default error that is written in English.

Place the line in the Mage_Core.csv file and translate it, does not work.

How can we translate this line?

3
  • Please be more specific, using examples of code that you've tried first. Is this part of a specific module? If so, please post the module configuration and paths to your translation file(s). Commented Dec 2, 2014 at 14:58
  • @vBuck I edit my question. It is the default Magento validation error that is displayed.
    – JGeer
    Commented Dec 2, 2014 at 15:12
  • Try to put it in translate.csv in your theme. Are you in developer mode? Commented Dec 2, 2014 at 16:41

3 Answers 3

2

The problem comes from a core bug.

See js/varien/js.js around line 450:

...
} else if (!day || !month || !year) {
    error = 'Please enter a valid full date.';
} else {
...

See the problem? It's the period ., which does not appear in the CSV, so the translation is missed every time. The easiest solution is the edit this file directly, removing the period so that translation works again... but of course, modifying core is not best practice.

Long Solution

If you have a generic local code pool module on your system, add or edit its jstranslator.xml file, and add this:

<?xml version="1.0"?>
<jstranslator>
    <!-- js.js -->
    <validate-date-full-date translate="message" module="rootd">
        <message>Please enter a valid full date.</message>
    </validate-date-full-date>
    <!-- end js.js -->
</jstranslator>

Here we should effectively overwrite the entry for this message that was originally defined in app/code/core/Mage/Core/etc/jstranslator.xml, and include the period which core code expects according to js/varien/js.js. Then, you can add an entry to your CSV:

"Please enter a valid date.","Your translation here"
0
0

If Magento caching is enabled, try again after refreshing Translations cache from System >> Cache Management.

1
  • Thanks for your reply, but we disabled the cache. So it is not a cache issue.
    – JGeer
    Commented Dec 2, 2014 at 15:18
0

My answer was I had to enter a valid date that I received the product So I’m in Indiana USA I entered 4/21/2020 and it wouldn’t except it so I’ll try April 21’20 at 12:39pm not sure yet

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.