jquery-localization-tool icon indicating copy to clipboard operation
jquery-localization-tool copied to clipboard

Extend strings dynamically after initialization

Open wehowski opened this issue 10 years ago • 0 comments

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).

wehowski avatar Jul 18 '15 11:07 wehowski