diff --git a/.travis.yml b/.travis.yml index be9997e12c..b10fa18f2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ script: # [Error] QFontDatabase: Cannot find font directory /usr/lib/x86_64-linux-gnu/fonts - is Qt installed correctly? - sudo ln -s /usr/share/fonts /usr/lib/x86_64-linux-gnu/fonts - # iLib Full builde / Running nodeunit test. - - ant test + # iLib full build / Run nodeunit tests + - ant clean test #- which qmake #- which qmlscene #- cd qt/NodeunitTest diff --git a/build.properties b/build.properties index 54c7f64cb4..98e3913d58 100644 --- a/build.properties +++ b/build.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version=14.1.0 +version=14.1.1 diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 08a4ba4b77..90ea0cb104 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -1,6 +1,25 @@ Release Notes for Version 14 ============================ +Build 003 +------- +Published as version 14.1.1 + +Bug Fixes: +* Worked around a problem with uglifyjs which optimized out a block + of code that contained the comment that the ilib-webpack-loader was + looking for. The loader would replace that comment with dependencies on + the webpacked locale data files. Without that comment, no dependencies, + and therefore no locale data and no WebpackLoader code would be + included in the final webpack bundle. +* Added the full file name including the file extension for requires + of `index.js`. If file name extension is missing, QT cannot load that + file properly. +* Added missing `index.js` require statement in MeasurementFactory +* AddressFmt.getFormatInfo would throw an exception for locales where the locale data was not available. Now, + it does not, and instead, it returns some hard-coded info by default that is roughly similar to the en-US + settings. + Build 002 ------- Published as version 14.1.0 @@ -14,7 +33,7 @@ New Features: * Allows ilib to run in node or within a webpack bundle without changes * Allows clients to just require ilib classes directly without first requiring the loader installer -Bug Fixes +Bug Fixes: * Restored a missing mapping from the the native name for "Japan" to the ISO code "JP" in the nativecountries.json * Fixes address parsing for Japan diff --git a/js/build.xml b/js/build.xml index 1c2dc53e54..45bcd0d204 100644 --- a/js/build.xml +++ b/js/build.xml @@ -342,6 +342,7 @@ limitations under the License. + @@ -359,7 +360,7 @@ limitations under the License. - + diff --git a/js/index.js b/js/index.js index eaadc3168e..ac78c0544b 100644 --- a/js/index.js +++ b/js/index.js @@ -21,13 +21,7 @@ var ilib = require("./lib/ilib.js"); if (!ilib._platform || (typeof(ilib._dyndata) !== 'boolean' && typeof(ilib._dyncode) !== 'boolean')) { if (typeof(__webpack_require__) !== 'undefined') { - // The following will either require and then install the - // WebpackLoader to dynamically load locale data bundles, - // or it will statically require all of the locale data that - // this build needs so that it can be included into this - // webpack bundle. - - // !defineLocaleData + require("./lib/ilib-webpack.js"); } else { switch (ilib._getPlatform()) { case 'webos': @@ -37,7 +31,7 @@ if (!ilib._platform || (typeof(ilib._dyndata) !== 'boolean' && typeof(ilib._dync case 'qt': require("./lib/ilib-qt.js"); - + break; case 'rhino': require("./lib/ilib-rhino.js"); break; diff --git a/js/lib/Address.js b/js/lib/Address.js index c66f93a185..5f43c5ac96 100644 --- a/js/lib/Address.js +++ b/js/lib/Address.js @@ -21,7 +21,7 @@ // !data address countries nativecountries ctrynames -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/AddressFmt.js b/js/lib/AddressFmt.js index d13bd39f9a..5df9d2bf64 100644 --- a/js/lib/AddressFmt.js +++ b/js/lib/AddressFmt.js @@ -19,7 +19,7 @@ // !data address addressres regionnames -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); @@ -28,6 +28,42 @@ var Address = require("./Address.js"); var IString = require("./IString.js"); var ResBundle = require("./ResBundle.js"); +// default generic data +var defaultData = { + formats: { + "default": "{streetAddress}\n{locality} {region} {postalCode}\n{country}", + "nocountry": "{streetAddress}\n{locality} {region} {postalCode}" + }, + startAt: "end", + fields: [ + { + "name": "postalCode", + "line": "startAtLast", + "pattern": "[0-9]+", + "matchGroup": 0 + }, + { + "name": "region", + "line": "last", + "pattern": "([A-zÀÁÈÉÌÍÑÒÓÙÚÜàáèéìíñòóùúü\\.\\-\\']+\\s*){1,2}$", + "matchGroup": 0 + }, + { + "name": "locality", + "line": "last", + "pattern": "([A-zÀÁÈÉÌÍÑÒÓÙÚÜàáèéìíñòóùúü\\.\\-\\']+\\s*){1,2}$", + "matchGroup": 0 + } + ], + fieldNames: { + "streetAddress": "Street Address", + "locality": "City", + "postalCode": "Zip Code", + "region": "State", + "country": "Country" + } +}; + /** * @class * Create a new formatter object to format physical addresses in a particular way. @@ -128,10 +164,16 @@ var AddressFmt = function(options) { * @private */ AddressFmt.prototype._init = function () { - this.style = this.info && this.info.formats && this.info.formats[this.styleName]; + if (!this.info) this.info = defaultData; + + this.style = this.info.formats && this.info.formats[this.styleName]; // use generic default -- should not happen, but just in case... - this.style = this.style || (this.info && this.info.formats && this.info.formats["default"]) || "{streetAddress}\n{locality} {region} {postalCode}\n{country}"; + this.style = this.style || (this.info.formats && this.info.formats["default"]) || defaultData.formats["default"]; + + if (!this.info.fieldNames) { + this.info.fieldNames = defaultData.fieldNames; + } }; /** @@ -369,7 +411,7 @@ AddressFmt.prototype.getFormatInfo = function(locale, sync, callback) { sync: this.sync, loadParams: this.loadParams, onLoad: ilib.bind(this, function (rb) { - var type, format, fields = this.info.fields; + var type, format, fields = this.info.fields || defaultData.fields; if (this.info.multiformat) { type = isAsianLocale(this.locale) ? "asian" : "latin"; fields = this.info.fields[type]; diff --git a/js/lib/AlphabeticIndex.js b/js/lib/AlphabeticIndex.js index 092d02e53e..9009059722 100644 --- a/js/lib/AlphabeticIndex.js +++ b/js/lib/AlphabeticIndex.js @@ -19,7 +19,7 @@ // !data nfc nfkd -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); var CType = require("./CType.js"); diff --git a/js/lib/Astro.js b/js/lib/Astro.js index a87c4094a0..747dbb4e10 100644 --- a/js/lib/Astro.js +++ b/js/lib/Astro.js @@ -25,7 +25,7 @@ * September 1999. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var SearchUtils = require("./SearchUtils.js"); diff --git a/js/lib/CType.js b/js/lib/CType.js index 46c6f5ebef..dbb4341943 100644 --- a/js/lib/CType.js +++ b/js/lib/CType.js @@ -19,7 +19,7 @@ // !data ctype -var ilib = require("../index"); +var ilib = require("../index.js"); var SearchUtils = require("./SearchUtils.js"); var Utils = require("./Utils.js"); var IString = require("./IString.js"); diff --git a/js/lib/CalendarFactory.js b/js/lib/CalendarFactory.js index 685e20e424..722a5d91f9 100644 --- a/js/lib/CalendarFactory.js +++ b/js/lib/CalendarFactory.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var Locale = require("./Locale.js"); var LocaleInfo = require("./LocaleInfo.js"); var Calendar = require("./Calendar.js"); diff --git a/js/lib/CaseMapper.js b/js/lib/CaseMapper.js index cb7603ff32..d38808d5f3 100644 --- a/js/lib/CaseMapper.js +++ b/js/lib/CaseMapper.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var Locale = require("./Locale.js"); var IString = require("./IString.js"); diff --git a/js/lib/Charmap.js b/js/lib/Charmap.js index 1c2708f933..826b313242 100644 --- a/js/lib/Charmap.js +++ b/js/lib/Charmap.js @@ -19,7 +19,7 @@ // !data charmaps charset/US-ASCII charset/ISO-10646-UCS-2 charset/ISO-8859-1 charset/ISO-8859-15 charmaps/ISO-8859-15 charmaps/ISO-8859-1 charset/ISO-8859-1 -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var IString = require("./IString.js"); diff --git a/js/lib/CharmapFactory.js b/js/lib/CharmapFactory.js index 356552d4a6..454d008638 100644 --- a/js/lib/CharmapFactory.js +++ b/js/lib/CharmapFactory.js @@ -18,7 +18,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var Charset = require("./Charset.js"); diff --git a/js/lib/CharmapTable.js b/js/lib/CharmapTable.js index 9535997e8d..b6af7cf25f 100644 --- a/js/lib/CharmapTable.js +++ b/js/lib/CharmapTable.js @@ -19,7 +19,7 @@ // !data charmaps/ISO-8859-15 charset/ISO-8859-15 -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Charset = require("./Charset.js"); var Charmap = require("./Charmap.js"); diff --git a/js/lib/Charset.js b/js/lib/Charset.js index 25d2c3723e..c871442819 100644 --- a/js/lib/Charset.js +++ b/js/lib/Charset.js @@ -19,7 +19,7 @@ // !data charset charsetaliases charset/ISO-8859-1 charset/ISO-8859-15 charset/UTF-8 -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); /** diff --git a/js/lib/Collator.js b/js/lib/Collator.js index ee932e7789..12eabf4575 100644 --- a/js/lib/Collator.js +++ b/js/lib/Collator.js @@ -19,7 +19,7 @@ // !data collation -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/CopticDate.js b/js/lib/CopticDate.js index 396ec853b4..5b058787ce 100644 --- a/js/lib/CopticDate.js +++ b/js/lib/CopticDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var MathUtils = require("./MathUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/Country.js b/js/lib/Country.js index f41bd2c55d..773c959d6e 100644 --- a/js/lib/Country.js +++ b/js/lib/Country.js @@ -19,7 +19,7 @@ // !data ctryreverse -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); var LocaleInfo = require("./LocaleInfo.js"); diff --git a/js/lib/Currency.js b/js/lib/Currency.js index 3d417a4eb6..db6b681766 100644 --- a/js/lib/Currency.js +++ b/js/lib/Currency.js @@ -19,7 +19,7 @@ // !data currency -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); var LocaleInfo = require("./LocaleInfo.js"); diff --git a/js/lib/DateFactory.js b/js/lib/DateFactory.js index 1786211ee8..703ea14f79 100644 --- a/js/lib/DateFactory.js +++ b/js/lib/DateFactory.js @@ -18,7 +18,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/DateFmt.js b/js/lib/DateFmt.js index 2e318c7dae..d6c060d9c6 100644 --- a/js/lib/DateFmt.js +++ b/js/lib/DateFmt.js @@ -19,7 +19,7 @@ // !data dateformats sysres -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/DateRngFmt.js b/js/lib/DateRngFmt.js index 82fcb4c4e2..dfe5f32554 100644 --- a/js/lib/DateRngFmt.js +++ b/js/lib/DateRngFmt.js @@ -19,7 +19,7 @@ // !data dateformats sysres -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/DurationFmt.js b/js/lib/DurationFmt.js index d8c02e6337..5e65d6a530 100644 --- a/js/lib/DurationFmt.js +++ b/js/lib/DurationFmt.js @@ -19,7 +19,7 @@ // !data dateformats sysres -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var Locale = require("./Locale.js"); var LocaleInfo = require("./LocaleInfo.js"); diff --git a/js/lib/EthiopicDate.js b/js/lib/EthiopicDate.js index e496ecc3af..02d548ad9c 100644 --- a/js/lib/EthiopicDate.js +++ b/js/lib/EthiopicDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var MathUtils = require("./MathUtils.js"); var EthiopicRataDie = require("./EthiopicRataDie.js"); diff --git a/js/lib/GlyphString.js b/js/lib/GlyphString.js index 81dfaa478f..bf32f4a5c1 100644 --- a/js/lib/GlyphString.js +++ b/js/lib/GlyphString.js @@ -20,7 +20,7 @@ // !data ccc nfc ctype_m -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/GregorianDate.js b/js/lib/GregorianDate.js index 08f9a7ec12..d97c37587f 100644 --- a/js/lib/GregorianDate.js +++ b/js/lib/GregorianDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var SearchUtils = require("./SearchUtils.js"); var MathUtils = require("./MathUtils.js"); diff --git a/js/lib/HanCal.js b/js/lib/HanCal.js index 507c55b15d..e7fdc496c9 100644 --- a/js/lib/HanCal.js +++ b/js/lib/HanCal.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var MathUtils = require("./MathUtils.js"); var Calendar = require("./Calendar.js"); diff --git a/js/lib/HanDate.js b/js/lib/HanDate.js index aab13db5e3..aec130eb0d 100644 --- a/js/lib/HanDate.js +++ b/js/lib/HanDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var MathUtils = require("./MathUtils.js"); diff --git a/js/lib/HanRataDie.js b/js/lib/HanRataDie.js index 8436b97d82..d0fc2d1890 100644 --- a/js/lib/HanRataDie.js +++ b/js/lib/HanRataDie.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var MathUtils = require("./MathUtils.js"); var HanCal = require("./HanCal.js"); var RataDie = require("./RataDie.js"); diff --git a/js/lib/HebrewDate.js b/js/lib/HebrewDate.js index 4f84bcc9ea..8f298074a0 100644 --- a/js/lib/HebrewDate.js +++ b/js/lib/HebrewDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var MathUtils = require("./MathUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/INumber.js b/js/lib/INumber.js index fa9b9d3b24..059cb8cf7e 100644 --- a/js/lib/INumber.js +++ b/js/lib/INumber.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var Locale = require("./Locale.js"); var LocaleInfo = require("./LocaleInfo.js"); diff --git a/js/lib/IString.js b/js/lib/IString.js index 46cf7de100..027bd70f77 100644 --- a/js/lib/IString.js +++ b/js/lib/IString.js @@ -19,7 +19,7 @@ // !data plurals -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var MathUtils = require("./MathUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/IslamicDate.js b/js/lib/IslamicDate.js index bbe5aa7879..68d81badbe 100644 --- a/js/lib/IslamicDate.js +++ b/js/lib/IslamicDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var SearchUtils = require("./SearchUtils.js"); var MathUtils = require("./MathUtils.js"); diff --git a/js/lib/JulianDate.js b/js/lib/JulianDate.js index 3c32ba3606..7dbba59527 100644 --- a/js/lib/JulianDate.js +++ b/js/lib/JulianDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var SearchUtils = require("./SearchUtils.js"); var MathUtils = require("./MathUtils.js"); diff --git a/js/lib/ListFmt.js b/js/lib/ListFmt.js index 674cb08629..76fafe7042 100644 --- a/js/lib/ListFmt.js +++ b/js/lib/ListFmt.js @@ -20,7 +20,7 @@ // !data list -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/LocaleInfo.js b/js/lib/LocaleInfo.js index 729d7116d7..ebcb7ac78d 100644 --- a/js/lib/LocaleInfo.js +++ b/js/lib/LocaleInfo.js @@ -19,7 +19,7 @@ // !data localeinfo -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/LocaleMatcher.js b/js/lib/LocaleMatcher.js index b2bec001e9..6c9835cfdd 100644 --- a/js/lib/LocaleMatcher.js +++ b/js/lib/LocaleMatcher.js @@ -19,7 +19,7 @@ // !data localematch -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/MeasurementFactory.js b/js/lib/MeasurementFactory.js index 74156379cd..e087c896d0 100644 --- a/js/lib/MeasurementFactory.js +++ b/js/lib/MeasurementFactory.js @@ -37,6 +37,7 @@ Measurement.js // TODO: make these dependencies dynamic or at least generate them in the build // These will each add themselves to Measurement._constructors[] +var ilib = require("../index.js"); var UnknownUnit = require("./UnknownUnit.js"); var AreaUnit = require("./AreaUnit.js"); var DigitalStorageUnit = require("./DigitalStorageUnit.js"); diff --git a/js/lib/Name.js b/js/lib/Name.js index 97da7d212c..a0b2af783f 100644 --- a/js/lib/Name.js +++ b/js/lib/Name.js @@ -25,7 +25,7 @@ // http://www.mentalfloss.com/blogs/archives/59277 // other countries with first name restrictions: Norway, China, New Zealand, Japan, Sweden, Germany, Hungary -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/NameFmt.js b/js/lib/NameFmt.js index 556f3067cf..8c2ebf8bb4 100644 --- a/js/lib/NameFmt.js +++ b/js/lib/NameFmt.js @@ -19,7 +19,7 @@ // !data name -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/NormString.js b/js/lib/NormString.js index 9ff6b192e1..4e144921e8 100644 --- a/js/lib/NormString.js +++ b/js/lib/NormString.js @@ -19,7 +19,7 @@ // !data ccc nfd nfc nfkd nfkc -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/NumFmt.js b/js/lib/NumFmt.js index 6759f43648..8df0154245 100644 --- a/js/lib/NumFmt.js +++ b/js/lib/NumFmt.js @@ -30,7 +30,7 @@ JSUtils.js // !data localeinfo currency -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var MathUtils = require("./MathUtils.js"); diff --git a/js/lib/NumberingPlan.js b/js/lib/NumberingPlan.js index 05c82580ce..663c1d461d 100644 --- a/js/lib/NumberingPlan.js +++ b/js/lib/NumberingPlan.js @@ -19,7 +19,7 @@ // !data numplan -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/PersRataDie.js b/js/lib/PersRataDie.js index 3d37f8560a..710ef96b9a 100644 --- a/js/lib/PersRataDie.js +++ b/js/lib/PersRataDie.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var MathUtils = require("./MathUtils.js"); var Astro = require("./Astro.js"); diff --git a/js/lib/PersianAlgoDate.js b/js/lib/PersianAlgoDate.js index 5f951c43ec..0cd7865c3b 100644 --- a/js/lib/PersianAlgoDate.js +++ b/js/lib/PersianAlgoDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var SearchUtils = require("./SearchUtils.js"); var MathUtils = require("./MathUtils.js"); diff --git a/js/lib/PersianDate.js b/js/lib/PersianDate.js index 503cb78f5f..367274896c 100644 --- a/js/lib/PersianDate.js +++ b/js/lib/PersianDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var SearchUtils = require("./SearchUtils.js"); var MathUtils = require("./MathUtils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/PhoneFmt.js b/js/lib/PhoneFmt.js index 9c929d4683..a3e51d2dc6 100644 --- a/js/lib/PhoneFmt.js +++ b/js/lib/PhoneFmt.js @@ -19,7 +19,7 @@ // !data phonefmt -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/PhoneGeoLocator.js b/js/lib/PhoneGeoLocator.js index 00e78d18f3..d34742d24d 100644 --- a/js/lib/PhoneGeoLocator.js +++ b/js/lib/PhoneGeoLocator.js @@ -19,7 +19,7 @@ // !data iddarea area extarea extstates phoneres -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/PhoneLocale.js b/js/lib/PhoneLocale.js index 000263473a..a8679afc02 100644 --- a/js/lib/PhoneLocale.js +++ b/js/lib/PhoneLocale.js @@ -19,7 +19,7 @@ // !data phoneloc -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/PhoneNumber.js b/js/lib/PhoneNumber.js index 98374665ce..3ff13eb91d 100644 --- a/js/lib/PhoneNumber.js +++ b/js/lib/PhoneNumber.js @@ -19,7 +19,7 @@ // !data states idd mnc -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); var NumberingPlan = require("./NumberingPlan.js"); diff --git a/js/lib/ResBundle.js b/js/lib/ResBundle.js index 607ba14cb5..d542085088 100644 --- a/js/lib/ResBundle.js +++ b/js/lib/ResBundle.js @@ -19,7 +19,7 @@ // !data pseudomap -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/ScriptInfo.js b/js/lib/ScriptInfo.js index da8f9fd182..c3a2162c45 100644 --- a/js/lib/ScriptInfo.js +++ b/js/lib/ScriptInfo.js @@ -19,7 +19,7 @@ // !data scripts -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); /** diff --git a/js/lib/StringMapper.js b/js/lib/StringMapper.js index 9e21a12d5d..3b4fc50aab 100644 --- a/js/lib/StringMapper.js +++ b/js/lib/StringMapper.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/ThaiSolarDate.js b/js/lib/ThaiSolarDate.js index e2f1f15040..3888622d1d 100644 --- a/js/lib/ThaiSolarDate.js +++ b/js/lib/ThaiSolarDate.js @@ -17,7 +17,7 @@ * limitations under the License. */ -var ilib = require("../index"); +var ilib = require("../index.js"); var JSUtils = require("./JSUtils.js"); var IDate = require("./IDate.js"); diff --git a/js/lib/TimeZone.js b/js/lib/TimeZone.js index fbf40212c6..66dc66de9f 100644 --- a/js/lib/TimeZone.js +++ b/js/lib/TimeZone.js @@ -19,7 +19,7 @@ // !data localeinfo zoneinfo -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var MathUtils = require("./MathUtils.js"); var JSUtils = require("./JSUtils.js"); diff --git a/js/lib/UnitFmt.js b/js/lib/UnitFmt.js index d56e447360..e5cf39ed7f 100644 --- a/js/lib/UnitFmt.js +++ b/js/lib/UnitFmt.js @@ -30,7 +30,7 @@ Measurement.js // !data unitfmt -var ilib = require("../index"); +var ilib = require("../index.js"); var Utils = require("./Utils.js"); var Locale = require("./Locale.js"); diff --git a/js/lib/ilib-qt.js b/js/lib/ilib-qt.js index d80f630e3b..870fb137ba 100644 --- a/js/lib/ilib-qt.js +++ b/js/lib/ilib-qt.js @@ -72,7 +72,6 @@ requireClass.prototype.require = function(parent, pathname, absolutePath) { pathname = this.root + "/../test" + absolutePath; //console.log("[ilib-qt.js] Loading Test file... "+ pathname); } else { - if (parent && parent.charAt(0) !== '/') { // take care of relative parents (aren't all parents relatives? haha) parent = this.root + '/' + parent; @@ -84,7 +83,7 @@ requireClass.prototype.require = function(parent, pathname, absolutePath) { var base = parent || (module.filename && this.dirname(module.filename)) || this.root; - //console.log("require: base is " + base); + //console.log("******** require: base is " + base); if (pathname.charAt(0) !== '/') { pathname = base + "/" + pathname; diff --git a/js/lib/ilib-getdata.js b/js/lib/ilib-webpack.js similarity index 93% rename from js/lib/ilib-getdata.js rename to js/lib/ilib-webpack.js index 84c3620d76..7884342bac 100644 --- a/js/lib/ilib-getdata.js +++ b/js/lib/ilib-webpack.js @@ -1,5 +1,5 @@ /** - * ilib-getdata.js - define the locale data for assembled or dynamic + * ilib-webpack.js - define the locale data for assembled or dynamic * * @license * Copyright © 2018, JEDLSoft diff --git a/js/lib/isAlpha.js b/js/lib/isAlpha.js index afab9e4b83..ec3fd09800 100644 --- a/js/lib/isAlpha.js +++ b/js/lib/isAlpha.js @@ -19,7 +19,7 @@ // !data ctype_l -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isAscii.js b/js/lib/isAscii.js index 5f650a56d6..f91797a40f 100644 --- a/js/lib/isAscii.js +++ b/js/lib/isAscii.js @@ -19,7 +19,7 @@ // !data ctype -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isBlank.js b/js/lib/isBlank.js index 346fec401d..b50d9f32b1 100644 --- a/js/lib/isBlank.js +++ b/js/lib/isBlank.js @@ -19,7 +19,7 @@ // !data ctype -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isCntrl.js b/js/lib/isCntrl.js index 49fb2c4cfd..f0d21d31ca 100644 --- a/js/lib/isCntrl.js +++ b/js/lib/isCntrl.js @@ -19,7 +19,7 @@ // !data ctype_c -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isDigit.js b/js/lib/isDigit.js index 1426f3fd76..91e6f9f76e 100644 --- a/js/lib/isDigit.js +++ b/js/lib/isDigit.js @@ -19,7 +19,7 @@ // !data ctype ctype_n -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isIdeo.js b/js/lib/isIdeo.js index db61dfd2c5..000113a284 100644 --- a/js/lib/isIdeo.js +++ b/js/lib/isIdeo.js @@ -19,7 +19,7 @@ // !data ctype -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isLower.js b/js/lib/isLower.js index b268fc40aa..0896f60e02 100644 --- a/js/lib/isLower.js +++ b/js/lib/isLower.js @@ -19,7 +19,7 @@ // !data ctype_l -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isPunct.js b/js/lib/isPunct.js index f220e0bb56..799f600e6f 100644 --- a/js/lib/isPunct.js +++ b/js/lib/isPunct.js @@ -19,7 +19,7 @@ // !data ctype_p -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isScript.js b/js/lib/isScript.js index 4e1ce34724..23a1453c93 100644 --- a/js/lib/isScript.js +++ b/js/lib/isScript.js @@ -19,7 +19,7 @@ // !data scriptToRange -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isSpace.js b/js/lib/isSpace.js index fd38201840..883add2bd6 100644 --- a/js/lib/isSpace.js +++ b/js/lib/isSpace.js @@ -19,7 +19,7 @@ // !data ctype ctype_z -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isUpper.js b/js/lib/isUpper.js index 72f21b4343..1e1055d9bf 100644 --- a/js/lib/isUpper.js +++ b/js/lib/isUpper.js @@ -19,7 +19,7 @@ // !data ctype_l -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/lib/isXdigit.js b/js/lib/isXdigit.js index 0c803ea2f0..64ed8cbe50 100644 --- a/js/lib/isXdigit.js +++ b/js/lib/isXdigit.js @@ -19,7 +19,7 @@ // !data ctype -var ilib = require("../index"); +var ilib = require("../index.js"); var CType = require("./CType.js"); var IString = require("./IString.js"); diff --git a/js/test/address/testaddress.js b/js/test/address/testaddress.js index 25719da43a..2336c9c643 100644 --- a/js/test/address/testaddress.js +++ b/js/test/address/testaddress.js @@ -345,7 +345,24 @@ module.exports.testaddress = { test.equal(formatter.format(parsedAddress), expected); test.done(); }, - + + testFormatAddressUnknownCountry: function(test) { + test.expect(1); + var parsedAddress = new Address({ + streetAddress: "1234 Any Street", + locality: "Anytown", + region: "CA", + postalCode: "94085", + country: "Unknown", + countryCode: "XY" + }, {locale: 'en-XY'}); + + var expected = "1234 Any Street\nAnytown CA 94085\nUnknown"; + var formatter = new AddressFmt({locale: 'en-XY', style: 'nocountry'}); + test.equal(formatter.format(parsedAddress), expected); + test.done(); + }, + // for DFISH-9927 testParseAddressUnknownLocale: function(test) { test.expect(7); @@ -1514,6 +1531,29 @@ module.exports.testaddress = { test.equal(info[3][0].component, "country"); test.equal(info[3][0].label, "국가"); test.done(); - } + }, + testAddressFmtGetFormatInfoUnknownCountry: function(test) { + test.expect(10); + var formatter = new AddressFmt({locale: 'en-XY'}); + + var info = formatter.getFormatInfo(); + + test.ok(info); + + // test for generic root data + test.equal(info[1][0].component, "locality"); + test.equal(info[1][0].label, "City"); + test.equal(info[1][0].constraint, "([A-zÀÁÈÉÌÍÑÒÓÙÚÜàáèéìíñòóùúü\\.\\-\\']+\\s*){1,2}$"); + + test.equal(info[1][1].component, "region"); + test.equal(info[1][1].label, "Province"); + test.equal(info[1][1].constraint, "([A-zÀÁÈÉÌÍÑÒÓÙÚÜàáèéìíñòóùúü\\.\\-\\']+\\s*){1,2}$"); + + test.equal(info[1][2].component, "postalCode"); + test.equal(info[1][2].label, "Postal Code"); + test.equal(info[1][2].constraint, "[0-9]+"); + + test.done(); + } }; diff --git a/js/test/address/testaddressasync.js b/js/test/address/testaddressasync.js index 816b35a2b2..2c4d49e561 100644 --- a/js/test/address/testaddressasync.js +++ b/js/test/address/testaddressasync.js @@ -399,7 +399,30 @@ module.exports.testaddressasync = { } }); }, - + + testFormatAddressUnknownCountry: function(test) { + test.expect(1); + var parsedAddress = new Address({ + streetAddress: "1234 Any Street", + locality: "Anytown", + region: "CA", + postalCode: "94085", + country: "Unknown", + countryCode: "XY" + }, {locale: 'en-XY'}); + + var expected = "1234 Any Street\nAnytown CA 94085\nUnknown"; + new AddressFmt({ + locale: 'en-XY', + sync: false, + style: 'nocountry', + onLoad: function(formatter) { + test.equal(formatter.format(parsedAddress), expected); + test.done(); + } + }); + }, + testAddressFmtGetFormatInfoUSRightConstraints: function(test) { test.expect(19); new AddressFmt({ @@ -436,6 +459,31 @@ module.exports.testaddressasync = { test.equal(r.code, "ZA"); test.equal(r.name, "South Africa"); + test.done(); + }); + } + }); + }, + + testAddressFmtGetFormatInfoUnknownCountry: function(test) { + test.expect(7); + new AddressFmt({ + locale: 'en-XY', + sync: false, + onLoad: function(formatter) { + formatter.getFormatInfo(undefined, false, function(info) { + test.ok(info); + + // test for generic data + test.equal(info[1][0].component, "locality"); + test.equal(info[1][0].constraint, "([A-zÀÁÈÉÌÍÑÒÓÙÚÜàáèéìíñòóùúü\\.\\-\\']+\\s*){1,2}$"); + + test.equal(info[1][1].component, "region"); + test.equal(info[1][1].constraint, "([A-zÀÁÈÉÌÍÑÒÓÙÚÜàáèéìíñòóùúü\\.\\-\\']+\\s*){1,2}$"); + + test.equal(info[1][2].component, "postalCode"); + test.equal(info[1][2].constraint, "[0-9]+"); + test.done(); }); } diff --git a/js/test/nodeunit/nodeunit-qml.js b/js/test/nodeunit/nodeunit-qml.js index 01a88f5539..f2d5258d4a 100644 --- a/js/test/nodeunit/nodeunit-qml.js +++ b/js/test/nodeunit/nodeunit-qml.js @@ -363,7 +363,7 @@ var nodeunit = (function(){ function getFailureDetails(assertion) { if (assertion.error && assertion.error.name === "AssertionError") { - return "Expected that actual " + assertion.error.operator + " " + assertion.error.expected + ", but got " + assertion.error.actual + " instead."; + return "Expected that actual " + assertion.error.operator + " [[" + assertion.error.expected + "]] , but got [[" + assertion.error.actual + "]] instead."; } else if (assertion.message) { return assertion.message; } diff --git a/package.json b/package.json index e8a369b783..c407b43ee9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ilib", - "version": "14.1.0", + "version": "14.1.1", "main": "js/lib/ilib-node.js", "description": "iLib is a cross-engine library of internationalization (i18n) classes written in pure JS", "keywords": [ diff --git a/qt/FileReader/.qmake.stash b/qt/FileReader/.qmake.stash deleted file mode 100644 index 7211594d6e..0000000000 --- a/qt/FileReader/.qmake.stash +++ /dev/null @@ -1,18 +0,0 @@ -QMAKE_XCODE_DEVELOPER_PATH = /Applications/Xcode.app/Contents/Developer -QMAKE_XCODE_VERSION = 6.2 -QMAKE_MAC_SDK.macosx.path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -QMAKE_MAC_SDK.macosx.version = 10.10 -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_FIX_RPATH = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool \ - -id -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_AR = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar \ - cq -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_RANLIB = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib \ - -s -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK_SHLIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -QMAKE_MAC_SDK.macosx.platform_name = macosx diff --git a/qt/NodeunitTest/NodeunitRunAll.qml b/qt/NodeunitTest/NodeunitRunAll.qml index 2fbd4eee65..09d953deeb 100644 --- a/qt/NodeunitTest/NodeunitRunAll.qml +++ b/qt/NodeunitTest/NodeunitRunAll.qml @@ -11,6 +11,7 @@ QtObject { var TestSuite = TestSuiteModule.TestSuite; var TestRunner = TestRunnerModule.TestRunner; var runner = new TestRunner(); + var date = new Date(); var suiteDefinitions = { "address": "/address/testSuiteFiles.js", @@ -29,7 +30,7 @@ QtObject { "units": "/units/testSuiteFiles.js", "util": "/util/testSuiteFiles.js" }; - + console.log("<<<<< Start time of full test: " + date.getHours() +":"+ date.getMinutes() +":"+ date.getSeconds()+ " >>>>>"); var s, ts; for (s in suiteDefinitions) { ts = new TestSuite(suiteDefinitions[s], s); @@ -37,6 +38,7 @@ QtObject { runner.addSuite(ts); } runner.runTests(); + console.log("<<<<< End time of full test: " + date.getHours() +":"+ date.getMinutes() +":"+ date.getSeconds()+ " >>>>>"); console.log("\n *************************** All iLib tests on QML are done. ***********************************"); Qt.quit(); }