twitter_cldr_js 2.2.4 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/History.txt +5 -0
- data/README.md +51 -5
- data/Rakefile +1 -1
- data/lib/assets/javascripts/twitter_cldr/af.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ar.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/be.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/bg.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/bn.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ca.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/cs.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/cy.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/da.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/de-CH.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/de.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/el.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/en-150.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-AU.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-CA.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-GB.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/en-IE.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-SG.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-ZA.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/es-419.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es-CO.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es-MX.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es-US.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/eu.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/fa.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/fi.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/fil.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/fr-BE.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/fr-CA.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/fr-CH.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/fr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ga.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/gl.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/he.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/hi.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/hr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/hu.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/id.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/is.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/it-CH.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/it.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ja.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ko.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/lv.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/msa.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/nl.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/no.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/pl.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/pt.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ro.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/ru.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/sk.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/sq.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/sr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/sv.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ta.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/th.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/tr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/uk.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ur.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/vi.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/zh-cn.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/zh-tw.js +214 -57
- data/lib/twitter_cldr/js/compiler.rb +13 -10
- data/lib/twitter_cldr/js/mustache/bundle.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/calendars/datetime.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/calendars/timespan.coffee +2 -3
- data/lib/twitter_cldr/js/mustache/numbers/numbers.coffee +27 -15
- data/lib/twitter_cldr/js/mustache/parsers/number_parser.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/shared/calendar.coffee +10 -1
- data/lib/twitter_cldr/js/mustache/shared/languages.coffee +15 -0
- data/lib/twitter_cldr/js/mustache/shared/lists.coffee +3 -5
- data/lib/twitter_cldr/js/mustache/shared/phone_codes.coffee +2 -6
- data/lib/twitter_cldr/js/mustache/shared/postal_codes.coffee +22 -0
- data/lib/twitter_cldr/js/mustache/shared/territories_containment.coffee +48 -0
- data/lib/twitter_cldr/js/renderers/base.rb +4 -0
- data/lib/twitter_cldr/js/renderers/bundle.rb +4 -0
- data/lib/twitter_cldr/js/renderers/calendars/additional_date_format_selector_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/calendars/datetime_renderer.rb +19 -9
- data/lib/twitter_cldr/js/renderers/calendars/timespan_renderer.rb +16 -10
- data/lib/twitter_cldr/js/renderers/numbers/numbers_renderer.rb +24 -13
- data/lib/twitter_cldr/js/renderers/parsers/number_parser.rb +1 -3
- data/lib/twitter_cldr/js/renderers/plurals/rules/plural_rules_renderer.rb +35 -4
- data/lib/twitter_cldr/js/renderers/shared/bidi_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/shared/calendar_renderer.rb +2 -2
- data/lib/twitter_cldr/js/renderers/shared/currencies_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/shared/languages_renderer.rb +27 -0
- data/lib/twitter_cldr/js/renderers/shared/list_renderer.rb +2 -2
- data/lib/twitter_cldr/js/renderers/shared/phone_codes_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/shared/postal_codes_renderer.rb +23 -0
- data/lib/twitter_cldr/js/renderers/shared/territories_containment_renderer.rb +20 -0
- data/lib/twitter_cldr/js/renderers.rb +6 -3
- data/lib/twitter_cldr/js/version.rb +1 -1
- data/spec/js/calendars/datetime.spec.js +16 -8
- data/spec/js/calendars/timespan.spec.js +2 -2
- data/spec/js/numbers/abbreviated/abbreviated_number.spec.js +9 -15
- data/spec/js/numbers/abbreviated/long_decimal.ko.spec.js +20 -0
- data/spec/js/numbers/abbreviated/short_decimal.ko.spec.js +20 -0
- data/spec/js/numbers/abbreviated/short_decimal.ru.spec.js +16 -0
- data/spec/js/numbers/currency.spec.js +12 -4
- data/spec/js/parsers/number_parser.spec.js +5 -1
- data/spec/js/shared/languages.spec.js +41 -0
- data/spec/js/shared/lists.spec.js +20 -0
- data/spec/js/shared/phone_codes.spec.js +1 -1
- data/spec/js/shared/postal_codes.spec.js +46 -0
- data/spec/js/shared/territories_containment.spec.js +89 -0
- data/twitter_cldr_js.gemspec +2 -3
- metadata +38 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 670b501bc9099173d458000e6b723d83fd2b1af5
|
4
|
+
data.tar.gz: 095765a29f80d71b134a87c7c6be6ad1b062da5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e5a8052a20e233fdae1955e9f59031ae17009655dcd2f181fcc73cbf680bca672bd493d05cf3ea9e184fa55abf33843527e19130536f8bf2c26699e8b344f10
|
7
|
+
data.tar.gz: 52f8961a8eff10a87885ac592595ace3dbde4e9bdcdd6a1e92277b4cd2349c01d26d810adb6bcac645d2322ab1ad338509b8e2c26148672cb4302c4782d4ff58
|
data/Gemfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 2.3.0
|
2
|
+
|
3
|
+
* Fixed issue affecting additional date/time formats that was causing pattern tokens to be interpreted as plaintext.
|
4
|
+
* Moved twitter-cldr-rb from a runtime to a development dependency.
|
5
|
+
|
1
6
|
=== 2.2.4
|
2
7
|
|
3
8
|
* Upgrading to twitter-cldr-rb 2.4.3 to fix abbreviated timespan issue in en-GB.
|
data/README.md
CHANGED
@@ -222,6 +222,36 @@ bidi_str.toString();
|
|
222
222
|
```
|
223
223
|
**Disclaimer**: Google Translate tells me the Arabic in the example above means "fancy", but my confidence is not very high, especially since all the letters are unattached. Apologies to any native speakers :)
|
224
224
|
|
225
|
+
### Postal Codes
|
226
|
+
|
227
|
+
The CLDR contains postal code validation regexes for a number of countries.
|
228
|
+
|
229
|
+
```javascript
|
230
|
+
// United States
|
231
|
+
TwitterCldr.PostalCodes.is_valid("us", "94103"); // true
|
232
|
+
TwitterCldr.PostalCodes.is_valid("us", "9410"); // false
|
233
|
+
|
234
|
+
// England (Great Britain)
|
235
|
+
TwitterCldr.PostalCodes.is_valid("gb", "BS98 1TL"); // true
|
236
|
+
|
237
|
+
// Sweden
|
238
|
+
TwitterCldr.PostalCodes.is_valid("se", "280 12"); // true
|
239
|
+
|
240
|
+
// Canada
|
241
|
+
TwitterCldr.PostalCodes.is_valid("ca", "V3H 1Z7"); // true
|
242
|
+
```
|
243
|
+
|
244
|
+
Get a list of supported territories by using the `territories` method:
|
245
|
+
|
246
|
+
```javascript
|
247
|
+
TwitterCldr.PostalCodes.territories(); // ["ad", "am", "ar", "as", "at", ... ]
|
248
|
+
```
|
249
|
+
|
250
|
+
Just want the regex? No problem:
|
251
|
+
|
252
|
+
```javascript
|
253
|
+
TwitterCldr.PostalCodes.regex_for_territory("us"); // /\d{5}([ \-]\d{4})?/
|
254
|
+
```
|
225
255
|
|
226
256
|
### Phone Codes
|
227
257
|
|
@@ -229,22 +259,38 @@ Look up phone codes by territory:
|
|
229
259
|
|
230
260
|
```javascript
|
231
261
|
// United States
|
232
|
-
TwitterCldr.PhoneCodes.code_for_territory("us") // "1"
|
262
|
+
TwitterCldr.PhoneCodes.code_for_territory("us"); // "1"
|
233
263
|
|
234
264
|
// Perú
|
235
|
-
TwitterCldr.PhoneCodes.code_for_territory("pe") // "51"
|
265
|
+
TwitterCldr.PhoneCodes.code_for_territory("pe"); // "51"
|
236
266
|
|
237
267
|
// Egypt
|
238
|
-
TwitterCldr.PhoneCodes.code_for_territory("eg") // "20"
|
268
|
+
TwitterCldr.PhoneCodes.code_for_territory("eg"); // "20"
|
239
269
|
|
240
270
|
// Denmark
|
241
|
-
TwitterCldr.PhoneCodes.code_for_territory("dk")
|
271
|
+
TwitterCldr.PhoneCodes.code_for_territory("dk"); // "45"
|
242
272
|
```
|
243
273
|
|
244
274
|
Get a list of supported territories by using the `territories` method:
|
245
275
|
|
246
276
|
```javascript
|
247
|
-
TwitterCldr.PhoneCodes.territories() // [
|
277
|
+
TwitterCldr.PhoneCodes.territories(); // ["zw", "an", "tr", "by", "mh", ...]
|
278
|
+
```
|
279
|
+
|
280
|
+
### Territories Containment
|
281
|
+
|
282
|
+
Determine if a territory/region contains another region or a country (as describe [here](http://www.unicode.org/cldr/charts/25/supplemental/territory_containment_un_m_49.html)):
|
283
|
+
|
284
|
+
```javascript
|
285
|
+
TwitterCldr.TerritoriesContainment.children('151') // ["BG", "BY", "CZ", "HU", "MD", "PL", ...]
|
286
|
+
TwitterCldr.TerritoriesContainment.children('RU') // []
|
287
|
+
|
288
|
+
TwitterCldr.TerritoriesContainment.parents('013') // ["419", "003", "019"]
|
289
|
+
TwitterCldr.TerritoriesContainment.parents('001') // []
|
290
|
+
|
291
|
+
TwitterCldr.TerritoriesContainment.contains('151', 'RU') // true
|
292
|
+
TwitterCldr.TerritoriesContainment.contains('419', 'BZ') // true
|
293
|
+
TwitterCldr.TerritoriesContainment.contains('419', 'FR') // false
|
248
294
|
```
|
249
295
|
|
250
296
|
|