--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
Have you called Joomla.JText.load() to load the translation strings?
Take a look at the implementation of Joomla.JText in
media/system/js/core-uncompressed.js (lines 56-67 in this file for the
Joomla! 1.6.2 release). If you haven't loaded any translation strings,
the "strings" object will be empty, and you will always get back the key
you passed in.
I apologize in advance if this is trivially obvious, but remember that
JavaScript executes in the browser client, not in the web server. The
translation strings installed on the server aren't going to help you in
the client.
- Ken
The call to Joomla.JText.load() is handled for you in
JDocumentRendererHead::fetchHead() (file
libraries/joomla/document/html/renderer/head.php), but you need to have
specified somewhere that you want the translation to be available in
JavaScript.
The easiest way to do that is to call JText::script with the key to be
translated. (The translation needs to be available [that is, the
language file with the translation must have been loaded] when you call
JText::script().)
There are three examples of this in the 1.6.2 distribution:
1. administrator/components/com_users/views/groups/tmpl/default.php
2. administrator/templates/hathor/html/com_users/groups/default.php
3 installation/views/filesystem/view.html.php
There are other ways of making the translation available to JavaScript,
such as passing true as the fourth parameter to JText::_(). The
implementation of JText is in libraries/joomla/methods.php (along with
JRoute).
- Ken