1/** 2 * Created on : 2014.08.24., 5:26:26 3 * Author : Lajos Molnar <[email protected]> 4 * since 1.0 5 */ 6 7/** 8 * This module facilitates client-side multilingual support. 9 */ 10var lajax = (function () { 11 12 return { 13 /** 14 * 15 * Method that facilitates multilingual support on client side. 16 * 17 * examples: 18 * 19 * ~~~ 20 * alert(lajax.t('Hello!')); 21 * alert(lajax.t('Hello {name}'), {name:'World!'}); 22 * alert(lajax.t('Hello {first_name} {last_name}', {fist_name: 'Veronica', last_name:'Hunter'})); 23 * ~~~ 24 * 25 * @param {string} message The message to translate. 26 * @param {object} $params Parameter to change within text as json string, i.e.: {fist_name: 'Veronica', last_name:'Hunter'} 27 * @returns {string} 28 */ 29 t: function (message, $params) { 30 if (typeof (languageItems) !== 'undefined' && typeof (languageItems.getLanguageItems) === 'function') { 31 var $messages = languageItems.getLanguageItems(); 32 if (typeof ($messages) !== 'undefined') { 33 var hash = hex_md5(message); 34 if (typeof ($messages[hash]) !== 'undefined') { 35 message = $messages[hash]; 36 } 37 } 38 } 39 40 if (typeof ($params) !== 'undefined') { 41 for (search in $params) { 42 message = message.replace('{' + search + '}', $params[search]); 43 } 44 } 45 46 return message; 47 } 48 }; 49})(); 50
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.