+function ts_initTransformTable() {
+ if ( typeof wgSeparatorTransformTable == "undefined"
+ || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) )
+ {
+ digitClass = "[0-9,.]";
+ ts_number_transform_table = false;
+ } else {
+ ts_number_transform_table = {};
+ // Unpack the transform table
+ // Separators
+ ascii = wgSeparatorTransformTable[0].split("\t");
+ localised = wgSeparatorTransformTable[1].split("\t");
+ for ( var i = 0; i < ascii.length; i++ ) {
+ ts_number_transform_table[localised[i]] = ascii[i];
+ }
+ // Digits
+ ascii = wgDigitTransformTable[0].split("\t");
+ localised = wgDigitTransformTable[1].split("\t");
+ for ( var i = 0; i < ascii.length; i++ ) {
+ ts_number_transform_table[localised[i]] = ascii[i];
+ }
+
+ // Construct regex for number identification
+ digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '\\.'];
+ maxDigitLength = 1;
+ for ( var digit in ts_number_transform_table ) {
+ // Escape regex metacharacters
+ digits.push(
+ digit.replace( /[\\\\$\*\+\?\.\(\)\|\{\}\[\]\-]/,
+ function( s ) { return '\\' + s; } )
+ );
+ if (digit.length > maxDigitLength) {
+ maxDigitLength = digit.length;
+ }
+ }
+ if ( maxDigitLength > 1 ) {
+ digitClass = '[' + digits.join( '', digits ) + ']';
+ } else {
+ digitClass = '(' + digits.join( '|', digits ) + ')';
+ }
+ }
+
+ // We allow a trailing percent sign, which we just strip. This works fine
+ // if percents and regular numbers aren't being mixed.
+ ts_number_regex = new RegExp(
+ "^(" +
+ "[+-\u2212]?[0-9][0-9,]*(\\.[0-9,]*)?(E[+-\u2212]?[0-9][0-9,]*)?" + // Fortran-style scientific
+ "|" +
+ "[+-\u2212]?" + digitClass + "+%?" + // Generic localised
+ ")$", "i"
+ );
+}
+
+function ts_toLowerCase( s ) {
+ return s.toLowerCase();
+}
+
+function ts_dateToSortKey(date) {