In Joomla 1.6 and 1.7, it is currently very easy to add translatable strings to one's Javascript codebase. The code is fairly simple:
This needs to be preceded in a Joomla extension with an equivalent PHP method, that tells Joomla to prepare a particular language string for Javascript use, like this:
The support for this doesn't exist in the Joomla 1.5 core (and never will), which can create the urge to fork Javascript files into 1.5 and 1.6+ versions. However, we've added our latest open source code contribution, "jsJText" on GitHub for any Joomla extension developer out there looking to reduce the strain of code forking. It proves code for your project to use to add this functionality on 1.5 implmentations.
We hope this code is useful, but only useful for a while -- obviously no Joomla extension developers can yet afford to ignore 1.5. So for the time being, we will be glad if this helps someone looking to transition their extension to 1.6 with a little more ease.
Joomla 1.6 (and now, 1.7) has advanced Joomla's codebase leaps and bounds beyond Joomla 1.5. However, for extension developers, supporting both at the same time can be difficult as keeping completely seperate codebases is sometimes necessarily to take advantage of new features. Developers are left with tough choices about which to support, and how to keep the codebase simple so that they can reach the broadest audience and not cause undue stress on either those adopting newer versions of Joomla, or those maintaining their older sites.