We will split the tutorial in 3 easy step for better understanding.
Write the translation string in .ini language file as we do always
MOD_EXAMPLE_CUSTOM_STRING="We love joomla"
Declare translation string in .php script to add it in a global js object.
In any custom .js file injected from joomla you can now use the string as, make sure that you inject inject the js after you inject the translation string in step2
var myvalue = Joomla.JText._('MOD_EXAMPLE_CUSTOM_STRING');
If you think this is use full then share it in your network. Spread the Joomla love.
Joomla Custom Development
We have more than 100 extensions approved in official Joomla extension directory, which makes us one of the leading Joomla extension developer in the world. We are expert in developing system plugins, module and components. [Click here to learn about our Joomla Extension Services]
WordPress Custom Development
We are long time WordPress geek and we mean it. To convince you, our plugin author page in WordPress.org plugin directory is enough. So we are keeping it short and let’s see what type of custom development services we provide for wordpress.[Click here to learn about our WordPress Custom Services]