I managed to translate one using the inline script method as below:
alert( Translator.translate(error) ); Translator.add('PostalCode Required', '<?php echo $this->__('Translated text here'); ?>');
I have a module config.xml defining a module like so (Client is used to replace the real name for privacy purposes):
<modules> <Client_PostcodeAnywhere> <version>0.0.1</version> </Client_PostcodeAnywhere> </modules>
Inside the frontend -> layout sections of the config.xml file I have added:
<jstranslate> <file>jstranslator.xml</file> </jstranslate>
Inside the frontend section of the config.xml I have added:
<translate> <modules> <client_postcodeanywhere> <files> <default>Client_PostcodeAnywhere.csv</default> </files> </client_postcodeanywhere> </modules> </translate>
I have created the jstranslator.xml file in the same location as the module config.xml file:
<jstranslator> <client-postcodeanywhere-required translate="message" module="client_postcodeanywhere"> <message>PostalCode Required</message> </client-postcodeanywhere-required> </jstranslator>
I have created the Client_PostcodeAnywhere.csv file in my fr_FR folder within global locale folder (translating English to French):
"PostalCode Required","Translated text here"
I don't get a translation after doing this and I don't know why. Does anyone understand what the xml tags in the jstranslator file need to be? Mine is called 'client-postcodeanywhere-required' but I don't even know what that means.