Hello,
I try to make my javascript messages translatable, but it does not work.
I followed these instructions: http://doc.silverstripe.org/i18n?s=sprintf
I added this line to my Requirements in Page.php
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
Then i added the language files in js-version e.g. en_GB.js containing following code:
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
console.error('Class ss.i18n not defined');
} else {
ss.i18n.addDictionary('en_GB', {
'FormContact.MYENTITY' : "Delete Article?"
});
}
Then I try to test the code in the Page.ss template via:
<script type="text/javascript">
alert(ss.i18n._t('FormContact.MYENTITY'));
</script>
But the alert is always empty. What went wrong?
Many thx,
Florian
//SS. 2.3.3
//PS: I would like to have a "Translatable" Section or something similar in the Forum :)