PageSourceSearch

https://my.sequoiasoft.com/akuiteo.clients/js/lib/i18n-utils.js?locale=en

js sequoiasoft.com collected 2026-10-08 20:29:11 UTC 2,047 bytes, 84 lines download raw bytes

1var i18nService = (function myDeclaration(keywords) {
2    "use strict";
3    
4    /*
5     * see : https://www.npmjs.com/package/sprintf-js
6     SAMPLES
7     
8		i = 0;
9		console.log(i+': '+I18NUtils.getTextPlural('test',i));
10		i = 1;
11		console.log(i+': '+ I18NUtils.getTextPlural('test',i));
12		i = 10;
13		console.log(i+': '+ I18NUtils.getTextPlural('test',i));
14
15		KEYWORD ENTRIES
16			test.zero=no test
17			test.one=one test
18			test.other=%s tests
19
20		RESULTS
21			0: no test
22			1: one test
23			10: 10 tests
24     */
25    
26    
27     return function myConstructorF() {
28    	
29    	function getText(code) {
30		    var args = Array.prototype.slice.call(arguments, 1);
31		    var translation =  keywords[code];
32		    if(!translation){
33		    	return code ;
34		    }
35		    return translation.replace(/{(\d+)}/g, function(match, number) { 
36		      return typeof args[number] != 'undefined' ? args[number] : match ;
37		    });
38  		};
39    	
40
41		function getfText(key,vargs) {
42			return sprintf(keywords[key],vargs);
43		}
44		function getPlural(key,number) {
45			if(number==0) {	return getText(key+'.zero');
46			} else if(number == 1) { return getText(key+'.one');
47			} else { return getText(key+'.other');}
48		}
49
50		function getTextPlural(key,number) {
51			return sprintf(getPlural(key,number),number);
52		}
53
54		function getFormatDate(){
55			return getText('format.date');
56		}
57		function getFormatDateLong(){
58			return getText('format.date.long');
59		}
60
61		function getFormatDateDatePicker(){
62			return getText('format.date.datepicker');
63		}
64		
65		function getFormatDateLongDatePicker(){
66			return getText('format.date.long.js');
67		}
68		
69         return {
70         	getText: getText,
71         	getfText:getfText,
72         	getPlural: getPlural,
73         	getTextPlural: getTextPlural,
74         	getFormatDate:getFormatDate,
75         	getFormatDateLong:getFormatDateLong,
76         	getFormatDateDatePicker:getFormatDateDatePicker,
77         	getFormatDateLongDatePicker:getFormatDateLongDatePicker
78        };
79    }
80})(keywords);
81
82var I18NUtils = i18nService();
83
84//@ sourceURL=i18n-utils.js 

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.