Im porting a little web application running in a JUMI element from Joomla 1.5 to 2.5.
in joomla 1.5 for translation we used jsJText to make the translated strings available in Javascript. From what I understood in several tutorials, 2.5 should make it easier since support for translation in Javascript is integrated.
After google it results they all pretty much say: First add your strings to the javascript language store in PHP by using JText::script('key'); and later retrieve them in javascript using Joomla.JText._('key') or Joomla.JText.strings.key.
I am having quite a bit of trouble getting this to work however. Translations in PHP work perfectly fine, but in Javascript I end up getting undefined instead of the correct translated text.
I've taken a small screenshot illustrating my approach and the problem. enter image description attached file.
Gfglu.png
The PHP file containing the language strings is included into the main PHP page which shows the content. This is pretty much the first include in the page.
I've made a stupid mistake somewhere, but honestly can not find it for the life of me. Anyone that can point me in the right direction of where to search would be greatly appreciated.
via Joomla! http://forum.joomla.org/viewtopic.php?t=831006&p=3122895#p3122895
in joomla 1.5 for translation we used jsJText to make the translated strings available in Javascript. From what I understood in several tutorials, 2.5 should make it easier since support for translation in Javascript is integrated.
After google it results they all pretty much say: First add your strings to the javascript language store in PHP by using JText::script('key'); and later retrieve them in javascript using Joomla.JText._('key') or Joomla.JText.strings.key.
I am having quite a bit of trouble getting this to work however. Translations in PHP work perfectly fine, but in Javascript I end up getting undefined instead of the correct translated text.
I've taken a small screenshot illustrating my approach and the problem. enter image description attached file.
Gfglu.png
The PHP file containing the language strings is included into the main PHP page which shows the content. This is pretty much the first include in the page.
I've made a stupid mistake somewhere, but honestly can not find it for the life of me. Anyone that can point me in the right direction of where to search would be greatly appreciated.
Statistics: Posted by moops — Tue Dec 31, 2013 7:21 pm
via Joomla! http://forum.joomla.org/viewtopic.php?t=831006&p=3122895#p3122895
No comments:
Post a Comment