jquery-localization-tool
jquery-localization-tool copied to clipboard
Extend strings dynamically after initialization
I need to load translations dynamically after initialization. I suggest to add the following method:
'loadLangs' : function(){ var $this = this; var settings = $this.data('settings'); if('undefined' !== typeof arguments[0]) { $.extend(settings.strings, arguments[0]); $this.data('settings', settings); } return $this.data('settings').strings; },
To make this work you have to: AFTER
'_translate': function (languageCode) {
ADD
this[name]('_buildStringReferenceMapping', $this);
Example:
$($.locale).localizationTool('loadLangs', modul.languageStrings) ;
Where $.locale is an localization tool instance and modul.languageStrings is an strings object (like in init options).