Author: kmorin Date: 2013-06-18 10:10:49 +0200 (Tue, 18 Jun 2013) New Revision: 93 Url: http://nuiton.org/projects/nuiton-js/repository/revisions/93 Log: add jquery.i18n.properties 1.0.9 Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/LICENSE.txt tags/nuiton-js-jquery-i18n-properties-1.0.9-1/README.txt tags/nuiton-js-jquery-i18n-properties-1.0.9-1/changelog.txt tags/nuiton-js-jquery-i18n-properties-1.0.9-1/pom.xml tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/META-INF/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/META-INF/nuiton-js/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/META-INF/nuiton-js/wro-jquery-i18n-properties.xml tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/nuiton-js-jquery-i18n-properties/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/nuiton-js-jquery-i18n-properties/jquery.i18n.properties-1.0.9.js tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/rst/ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/rst/index.rst tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/site_fr.xml Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/LICENSE.txt =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/LICENSE.txt (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/LICENSE.txt 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/README.txt =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/README.txt (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/README.txt 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1 @@ + Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/changelog.txt =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/changelog.txt (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/changelog.txt 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,2 @@ +Please refer to the release note : + http://maven-site.nuiton.org/nuiton-js/changes-report.html Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/pom.xml =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/pom.xml (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/pom.xml 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.nuiton.js</groupId> + <artifactId>nuiton-js-lib</artifactId> + <version>1.0</version> + </parent> + + <artifactId>nuiton-js-jquery-i18n-properties</artifactId> + <version>1.0.9-1</version> + + <name>Nuiton JS :: jQuery i18n properties</name> + <description>jQuery i18n properties jar packaging</description> + + <url>http://code.google.com/p/jquery-i18n-properties</url> + + <licenses> + <license> + <name>MIT License</name> + <url>http://opensource.org/licenses/mit-license.php</url> + </license> + </licenses> + + <scm> + <connection>scm:svn:http://svn.nuiton.org/svn/nuiton-js/tags/nuiton-js-jquery-i18n-properties-1.0.9-1</connection> + <developerConnection>scm:svn:http://svn.nuiton.org/svn/nuiton-js/tags/nuiton-js-jquery-i18n-properties-1.0.9-1</developerConnection> + <url>http://www.nuiton.org/repositories/browse/nuiton-js/tags/nuiton-js-jquery-i18n-properties-1.0.9-1</url> + </scm> + +</project> Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/META-INF/nuiton-js/wro-jquery-i18n-properties.xml =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/META-INF/nuiton-js/wro-jquery-i18n-properties.xml (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/META-INF/nuiton-js/wro-jquery-i18n-properties.xml 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,5 @@ +<groups xmlns="http://www.isdc.ro/wro"> + <group name='jquery.i18n.properties'> + <js>classpath:nuiton-js-jquery-i18n-properties/jquery.i18n.properties-1.0.9.js</js> + </group> +</groups> Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/nuiton-js-jquery-i18n-properties/jquery.i18n.properties-1.0.9.js =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/nuiton-js-jquery-i18n-properties/jquery.i18n.properties-1.0.9.js (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/main/resources/nuiton-js-jquery-i18n-properties/jquery.i18n.properties-1.0.9.js 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,474 @@ +/****************************************************************************** + * jquery.i18n.properties + * + * Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and + * MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. + * + * @version 1.0.x + * @author Nuno Fernandes + * @url www.codingwithcoffee.com + * @inspiration Localisation assistance for jQuery (http://keith-wood.name/localisation.html) + * by Keith Wood (kbwood{at}iinet.com.au) June 2007 + * + *****************************************************************************/ + +(function($) { +$.i18n = {}; + +/** Map holding bundle keys (if mode: 'map') */ +$.i18n.map = {}; + +/** + * Load and parse message bundle files (.properties), + * making bundles keys available as javascript variables. + * + * i18n files are named <name>.js, or <name>_<language>.js or <name>_<language>_<country>.js + * Where: + * The <language> argument is a valid ISO Language Code. These codes are the lower-case, + * two-letter codes as defined by ISO-639. You can find a full list of these codes at a + * number of sites, such as: http://www.loc.gov/standards/iso639-2/englangn.html + * The <country> argument is a valid ISO Country Code. These codes are the upper-case, + * two-letter codes as defined by ISO-3166. You can find a full list of these codes at a + * number of sites, such as: http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list... + * + * Sample usage for a bundles/Messages.properties bundle: + * $.i18n.properties({ + * name: 'Messages', + * language: 'en_US', + * path: 'bundles' + * }); + * @param name (string/string[], optional) names of file to load (eg, 'Messages' or ['Msg1','Msg2']). Defaults to "Messages" + * @param language (string, optional) language/country code (eg, 'en', 'en_US', 'pt_PT'). if not specified, language reported by the browser will be used instead. + * @param path (string, optional) path of directory that contains file to load + * @param mode (string, optional) whether bundles keys are available as JavaScript variables/functions or as a map (eg, 'vars' or 'map') + * @param cache (boolean, optional) whether bundles should be cached by the browser, or forcibly reloaded on each page load. Defaults to false (i.e. forcibly reloaded) + * @param encoding (string, optional) the encoding to request for bundles. Property file resource bundles are specified to be in ISO-8859-1 format. Defaults to UTF-8 for backward compatibility. + * @param callback (function, optional) callback function to be called after script is terminated + */ +$.i18n.properties = function(settings) { + // set up settings + var defaults = { + name: 'Messages', + language: '', + path: '', + mode: 'vars', + cache: false, + encoding: 'UTF-8', + callback: null + }; + settings = $.extend(defaults, settings); + if(settings.language === null || settings.language == '') { + settings.language = $.i18n.browserLang(); + } + if(settings.language === null) {settings.language='';} + + // load and parse bundle files + var files = getFiles(settings.name); + for(i=0; i<files.length; i++) { + // 1. load base (eg, Messages.properties) + loadAndParseFile(settings.path + files[i] + '.properties', settings); + // 2. with language code (eg, Messages_pt.properties) + if(settings.language.length >= 2) { + loadAndParseFile(settings.path + files[i] + '_' + settings.language.substring(0, 2) +'.properties', settings); + } + // 3. with language code and country code (eg, Messages_pt_PT.properties) + if(settings.language.length >= 5) { + loadAndParseFile(settings.path + files[i] + '_' + settings.language.substring(0, 5) +'.properties', settings); + } + } + + // call callback + if(settings.callback){ settings.callback(); } +}; + + +/** + * When configured with mode: 'map', allows access to bundle values by specifying its key. + * Eg, jQuery.i18n.prop('com.company.bundles.menu_add') + */ +$.i18n.prop = function(key /* Add parameters as function arguments as necessary */) { + var value = $.i18n.map[key]; + if (value == null) + return '[' + key + ']'; + +// if(arguments.length < 2) // No arguments. +// //if(key == 'spv.lbl.modified') {alert(value);} +// return value; + +// if (!$.isArray(placeHolderValues)) { +// // If placeHolderValues is not an array, make it into one. +// placeHolderValues = [placeHolderValues]; +// for (var i=2; i<arguments.length; i++) +// placeHolderValues.push(arguments[i]); +// } + + // Place holder replacement + /** + * Tested with: + * test.t1=asdf ''{0}'' + * test.t2=asdf '{0}' '{1}'{1}'zxcv + * test.t3=This is \"a quote" 'a''{0}''s'd{fgh{ij' + * test.t4="'''{'0}''" {0}{a} + * test.t5="'''{0}'''" {1} + * test.t6=a {1} b {0} c + * test.t7=a 'quoted \\ s\ttringy' \t\t x + * + * Produces: + * test.t1, p1 ==> asdf 'p1' + * test.t2, p1 ==> asdf {0} {1}{1}zxcv + * test.t3, p1 ==> This is "a quote" a'{0}'sd{fgh{ij + * test.t4, p1 ==> "'{0}'" p1{a} + * test.t5, p1 ==> "'{0}'" {1} + * test.t6, p1 ==> a {1} b p1 c + * test.t6, p1, p2 ==> a p2 b p1 c + * test.t6, p1, p2, p3 ==> a p2 b p1 c + * test.t7 ==> a quoted \ s tringy x + */ + + var i; + if (typeof(value) == 'string') { + // Handle escape characters. Done separately from the tokenizing loop below because escape characters are + // active in quoted strings. + i = 0; + while ((i = value.indexOf('\\', i)) != -1) { + if (value[i+1] == 't') + value = value.substring(0, i) + '\t' + value.substring((i++) + 2); // tab + else if (value[i+1] == 'r') + value = value.substring(0, i) + '\r' + value.substring((i++) + 2); // return + else if (value[i+1] == 'n') + value = value.substring(0, i) + '\n' + value.substring((i++) + 2); // line feed + else if (value[i+1] == 'f') + value = value.substring(0, i) + '\f' + value.substring((i++) + 2); // form feed + else if (value[i+1] == '\\') + value = value.substring(0, i) + '\\' + value.substring((i++) + 2); // \ + else + value = value.substring(0, i) + value.substring(i+1); // Quietly drop the character + } + + // Lazily convert the string to a list of tokens. + var arr = [], j, index; + i = 0; + while (i < value.length) { + if (value[i] == '\'') { + // Handle quotes + if (i == value.length-1) + value = value.substring(0, i); // Silently drop the trailing quote + else if (value[i+1] == '\'') + value = value.substring(0, i) + value.substring(++i); // Escaped quote + else { + // Quoted string + j = i + 2; + while ((j = value.indexOf('\'', j)) != -1) { + if (j == value.length-1 || value[j+1] != '\'') { + // Found start and end quotes. Remove them + value = value.substring(0,i) + value.substring(i+1, j) + value.substring(j+1); + i = j - 1; + break; + } + else { + // Found a double quote, reduce to a single quote. + value = value.substring(0,j) + value.substring(++j); + } + } + + if (j == -1) { + // There is no end quote. Drop the start quote + value = value.substring(0,i) + value.substring(i+1); + } + } + } + else if (value[i] == '{') { + // Beginning of an unquoted place holder. + j = value.indexOf('}', i+1); + if (j == -1) + i++; // No end. Process the rest of the line. Java would throw an exception + else { + // Add 1 to the index so that it aligns with the function arguments. + index = parseInt(value.substring(i+1, j)); + if (!isNaN(index) && index >= 0) { + // Put the line thus far (if it isn't empty) into the array + var s = value.substring(0, i); + if (s != "") + arr.push(s); + // Put the parameter reference into the array + arr.push(index); + // Start the processing over again starting from the rest of the line. + i = 0; + value = value.substring(j+1); + } + else + i = j + 1; // Invalid parameter. Leave as is. + } + } + else + i++; + } + + // Put the remainder of the no-empty line into the array. + if (value != "") + arr.push(value); + value = arr; + + // Make the array the value for the entry. + $.i18n.map[key] = arr; + } + + if (value.length == 0) + return ""; + if (value.lengh == 1 && typeof(value[0]) == "string") + return value[0]; + + var s = ""; + for (i=0; i<value.length; i++) { + if (typeof(value[i]) == "string") + s += value[i]; + // Must be a number + else if (value[i] + 1 < arguments.length) + s += arguments[value[i] + 1]; + else + s += "{"+ value[i] +"}"; + } + + return s; +}; + +/** Language reported by browser, normalized code */ +$.i18n.browserLang = function() { + return normaliseLanguageCode(navigator.language /* Mozilla */ || navigator.userLanguage /* IE */); +} + + +/** Load and parse .properties files */ +function loadAndParseFile(filename, settings) { + $.ajax({ + url: filename, + async: false, + cache: settings.cache, + contentType:'text/plain;charset='+ settings.encoding, + dataType: 'text', + success: function(data, status) { + parseData(data, settings.mode); + } + }); +} + +/** Parse .properties files */ +function parseData(data, mode) { + var parsed = ''; + var parameters = data.split( /\n/ ); + var regPlaceHolder = /(\{\d+\})/g; + var regRepPlaceHolder = /\{(\d+)\}/g; + var unicodeRE = /(\\u.{4})/ig; + for(var i=0; i<parameters.length; i++ ) { + parameters[i] = parameters[i].replace( /^\s\s*/, '' ).replace( /\s\s*$/, '' ); // trim + if(parameters[i].length > 0 && parameters[i].match("^#")!="#") { // skip comments + var pair = parameters[i].split('='); + if(pair.length > 0) { + /** Process key & value */ + var name = unescape(pair[0]).replace( /^\s\s*/, '' ).replace( /\s\s*$/, '' ); // trim + var value = pair.length == 1 ? "" : pair[1]; + // process multi-line values + while(value.match(/\\$/)=="\\") { + value = value.substring(0, value.length - 1); + value += parameters[++i].replace( /\s\s*$/, '' ); // right trim + } + // Put values with embedded '='s back together + for(var s=2;s<pair.length;s++){ value +='=' + pair[s]; } + value = value.replace( /^\s\s*/, '' ).replace( /\s\s*$/, '' ); // trim + + /** Mode: bundle keys in a map */ + if(mode == 'map' || mode == 'both') { + // handle unicode chars possibly left out + var unicodeMatches = value.match(unicodeRE); + if(unicodeMatches) { + for(var u=0; u<unicodeMatches.length; u++) { + value = value.replace( unicodeMatches[u], unescapeUnicode(unicodeMatches[u])); + } + } + // add to map + $.i18n.map[name] = value; + } + + /** Mode: bundle keys as vars/functions */ + if(mode == 'vars' || mode == 'both') { + value = value.replace( /"/g, '\\"' ); // escape quotation mark (") + + // make sure namespaced key exists (eg, 'some.key') + checkKeyNamespace(name); + + // value with variable substitutions + if(regPlaceHolder.test(value)) { + var parts = value.split(regPlaceHolder); + // process function args + var first = true; + var fnArgs = ''; + var usedArgs = []; + for(var p=0; p<parts.length; p++) { + if(regPlaceHolder.test(parts[p]) && (usedArgs.length == 0 || usedArgs.indexOf(parts[p]) == -1)) { + if(!first) {fnArgs += ',';} + fnArgs += parts[p].replace(regRepPlaceHolder, 'v$1'); + usedArgs.push(parts[p]); + first = false; + } + } + parsed += name + '=function(' + fnArgs + '){'; + // process function body + var fnExpr = '"' + value.replace(regRepPlaceHolder, '"+v$1+"') + '"'; + parsed += 'return ' + fnExpr + ';' + '};'; + + // simple value + }else{ + parsed += name+'="'+value+'";'; + } + } // END: Mode: bundle keys as vars/functions + } // END: if(pair.length > 0) + } // END: skip comments + } + eval(parsed); +} + +/** Make sure namespace exists (for keys with dots in name) */ +// TODO key parts that start with numbers quietly fail. i.e. month.short.1=Jan +function checkKeyNamespace(key) { + var regDot = /\./; + if(regDot.test(key)) { + var fullname = ''; + var names = key.split( /\./ ); + for(var i=0; i<names.length; i++) { + if(i>0) {fullname += '.';} + fullname += names[i]; + if(eval('typeof '+fullname+' == "undefined"')) { + eval(fullname + '={};'); + } + } + } +} + +/** Make sure filename is an array */ +function getFiles(names) { + return (names && names.constructor == Array) ? names : [names]; +} + +/** Ensure language code is in the format aa_AA. */ +function normaliseLanguageCode(lang) { + lang = lang.toLowerCase(); + if(lang.length > 3) { + lang = lang.substring(0, 3) + lang.substring(3).toUpperCase(); + } + return lang; +} + +/** Unescape unicode chars ('\u00e3') */ +function unescapeUnicode(str) { + // unescape unicode codes + var codes = []; + var code = parseInt(str.substr(2), 16); + if (code >= 0 && code < Math.pow(2, 16)) { + codes.push(code); + } + // convert codes to text + var unescaped = ''; + for (var i = 0; i < codes.length; ++i) { + unescaped += String.fromCharCode(codes[i]); + } + return unescaped; +} + +/* Cross-Browser Split 1.0.1 +(c) Steven Levithan <stevenlevithan.com>; MIT License +An ECMA-compliant, uniform cross-browser split method */ +var cbSplit; +// avoid running twice, which would break `cbSplit._nativeSplit`'s reference to the native `split` +if (!cbSplit) { + cbSplit = function(str, separator, limit) { + // if `separator` is not a regex, use the native `split` + if (Object.prototype.toString.call(separator) !== "[object RegExp]") { + if(typeof cbSplit._nativeSplit == "undefined") + return str.split(separator, limit); + else + return cbSplit._nativeSplit.call(str, separator, limit); + } + + var output = [], + lastLastIndex = 0, + flags = (separator.ignoreCase ? "i" : "") + + (separator.multiline ? "m" : "") + + (separator.sticky ? "y" : ""), + separator = RegExp(separator.source, flags + "g"), // make `global` and avoid `lastIndex` issues by working with a copy + separator2, match, lastIndex, lastLength; + + str = str + ""; // type conversion + if (!cbSplit._compliantExecNpcg) { + separator2 = RegExp("^" + separator.source + "$(?!\\s)", flags); // doesn't need /g or /y, but they don't hurt + } + + /* behavior for `limit`: if it's... + - `undefined`: no limit. + - `NaN` or zero: return an empty array. + - a positive number: use `Math.floor(limit)`. + - a negative number: no limit. + - other: type-convert, then use the above rules. */ + if (limit === undefined || +limit < 0) { + limit = Infinity; + } else { + limit = Math.floor(+limit); + if (!limit) { + return []; + } + } + + while (match = separator.exec(str)) { + lastIndex = match.index + match[0].length; // `separator.lastIndex` is not reliable cross-browser + + if (lastIndex > lastLastIndex) { + output.push(str.slice(lastLastIndex, match.index)); + + // fix browsers whose `exec` methods don't consistently return `undefined` for nonparticipating capturing groups + if (!cbSplit._compliantExecNpcg && match.length > 1) { + match[0].replace(separator2, function () { + for (var i = 1; i < arguments.length - 2; i++) { + if (arguments[i] === undefined) { + match[i] = undefined; + } + } + }); + } + + if (match.length > 1 && match.index < str.length) { + Array.prototype.push.apply(output, match.slice(1)); + } + + lastLength = match[0].length; + lastLastIndex = lastIndex; + + if (output.length >= limit) { + break; + } + } + + if (separator.lastIndex === match.index) { + separator.lastIndex++; // avoid an infinite loop + } + } + + if (lastLastIndex === str.length) { + if (lastLength || !separator.test("")) { + output.push(""); + } + } else { + output.push(str.slice(lastLastIndex)); + } + + return output.length > limit ? output.slice(0, limit) : output; + }; + + cbSplit._compliantExecNpcg = /()??/.exec("")[1] === undefined; // NPCG: nonparticipating capturing group + cbSplit._nativeSplit = String.prototype.split; + +} // end `if (!cbSplit)` +String.prototype.split = function (separator, limit) { + return cbSplit(this, separator, limit); +}; + +})(jQuery); + \ No newline at end of file Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/rst/index.rst =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/rst/index.rst (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/rst/index.rst 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,18 @@ + +Utilisation +=========== + +:: + + <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + <script language="javascript" type="text/javascript" src="<c:url value="/nuiton-js/jquery.i18n.properties-1.0.9.js"/>"></script> + +JS disponible +------------- + +- jquery.i18n.properties.js + +CSS disponible +-------------- + +aucun Added: tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/site_fr.xml =================================================================== --- tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/site_fr.xml (rev 0) +++ tags/nuiton-js-jquery-i18n-properties-1.0.9-1/src/site/site_fr.xml 2013-06-18 08:10:49 UTC (rev 93) @@ -0,0 +1,49 @@ +<project name="${project.name}"> + + <bannerLeft> + <src alt="NuitonJS">logo.jpg</src> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> + + <body> + + <head> + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/mavenpom-site.js"> + </script> + + <link rel="stylesheet" type="text/css" + href="http://maven-site.nuiton.org/public/css/mavenpom-site.css"/> + </head> + + <breadcrumbs> + <item name="${project.name}" href="${project.url}"/> + </breadcrumbs> + + <menu ref="parent"/> + + <menu name="Utilisateurs"> + <item name="Accueil" href="index.html"/> + </menu> + + <menu ref="reports"/> + + <footer> + + <div id='projectMetas' + projectversion='${project.version}' + platform='${project.platform}' + projectid='${project.projectId}' + scm='${project.scm.connection}' + scmwebeditorenabled='${project.scmwebeditorEnabled}' + scmwebeditorurl='${project.scmwebeditorUrl}' + siteSourcesType='${project.siteSourcesType}' + piwikEnabled='${project.piwikEnabled}' + piwikId='${project.piwikId}'> + </div> + </footer> + + </body> + +</project>