Prvi commit
This commit is contained in:
13
EveryThing/wwwroot/vendor/libs/cldrjs/CHANGELOG.md
vendored
Normal file
13
EveryThing/wwwroot/vendor/libs/cldrjs/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# 0.4.0
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
- Bundle Lookup Matcher ([f9572aa][], [#17][]).
|
||||
|
||||
Applications that explicitly use `/main/{languageId}` to traverse main items need to update it to `/main/{bundle}`. Applications that use the `.main()` method need to take no action.
|
||||
|
||||
This change improves how cldrjs performs lookup for the right bundle when traversing main items. See more information at [Bundle Lookup Matcher][].
|
||||
|
||||
[f9572aa]: https://github.com/rxaviers/cldrjs/commit/f9572aa0164a8e4fcb5b7c4ae95957f2ced8e96a
|
||||
[#17]: https://github.com/rxaviers/cldrjs/issues/17
|
||||
[Bundle Lookup Matcher]: ./doc/bundle_lookup_matcher.md
|
||||
27
EveryThing/wwwroot/vendor/libs/cldrjs/DCO.md
vendored
Normal file
27
EveryThing/wwwroot/vendor/libs/cldrjs/DCO.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
If you would like to make a contribution to cldr.js, please certify to the following:
|
||||
|
||||
---
|
||||
|
||||
cldr.js Developer's Certificate of Origin. Version 1.0
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I have the right to submit it under the MIT license; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the MIT license; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other person who certified (a) or (b) and I have not modified it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all metadata and personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with cldr.js's policies and the requirements of the MIT license where they are relevant.
|
||||
|
||||
(e) I am granting this work to this project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
|
||||
|
||||
---
|
||||
|
||||
And please confirm your certification to the above by adding the following line to your commit message:
|
||||
|
||||
Signed-off-by: Jane Developer <jane@example.org>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions). Committing with `git commit -s` will add the sign-off at the end of the commit message for you.
|
||||
|
||||
If you are a developer who is authorized to contribute to cldr.js on behalf of your employer, then please use your corporate email address in the Signed-off-by tag. If not, then please use a personal email address.
|
||||
22
EveryThing/wwwroot/vendor/libs/cldrjs/LICENSE-MIT
vendored
Normal file
22
EveryThing/wwwroot/vendor/libs/cldrjs/LICENSE-MIT
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) Rafael Xavier de Souza http://rafael.xavier.blog.br
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
561
EveryThing/wwwroot/vendor/libs/cldrjs/README.md
vendored
Normal file
561
EveryThing/wwwroot/vendor/libs/cldrjs/README.md
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
# cldr.js - Simple CLDR traverser
|
||||
|
||||
[CLDR (unicode.org)](http://cldr.unicode.org/) provides locale content for i18n software. The data is provided in two formats: LDML (XML format) and JSON. Our goal is to provide a simple layer to facilitate i18n software to access and use the [official CLDR JSON data](http://cldr.unicode.org/index/cldr-spec/json).
|
||||
|
||||
| File | Minified + gzipped size | Summary |
|
||||
|---|--:|---|
|
||||
| cldr.js | 2.1KB | Core library |
|
||||
| cldr/event.js | +1.4KB | Provides methods to allow listening to events, eg. `get` |
|
||||
| cldr/supplemental.js | +0.5KB | Provides supplemental helper methods |
|
||||
| cldr/unresolved.js | +0.7KB | Provides inheritance support for unresolved data |
|
||||
|
||||
Quick jump:
|
||||
- [About cldr.js?](#about-cldrjs)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Usage and installation](#usage-and-installation)
|
||||
- [How to get CLDR JSON data?](#how-to-get-cldr-json-data)
|
||||
- [How do I load CLDR data into Cldrjs?](#how-do-i-load-cldr-data-into-cldrjs)
|
||||
- [API](#api)
|
||||
- [Error reference](#error)
|
||||
- [Development / Contributing](#development--contributing)
|
||||
|
||||
|
||||
## About cldr.js?
|
||||
|
||||
### Who uses cldr.js?
|
||||
|
||||
| Organization | Project |
|
||||
|---|---|
|
||||
|  | https://github.com/globalize/globalize |
|
||||
|  | https://github.com/angular/angular |
|
||||
|
||||
### Where to use it?
|
||||
|
||||
It's designed to work both in the [browser](#usage-and-installation) and in [Node.js](#commonjs--nodejs). It supports [AMD](#usage-and-installation) and [CommonJs](#usage-and-installation);
|
||||
|
||||
See [Usage and installation](#usage-and-installation).
|
||||
|
||||
### What changed from 0.3.x to 0.4.x?
|
||||
|
||||
See our [changelogs](./CHANGELOG.md).
|
||||
|
||||
### Load only the CLDR portion you need
|
||||
|
||||
```javascript
|
||||
// Load the appropriate portion of CLDR JSON data
|
||||
Cldr.load(
|
||||
likelySubtagsData,
|
||||
enData,
|
||||
ptBrData
|
||||
);
|
||||
```
|
||||
|
||||
See [How to get CLDR JSON data?](#how-to-get-cldr-json-data) below for more information on how to get that data.
|
||||
|
||||
### Instantiate a locale and get it normalized
|
||||
|
||||
```javascript
|
||||
var en = new Cldr( "en" );
|
||||
en.attributes;
|
||||
// > {
|
||||
// "bundle": "en",
|
||||
// "minLanguageId": "en",
|
||||
// "maxLanguageId": "en-Latn-US",
|
||||
// "language": "en",
|
||||
// "script": "Latn",
|
||||
// "territory": "US",
|
||||
// "region": "US"
|
||||
// }
|
||||
|
||||
var zh = new Cldr( "zh-u-nu-finance-cu-cny" );
|
||||
zh.attributes;
|
||||
// > {
|
||||
// "bundle": "zh-Hant",
|
||||
// "minLanguageId": "zh",
|
||||
// "maxLanguageId": "zh-Hans-CN",
|
||||
// "language": "zh",
|
||||
// "script": "Hans",
|
||||
// "territory": "CN",
|
||||
// "region": "CN",
|
||||
// "u-nu": "finance",
|
||||
// "u-cu": "cny"
|
||||
// }
|
||||
|
||||
```
|
||||
|
||||
- `language`, `script`, `territory` (also aliased as `region`), `maxLanguageId` (computed by [adding likely subtags](./src/core/likely_subtags.js)) and `minLanguageId` (computed by [removing likely subtags](./src/core/remove_likely_subtags.js)) according to the [specification](http://www.unicode.org/reports/tr35/#Likely_Subtags).
|
||||
- `bundle` holds the bundle lookup match based on the available loaded CLDR data, obtained by following [Bundle Lookup Matcher][].
|
||||
- [Unicode locale extensions](http://www.unicode.org/reports/tr35/#u_Extension).
|
||||
|
||||
Comparison between different locales.
|
||||
|
||||
| locale | minLanguageId | maxLanguageId | language | script | region |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| **en** | `"en"` | `"en-Latn-US"` | `"en"` | `"Latn"` | `"US"` |
|
||||
| **en-US** | `"en"` | `"en-Latn-US"` | `"en"` | `"Latn"` | `"US"` |
|
||||
| **de** | `"de"` | `"de-Latn-DE"` | `"de"` | `"Latn"` | `"DE"` |
|
||||
| **zh** | `"zh"` | `"zh-Hans-CN"` | `"zh"` | `"Hans"` | `"CN"` |
|
||||
| **zh-TW** | `"zh-TW"` | `"zh-Hant-TW"` | `"zh"` | `"Hant"` | `"TW"` |
|
||||
| **ar** | `"ar"` | `"ar-Arab-EG"` | `"ar"` | `"Arab"` | `"EG"` |
|
||||
| **pt** | `"pt"` | `"pt-Latn-BR"` | `"pt"` | `"Latn"` | `"BR"` |
|
||||
| **pt-BR** | `"pt"` | `"pt-Latn-BR"` | `"pt"` | `"Latn"` | `"BR"` |
|
||||
| **pt-PT** | `"pt-PT"` | `"pt-Latn-PT"` | `"pt"` | `"Latn"` | `"PT"` |
|
||||
| **es** | `"es"` | `"es-Latn-ES"` | `"es"` | `"Latn"` | `"ES"` |
|
||||
| **es-AR** | `"es-AR"` | `"es-Latn-AR"` | `"es"` | `"Latn"` | `"AR"` |
|
||||
|
||||
### Get item given its path
|
||||
|
||||
```javascript
|
||||
// Equivalent to:
|
||||
// .get( "main/{bundle}/numbers/symbols-numberSystem-latn/decimal" );
|
||||
en.main( "numbers/symbols-numberSystem-latn/decimal" );
|
||||
// > "."
|
||||
|
||||
// Equivalent to:
|
||||
// .get( "main/{bundle}/numbers/symbols-numberSystem-latn/decimal" );
|
||||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" );
|
||||
// > ","
|
||||
```
|
||||
|
||||
Have any [locale attributes](#cldrattributes) replaced with their corresponding values by embracing it with `{}`. In the example below, `{language}` is replaced with `"en"` and `{territory}` with `"US"`.
|
||||
|
||||
```javascript
|
||||
// Notice the more complete way to get this data is:
|
||||
// cldr.get( "supplemental/gender/personList/{language}" ) ||
|
||||
// cldr.get( "supplemental/gender/personList/001" );
|
||||
var enGender = en.get( "supplemental/gender/personList/{language}" );
|
||||
// > "neutral"
|
||||
|
||||
var USCurrencies = en.get( "supplemental/currencyData/region/{territory}" );
|
||||
// > [
|
||||
// { USD: { _from: "1792-01-01" } },
|
||||
// { USN: { _tender: "false" } },
|
||||
// { USS: { _tender: "false" } }
|
||||
// ]
|
||||
|
||||
// Notice the more complete way to get this data is:
|
||||
// cldr.get( "supplemental/measurementData/measurementSystem/{territory}" ) ||
|
||||
// cldr.get( "supplemental/measurementData/measurementSystem/001" );
|
||||
var enMeasurementSystem = en.get( "supplemental/measurementData/measurementSystem/{territory}" );
|
||||
// > "US"
|
||||
```
|
||||
|
||||
Get `undefined` for non-existent data.
|
||||
|
||||
```javascript
|
||||
en.get( "/crazy/invalid/path" );
|
||||
// ➡ undefined
|
||||
|
||||
// Avoid this
|
||||
enData && enData.crazy && enData.crazy.invalid && enData.crazy.invalid.path;
|
||||
```
|
||||
|
||||
### Resolve CLDR inheritances
|
||||
|
||||
If you are using unresolved JSON data, you can resolve them dynamically during runtime by loading the `cldr/unresolved.js` extension module. Currently, we support bundle inheritance.
|
||||
|
||||
```javascript
|
||||
Cldr.load(
|
||||
unresolvedEnData
|
||||
unresolvedEnGbData,
|
||||
unresolvedEnInData,
|
||||
parentLocalesData, // supplemental
|
||||
likelySubtagsData // supplemental
|
||||
);
|
||||
|
||||
var enIn = new Cldr( "en-IN" );
|
||||
|
||||
// 1st time retrieved by resolving: en-IN ➡ en-GB (parent locale lookup).
|
||||
// Further times retrieved straight from the resolved cache.
|
||||
enIn.main( "dates/calendars/gregorian/dateTimeFormats/availableFormats/yMd" );
|
||||
// > "dd/MM/y"
|
||||
|
||||
// 1st time retrieved by resolving: en-IN ➡ en-GB (parent locale lookup) ➡ en (truncate lookup)
|
||||
// Further times retrieved straight from the resolved cache.
|
||||
enIn.main( "numbers/symbols-numberSystem-latn/decimal" );
|
||||
// > "."
|
||||
```
|
||||
|
||||
### Helpers
|
||||
|
||||
We offer some convenient helpers.
|
||||
|
||||
```javascript
|
||||
var usFirstDay = en.supplemental.weekData.firstDay();
|
||||
// ➡ sun
|
||||
// Equivalent to:
|
||||
// en.get( "supplemental/weekData/firstDay/{territory}" ) ||
|
||||
// en.get( "supplemental/weekData/firstDay/001" );
|
||||
|
||||
var brFirstDay = ptBr.supplemental.weekData.firstDay();
|
||||
// ➡ mon
|
||||
// Equivalent to:
|
||||
// ptBr.get( "supplemental/weekData/firstDay/{territory}" ) ||
|
||||
// ptBr.get( "supplemental/weekData/firstDay/001" );
|
||||
```
|
||||
|
||||
### Browser support
|
||||
|
||||
We officially support:
|
||||
- Firefox (latest - 2)+
|
||||
- Chrome (latest - 2)+
|
||||
- Safari 5.1+
|
||||
- IE 8+
|
||||
- Opera (latest - 2)+
|
||||
|
||||
Sniff tests show cldr.js also works on the following browsers:
|
||||
- Firefox 4+
|
||||
- Safari 5+
|
||||
- Chrome 14+
|
||||
- IE 6+
|
||||
- Opera 11.1+
|
||||
|
||||
If you find any bugs, please just let us know. We'll be glad to fix them for the officially supported browsers, or at least update the documentation for the unsupported ones.
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Usage and installation
|
||||
|
||||
cldr.js has no external dependencies. You can include it in the script tag of your page and you're ready to go. [Download it by clicking here](https://github.com/rxaviers/cldr/releases).
|
||||
|
||||
```html
|
||||
<script src="cldr.js"></script>
|
||||
```
|
||||
|
||||
|
||||
```javascript
|
||||
// Load the appropriate portion of CLDR JSON data.
|
||||
// See "How to get CLDR JSON data?" below for more information on how to get that data.
|
||||
Cldr.load( cldrJsonData );
|
||||
|
||||
// Instantiate it by passing a locale.
|
||||
var ptBr = new Cldr( "pt-BR" );
|
||||
|
||||
// Get CLDR item data given its path.
|
||||
// Equivalent to:
|
||||
// .get( "main/{bundle}/numbers/symbols-numberSystem-latn/decimal" );
|
||||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" );
|
||||
// > ","
|
||||
```
|
||||
|
||||
We are UMD wrapped. So, it supports AMD, CommonJS, or global variables (in case neither AMD nor CommonJS have been detected).
|
||||
|
||||
Example of usage on AMD:
|
||||
|
||||
```bash
|
||||
bower install cldrjs
|
||||
```
|
||||
|
||||
```javascript
|
||||
require.config({
|
||||
paths: {
|
||||
"cldr": "bower_components/cldrjs/dist/cldr"
|
||||
}
|
||||
});
|
||||
|
||||
require( [ "cldr", "cldr/supplemental", "cldr/unresolved" ], function( Cldr ) {
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
Example of usage with Node.js:
|
||||
|
||||
```bash
|
||||
npm install cldrjs
|
||||
```
|
||||
|
||||
```javascript
|
||||
var Cldr = require( "cldrjs" );
|
||||
```
|
||||
|
||||
### How to get CLDR JSON data?
|
||||
|
||||
*By downloading the JSON packages individually...*
|
||||
|
||||
Unicode CLDR is available as JSON at https://github.com/unicode-cldr/ (after this [json-packaging proposal][] took place). Please, read https://github.com/unicode-cldr/cldr-json for more information about package organization.
|
||||
|
||||
[json-packaging proposal]: http://cldr.unicode.org/development/development-process/design-proposals/json-packaging
|
||||
|
||||
*By using a package manager...*
|
||||
|
||||
`cldr-data` can be used for convenience. It always downloads from the correct source.
|
||||
|
||||
Use bower `bower install cldr-data` ([detailed instructions][]) or npm `npm install cldr-data`. For more information, see:
|
||||
|
||||
- https://github.com/rxaviers/cldr-data-npm
|
||||
- https://github.com/rxaviers/cldr-data-bower
|
||||
|
||||
[detailed instructions]: https://github.com/rxaviers/cldr-data-bower
|
||||
|
||||
*By generating the JSON mappings yourself...*
|
||||
|
||||
You can generate the JSON representation of the languages not available in the ZIP file by using the official conversion tool ([`tools.zip`](http://www.unicode.org/Public/cldr/latest/)). This ZIP contains a README with instructions on how to build the data.
|
||||
|
||||
You can choose to generate unresolved data to save space or bandwidth (`-r false` option of the conversion tool) and instead have it resolve at runtime.
|
||||
|
||||
### How do I load CLDR data into Cldrjs?
|
||||
|
||||
The short answer is by using `Cldr.load()` and passing the JSON data as the first argument. Below, follow several examples on how this could be accomplished.
|
||||
|
||||
For the examples below, first fetch CLDR JSON data:
|
||||
|
||||
```bash
|
||||
wget http://www.unicode.org/Public/cldr/latest/json.zip
|
||||
unzip json.zip -d cldr
|
||||
```
|
||||
|
||||
Example of embedding CLDR JSON data:
|
||||
|
||||
```html
|
||||
<script>
|
||||
// Embedded (hard-coded) CLDR JSON data.
|
||||
Cldr.load({
|
||||
supplemental: {
|
||||
likelySubtags: {
|
||||
...
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Example of loading it dynamically:
|
||||
|
||||
```html
|
||||
<script src="jquery.js"></script>
|
||||
<script>
|
||||
$.get( "cldr/supplemental/likelySubtags.json", Cldr.load );
|
||||
</script>
|
||||
```
|
||||
|
||||
Example using AMD (also see our [functional tests](test/functional.js)):
|
||||
```javascript
|
||||
define([
|
||||
"cldr",
|
||||
"json!cldr/supplemental/likelySubtags.json"
|
||||
], function( Cldr, likelySubtags ) {
|
||||
|
||||
Cldr.load( likelySubtags );
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
Example using Node.js:
|
||||
|
||||
```javascript
|
||||
var Cldr = require( "cldrjs" );
|
||||
Cldr.load( require( "./cldr/supplemental/likelySubtags.json" ) );
|
||||
```
|
||||
|
||||
#### Attention: library owners, do not embed data
|
||||
|
||||
It's NOT recommended that libraries embed data into their code logic for several reasons: avoid forcing a certain data version on users, avoid maintaining locale changes, avoid duplicating data among different i18n libraries.
|
||||
|
||||
We recommend loading CLDR data must be performed by end user code.
|
||||
|
||||
#### Which CLDR portion to load?
|
||||
|
||||
It depends on the used modules.
|
||||
|
||||
| File | Required CLDR JSON data |
|
||||
|---|---|
|
||||
| cldr.js | `cldr/supplemental/likelySubtags.json` |
|
||||
| cldr/unresolved.js | `cldr/supplemental/parentLocales.json` |
|
||||
| cldr/supplemental.js | `cldr/supplemental/{timeData, weekData}.json` |
|
||||
|
||||
You must also load any portion of the CLDR data you plan to use in your library or your end-application.
|
||||
|
||||
## API
|
||||
|
||||
### Core
|
||||
|
||||
- **`Cldr.load( json, ... )`**
|
||||
|
||||
Load resolved or unresolved [1] JSON data.
|
||||
|
||||
[Read more...](doc/api/core/load.md)
|
||||
|
||||
1: Unresolved processing is **only available** after loading `cldr/unresolved.js` extension module.
|
||||
|
||||
- **`new Cldr( locale )`**
|
||||
|
||||
Create a new instance of Cldr.
|
||||
|
||||
[Read more...](doc/api/core/constructor.md)
|
||||
|
||||
- **`.attributes`**
|
||||
|
||||
Attributes is an Object created during instance initialization (construction) and are used internally by `.get()` to replace dynamic parts of an item path.
|
||||
|
||||
[Read more...](doc/api/core/attributes.md)
|
||||
|
||||
- **`.get( path )`**
|
||||
|
||||
Get the item data given its path, or `undefined` if missing.
|
||||
|
||||
[Read more...](doc/api/core/get.md)
|
||||
|
||||
- **`.main( path )`**
|
||||
|
||||
It's an alias for `.get([ "main/{bundle}", ... ])`.
|
||||
|
||||
[Read more...](doc/api/core/main.md)
|
||||
|
||||
### cldr/event.js
|
||||
|
||||
- **`Cldr.on( event, listener )`**
|
||||
|
||||
Add a listener function to the specified event globally (for all instances).
|
||||
|
||||
[Read more...](doc/api/event/global_on.md)
|
||||
|
||||
- **`Cldr.once( event, listener )`**
|
||||
|
||||
Add a listener function to the specified event globally (for all instances). It will be automatically removed after it's first execution.
|
||||
|
||||
[Read more...](doc/api/event/global_once.md)
|
||||
|
||||
- **`Cldr.off( event, listener )`**
|
||||
|
||||
Remove a listener function from the specified event globally (for all instances).
|
||||
|
||||
[Read more...](doc/api/event/global_off.md)
|
||||
|
||||
- **`.on( event, listener )`**
|
||||
|
||||
Add a listener function to the specified event for this instance.
|
||||
|
||||
[Read more...](doc/api/event/on.md)
|
||||
|
||||
- **`.once( event, listener )`**
|
||||
|
||||
Add a listener function to the specified event for this instance. It will be automatically removed after it's first execution.
|
||||
|
||||
[Read more...](doc/api/event/once.md)
|
||||
|
||||
- **`.off( event, listener )`**
|
||||
|
||||
Remove a listener function from the specified event for this instance.
|
||||
|
||||
[Read more...](doc/api/event/off.md)
|
||||
|
||||
#### Events
|
||||
|
||||
- `get` ➡ `( path, value )`
|
||||
|
||||
Triggered before a `.get()` (or any alias) return. The triggered listener receives the normalized *path* and the *value* found.
|
||||
|
||||
[Read more...](doc/api/event/event_get.md)
|
||||
|
||||
### cldr/supplemental.js
|
||||
|
||||
- **`.supplemental( path )`**
|
||||
|
||||
It's an alias for `.get([ "supplemental", ... ])`.
|
||||
|
||||
[Read more...](doc/api/supplemental.md)
|
||||
|
||||
- **`.supplemental.timeData.allowed()`**
|
||||
|
||||
Helper function. Return the supplemental timeData allowed of locale's territory.
|
||||
|
||||
[Read more...](doc/api/supplemental/time_data_allowed.md)
|
||||
|
||||
- **`.supplemental.timeData.preferred()`**
|
||||
|
||||
Helper function. Return the supplemental timeData preferred of locale's territory.
|
||||
|
||||
[Read more...](doc/api/supplemental/time_data_preferred.md)
|
||||
|
||||
- **`.supplemental.weekData.firstDay()`**
|
||||
|
||||
Helper function. Return the supplemental weekData firstDay of locale's territory.
|
||||
|
||||
[Read more...](doc/api/supplemental/week_data_first_day.md)
|
||||
|
||||
- **`.supplemental.weekData.minDays()`**
|
||||
|
||||
Helper function. Return the supplemental weekData minDays of locale's territory as a Number.
|
||||
|
||||
[Read more...](doc/api/supplemental/week_data_min_days.md)
|
||||
|
||||
### cldr/unresolved.js
|
||||
|
||||
- **`.get( path )`**
|
||||
|
||||
Overload (extend) `.get()` to get the item data or lookup by following [locale inheritance](http://www.unicode.org/reports/tr35/#Locale_Inheritance), set a local resolved cache if it's found (for subsequent faster access), or return `undefined`.
|
||||
|
||||
[Read more...](doc/api/unresolved/get.md)
|
||||
|
||||
## Error reference
|
||||
|
||||
### CLDR Errors
|
||||
|
||||
#### `E_MISSING_BUNDLE`
|
||||
|
||||
Thrown when none of the loaded CLDR data can be used as a bundle for the corresponding locale. See more information on [Bundle Lookup Matcher][].
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_MISSING_BUNDLE` |
|
||||
| locale | Locale whose bundle could not be found |
|
||||
|
||||
### Parameter Errors
|
||||
|
||||
#### `E_MISSING_PARAMETER`
|
||||
|
||||
Thrown when a required parameter is missing on any static or instance methods.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_MISSING_PARAMETER` |
|
||||
| name | Name of the missing parameter |
|
||||
|
||||
#### `E_INVALID_PAR_TYPE`
|
||||
|
||||
Thrown when a parameter has an invalid type on any static or instance methods.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_INVALID_PAR_TYPE` |
|
||||
| name | Name of the invalid parameter |
|
||||
| value | Invalid value |
|
||||
| expected | Expected type |
|
||||
|
||||
|
||||
### Development / Contributing
|
||||
|
||||
Install grunt and tests external dependencies. First, install the [grunt-cli](http://gruntjs.com/getting-started#installing-the-cli) and [bower](http://bower.io/) packages if you haven't before. These should be done as global installs. Then:
|
||||
|
||||
```bash
|
||||
npm install && bower install
|
||||
```
|
||||
Run tests
|
||||
```bash
|
||||
grunt test
|
||||
```
|
||||
Build distribution file.
|
||||
```bash
|
||||
grunt
|
||||
```
|
||||
|
||||
#### Release
|
||||
|
||||
On MacOS, use gnu-sed (`brew install gnu-sed`)
|
||||
|
||||
```bash
|
||||
./chore/release <version> # where version is for example 0.5.2
|
||||
```
|
||||
|
||||
[Bundle Lookup Matcher]: ./doc/bundle_lookup_matcher.md
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Rafael Xavier de Souza](http://rafael.xavier.blog.br)
|
||||
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/.dist_jshintrc
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/.dist_jshintrc
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"onevar": false,
|
||||
"quotmark": "double",
|
||||
"smarttabs": true,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"predef": [ "Cldr", "define", "module", "require" ]
|
||||
}
|
||||
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/.jshintrc
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/.jshintrc
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"onevar": false,
|
||||
"quotmark": "double",
|
||||
"smarttabs": true,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"predef": [ "define" ]
|
||||
}
|
||||
45
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build.txt
vendored
Normal file
45
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build.txt
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
cldr.js
|
||||
----------------
|
||||
util/array/is_array.js
|
||||
path/normalize.js
|
||||
util/array/some.js
|
||||
core/likely_subtags.js
|
||||
core/remove_likely_subtags.js
|
||||
core/subtags.js
|
||||
util/array/for_each.js
|
||||
bundle/lookup.js
|
||||
util/object/keys.js
|
||||
common/create_error.js
|
||||
common/validate.js
|
||||
common/validate/presence.js
|
||||
common/validate/type.js
|
||||
common/validate/type/path.js
|
||||
util/is_plain_object.js
|
||||
common/validate/type/plain_object.js
|
||||
common/validate/type/string.js
|
||||
resource/get.js
|
||||
core/set_available_bundles.js
|
||||
util/always_array.js
|
||||
util/json/merge.js
|
||||
core/load.js
|
||||
item/get_resolved.js
|
||||
core.js
|
||||
|
||||
cldr_event.js
|
||||
----------------
|
||||
/Users/rxaviers/globalizejs/cldrjs/bower_components/eventEmitter/EventEmitter.js
|
||||
common/validate/type/function.js
|
||||
event.js
|
||||
|
||||
cldr_supplemental.js
|
||||
----------------
|
||||
supplemental/main.js
|
||||
supplemental.js
|
||||
|
||||
cldr_unresolved.js
|
||||
----------------
|
||||
bundle/parent_lookup.js
|
||||
resource/set.js
|
||||
item/lookup.js
|
||||
unresolved.js
|
||||
4
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro.min.js
vendored
Normal file
4
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro.min.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
27
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_core.js
vendored
Normal file
27
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_core.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
|
||||
// Node. CommonJS.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Global
|
||||
root.Cldr = factory();
|
||||
}
|
||||
|
||||
}( this, function() {
|
||||
33
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_event.js
vendored
Normal file
33
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_event.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var pathNormalize = Cldr._pathNormalize,
|
||||
validatePresence = Cldr._validatePresence,
|
||||
validateType = Cldr._validateType;
|
||||
|
||||
31
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_supplemental.js
vendored
Normal file
31
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_supplemental.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var alwaysArray = Cldr._alwaysArray;
|
||||
|
||||
36
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_unresolved.js
vendored
Normal file
36
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/intro_unresolved.js
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var coreLoad = Cldr._coreLoad;
|
||||
var jsonMerge = Cldr._jsonMerge;
|
||||
var pathNormalize = Cldr._pathNormalize;
|
||||
var resourceGet = Cldr._resourceGet;
|
||||
var validatePresence = Cldr._validatePresence;
|
||||
var validateTypePath = Cldr._validateTypePath;
|
||||
|
||||
22
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/node_main.js
vendored
Normal file
22
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/node_main.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
|
||||
// Cldr
|
||||
module.exports = require( "./cldr" );
|
||||
|
||||
// Extent Cldr with the following modules
|
||||
require( "./cldr/event" );
|
||||
require( "./cldr/supplemental" );
|
||||
require( "./cldr/unresolved" );
|
||||
1
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/outro.js
vendored
Normal file
1
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/build/outro.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
}));
|
||||
38
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/bundle/lookup.js
vendored
Normal file
38
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/bundle/lookup.js
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
/**
|
||||
* bundleLookup( minLanguageId )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @cldr [Cldr instance]
|
||||
*
|
||||
* @minLanguageId [String] requested languageId after applied remove likely subtags.
|
||||
*/
|
||||
var bundleLookup = function( Cldr, cldr, minLanguageId ) {
|
||||
var availableBundleMap = Cldr._availableBundleMap,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue;
|
||||
|
||||
if ( availableBundleMapQueue.length ) {
|
||||
arrayForEach( availableBundleMapQueue, function( bundle, i ) {
|
||||
var existing, maxBundle, minBundle, subtags;
|
||||
subtags = coreSubtags( bundle );
|
||||
maxBundle = coreLikelySubtags( Cldr, cldr, subtags );
|
||||
if ( maxBundle === undefined ) {
|
||||
availableBundleMapQueue.splice( i, 1 );
|
||||
throw new Error( "Could not find likelySubtags for " + bundle );
|
||||
}
|
||||
minBundle = coreRemoveLikelySubtags( Cldr, cldr, maxBundle );
|
||||
minBundle = minBundle.join( Cldr.localeSep );
|
||||
existing = availableBundleMap[ minBundle ];
|
||||
if ( existing && existing.length < bundle.length ) {
|
||||
return;
|
||||
}
|
||||
availableBundleMap[ minBundle ] = bundle;
|
||||
});
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
}
|
||||
|
||||
return availableBundleMap[ minLanguageId ] || null;
|
||||
};
|
||||
|
||||
76
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/bundle/lookup.js.orig
vendored
Normal file
76
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/bundle/lookup.js.orig
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<<<<<<< HEAD
|
||||
define([
|
||||
"../core/likely_subtags",
|
||||
"../core/remove_likely_subtags",
|
||||
"../core/subtags",
|
||||
], function( coreLikelySubtags, coreRemoveLikelySubtags, coreSubtags ) {
|
||||
=======
|
||||
import coreLikelySubtags from "../core/likely_subtags";
|
||||
import coreRemoveLikelySubtags from "../core/remove_likely_subtags";
|
||||
import coreSubtags from "../core/subtags";
|
||||
import arrayForEach from "../util/array/for_each";
|
||||
>>>>>>> a11141a... Bundle: Enhcance bundleMapQueue logic (amend)
|
||||
|
||||
/**
|
||||
* bundleLookup( minLanguageId )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @cldr [Cldr instance]
|
||||
*
|
||||
* @minLanguageId [String] requested languageId after applied remove likely subtags.
|
||||
*/
|
||||
return function( Cldr, cldr, minLanguageId ) {
|
||||
var availableBundleMap = Cldr._availableBundleMap,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (availableBundleMapQueue.length) {
|
||||
while (availableBundleMapQueue.length > 0) {
|
||||
const bundle = availableBundleMapQueue.shift();
|
||||
if (!bundle) {
|
||||
break;
|
||||
}
|
||||
|
||||
var existing, maxBundle, minBundle, subtags;
|
||||
subtags = coreSubtags(bundle);
|
||||
maxBundle = coreLikelySubtags(Cldr, cldr, subtags);
|
||||
if (typeof maxBundle === "undefined") {
|
||||
throw new Error(`Could not find likelySubtags for ${bundle}`);
|
||||
}
|
||||
|
||||
minBundle = coreRemoveLikelySubtags(Cldr, cldr, maxBundle);
|
||||
minBundle = minBundle.join(Cldr.localeSep);
|
||||
existing = availableBundleMap[minBundle];
|
||||
if (existing && existing.length < bundle.length) {
|
||||
return;
|
||||
}
|
||||
availableBundleMap[minBundle] = bundle;
|
||||
}
|
||||
}
|
||||
=======
|
||||
if (availableBundleMapQueue.length) {
|
||||
arrayForEach(availableBundleMapQueue, function(bundle, i) {
|
||||
var existing, maxBundle, minBundle, subtags;
|
||||
subtags = coreSubtags(bundle);
|
||||
maxBundle = coreLikelySubtags(Cldr, cldr, subtags);
|
||||
if (maxBundle === undefined) {
|
||||
availableBundleMapQueue.splice(i, 1);
|
||||
throw new Error(`Could not find likelySubtags for ${bundle}`);
|
||||
}
|
||||
minBundle = coreRemoveLikelySubtags(Cldr, cldr, maxBundle);
|
||||
minBundle = minBundle.join(Cldr.localeSep);
|
||||
existing = availableBundleMap[minBundle];
|
||||
if (existing && existing.length < bundle.length) {
|
||||
return;
|
||||
}
|
||||
availableBundleMap[minBundle] = bundle;
|
||||
});
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
}
|
||||
>>>>>>> a11141a... Bundle: Enhcance bundleMapQueue logic (amend)
|
||||
|
||||
return availableBundleMap[ minLanguageId ] || null;
|
||||
};
|
||||
|
||||
});
|
||||
25
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/bundle/parent_lookup.js
vendored
Normal file
25
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/bundle/parent_lookup.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
var bundleParentLookup = function( Cldr, locale ) {
|
||||
var normalizedPath, parent;
|
||||
|
||||
if ( locale === "root" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First, try to find parent on supplemental data.
|
||||
normalizedPath = pathNormalize( [ "supplemental/parentLocales/parentLocale", locale ] );
|
||||
parent = resourceGet( Cldr._resolved, normalizedPath ) || resourceGet( Cldr._raw, normalizedPath );
|
||||
if ( parent ) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
// Or truncate locale.
|
||||
parent = locale.substr( 0, locale.lastIndexOf( Cldr.localeSep ) );
|
||||
if ( !parent ) {
|
||||
return "root";
|
||||
}
|
||||
|
||||
return parent;
|
||||
};
|
||||
|
||||
686
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr.js
vendored
Normal file
686
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr.js
vendored
Normal file
@@ -0,0 +1,686 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Global
|
||||
root.Cldr = factory();
|
||||
}
|
||||
|
||||
}( this, function() {
|
||||
|
||||
|
||||
var arrayIsArray = Array.isArray || function( obj ) {
|
||||
return Object.prototype.toString.call( obj ) === "[object Array]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var pathNormalize = function( path, attributes ) {
|
||||
if ( arrayIsArray( path ) ) {
|
||||
path = path.join( "/" );
|
||||
}
|
||||
if ( typeof path !== "string" ) {
|
||||
throw new Error( "invalid path \"" + path + "\"" );
|
||||
}
|
||||
// 1: Ignore leading slash `/`
|
||||
// 2: Ignore leading `cldr/`
|
||||
path = path
|
||||
.replace( /^\// , "" ) /* 1 */
|
||||
.replace( /^cldr\// , "" ); /* 2 */
|
||||
|
||||
// Replace {attribute}'s
|
||||
path = path.replace( /{[a-zA-Z]+}/g, function( name ) {
|
||||
name = name.replace( /^{([^}]*)}$/, "$1" );
|
||||
return attributes[ name ];
|
||||
});
|
||||
|
||||
return path.split( "/" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var arraySome = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.some ) {
|
||||
return array.some( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
if ( callback( array[ i ], i, array ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the maximized language id as defined in
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. Canonicalize.
|
||||
* 1.1 Make sure the input locale is in canonical form: uses the right
|
||||
* separator, and has the right casing.
|
||||
* TODO Right casing? What df? It seems languages are lowercase, scripts are
|
||||
* Capitalized, territory is uppercase. I am leaving this as an exercise to
|
||||
* the user.
|
||||
*
|
||||
* 1.2 Replace any deprecated subtags with their canonical values using the
|
||||
* <alias> data in supplemental metadata. Use the first value in the
|
||||
* replacement list, if it exists. Language tag replacements may have multiple
|
||||
* parts, such as "sh" ➞ "sr_Latn" or mo" ➞ "ro_MD". In such a case, the
|
||||
* original script and/or region are retained if there is one. Thus
|
||||
* "sh_Arab_AQ" ➞ "sr_Arab_AQ", not "sr_Latn_AQ".
|
||||
* TODO What <alias> data?
|
||||
*
|
||||
* 1.3 If the tag is grandfathered (see <variable id="$grandfathered"
|
||||
* type="choice"> in the supplemental data), then return it.
|
||||
* TODO grandfathered?
|
||||
*
|
||||
* 1.4 Remove the script code 'Zzzz' and the region code 'ZZ' if they occur.
|
||||
* 1.5 Get the components of the cleaned-up source tag (languages, scripts,
|
||||
* and regions), plus any variants and extensions.
|
||||
* 2. Lookup. Lookup each of the following in order, and stop on the first
|
||||
* match:
|
||||
* 2.1 languages_scripts_regions
|
||||
* 2.2 languages_regions
|
||||
* 2.3 languages_scripts
|
||||
* 2.4 languages
|
||||
* 2.5 und_scripts
|
||||
* 3. Return
|
||||
* 3.1 If there is no match, either return an error value, or the match for
|
||||
* "und" (in APIs where a valid language tag is required).
|
||||
* 3.2 Otherwise there is a match = languagem_scriptm_regionm
|
||||
* 3.3 Let xr = xs if xs is not empty, and xm otherwise.
|
||||
* 3.4 Return the language tag composed of languager _ scriptr _ regionr +
|
||||
* variants + extensions.
|
||||
*
|
||||
* @subtags [Array] normalized language id subtags tuple (see init.js).
|
||||
*/
|
||||
var coreLikelySubtags = function( Cldr, cldr, subtags, options ) {
|
||||
var match, matchFound,
|
||||
language = subtags[ 0 ],
|
||||
script = subtags[ 1 ],
|
||||
sep = Cldr.localeSep,
|
||||
territory = subtags[ 2 ],
|
||||
variants = subtags.slice( 3, 4 );
|
||||
options = options || {};
|
||||
|
||||
// Skip if (language, script, territory) is not empty [3.3]
|
||||
if ( language !== "und" && script !== "Zzzz" && territory !== "ZZ" ) {
|
||||
return [ language, script, territory ].concat( variants );
|
||||
}
|
||||
|
||||
// Skip if no supplemental likelySubtags data is present
|
||||
if ( typeof cldr.get( "supplemental/likelySubtags" ) === "undefined" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// [2]
|
||||
matchFound = arraySome([
|
||||
[ language, script, territory ],
|
||||
[ language, territory ],
|
||||
[ language, script ],
|
||||
[ language ],
|
||||
[ "und", script ]
|
||||
], function( test ) {
|
||||
return match = !(/\b(Zzzz|ZZ)\b/).test( test.join( sep ) ) /* [1.4] */ && cldr.get( [ "supplemental/likelySubtags", test.join( sep ) ] );
|
||||
});
|
||||
|
||||
// [3]
|
||||
if ( matchFound ) {
|
||||
// [3.2 .. 3.4]
|
||||
match = match.split( sep );
|
||||
return [
|
||||
language !== "und" ? language : match[ 0 ],
|
||||
script !== "Zzzz" ? script : match[ 1 ],
|
||||
territory !== "ZZ" ? territory : match[ 2 ]
|
||||
].concat( variants );
|
||||
} else if ( options.force ) {
|
||||
// [3.1.2]
|
||||
return cldr.get( "supplemental/likelySubtags/und" ).split( sep );
|
||||
} else {
|
||||
// [3.1.1]
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a locale, remove any fields that Add Likely Subtags would add.
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. First get max = AddLikelySubtags(inputLocale). If an error is signaled,
|
||||
* return it.
|
||||
* 2. Remove the variants from max.
|
||||
* 3. Then for trial in {language, language _ region, language _ script}. If
|
||||
* AddLikelySubtags(trial) = max, then return trial + variants.
|
||||
* 4. If you do not get a match, return max + variants.
|
||||
*
|
||||
* @maxLanguageId [Array] maxLanguageId tuple (see init.js).
|
||||
*/
|
||||
var coreRemoveLikelySubtags = function( Cldr, cldr, maxLanguageId ) {
|
||||
var match, matchFound,
|
||||
language = maxLanguageId[ 0 ],
|
||||
script = maxLanguageId[ 1 ],
|
||||
territory = maxLanguageId[ 2 ],
|
||||
variants = maxLanguageId[ 3 ];
|
||||
|
||||
// [3]
|
||||
matchFound = arraySome([
|
||||
[ [ language, "Zzzz", "ZZ" ], [ language ] ],
|
||||
[ [ language, "Zzzz", territory ], [ language, territory ] ],
|
||||
[ [ language, script, "ZZ" ], [ language, script ] ]
|
||||
], function( test ) {
|
||||
var result = coreLikelySubtags( Cldr, cldr, test[ 0 ] );
|
||||
match = test[ 1 ];
|
||||
return result && result[ 0 ] === maxLanguageId[ 0 ] &&
|
||||
result[ 1 ] === maxLanguageId[ 1 ] &&
|
||||
result[ 2 ] === maxLanguageId[ 2 ];
|
||||
});
|
||||
|
||||
if ( matchFound ) {
|
||||
if ( variants ) {
|
||||
match.push( variants );
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
// [4]
|
||||
return maxLanguageId;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* subtags( locale )
|
||||
*
|
||||
* @locale [String]
|
||||
*/
|
||||
var coreSubtags = function( locale ) {
|
||||
var aux, unicodeLanguageId,
|
||||
subtags = [];
|
||||
|
||||
locale = locale.replace( /_/, "-" );
|
||||
|
||||
// Unicode locale extensions.
|
||||
aux = locale.split( "-u-" );
|
||||
if ( aux[ 1 ] ) {
|
||||
aux[ 1 ] = aux[ 1 ].split( "-t-" );
|
||||
locale = aux[ 0 ] + ( aux[ 1 ][ 1 ] ? "-t-" + aux[ 1 ][ 1 ] : "");
|
||||
subtags[ 4 /* unicodeLocaleExtensions */ ] = aux[ 1 ][ 0 ];
|
||||
}
|
||||
|
||||
// TODO normalize transformed extensions. Currently, skipped.
|
||||
// subtags[ x ] = locale.split( "-t-" )[ 1 ];
|
||||
unicodeLanguageId = locale.split( "-t-" )[ 0 ];
|
||||
|
||||
// unicode_language_id = "root"
|
||||
// | unicode_language_subtag
|
||||
// (sep unicode_script_subtag)?
|
||||
// (sep unicode_region_subtag)?
|
||||
// (sep unicode_variant_subtag)* ;
|
||||
//
|
||||
// Although unicode_language_subtag = alpha{2,8}, I'm using alpha{2,3}. Because, there's no language on CLDR lengthier than 3.
|
||||
aux = unicodeLanguageId.match( /^(([a-z]{2,3})(-([A-Z][a-z]{3}))?(-([A-Z]{2}|[0-9]{3}))?)((-([a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3}))*)$|^(root)$/ );
|
||||
if ( aux === null ) {
|
||||
return [ "und", "Zzzz", "ZZ" ];
|
||||
}
|
||||
subtags[ 0 /* language */ ] = aux[ 10 ] /* root */ || aux[ 2 ] || "und";
|
||||
subtags[ 1 /* script */ ] = aux[ 4 ] || "Zzzz";
|
||||
subtags[ 2 /* territory */ ] = aux[ 6 ] || "ZZ";
|
||||
if ( aux[ 7 ] && aux[ 7 ].length ) {
|
||||
subtags[ 3 /* variant */ ] = aux[ 7 ].slice( 1 ) /* remove leading "-" */;
|
||||
}
|
||||
|
||||
// 0: language
|
||||
// 1: script
|
||||
// 2: territory (aka region)
|
||||
// 3: variant
|
||||
// 4: unicodeLocaleExtensions
|
||||
return subtags;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var arrayForEach = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.forEach ) {
|
||||
return array.forEach( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
callback( array[ i ], i, array );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* bundleLookup( minLanguageId )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @cldr [Cldr instance]
|
||||
*
|
||||
* @minLanguageId [String] requested languageId after applied remove likely subtags.
|
||||
*/
|
||||
var bundleLookup = function( Cldr, cldr, minLanguageId ) {
|
||||
var availableBundleMap = Cldr._availableBundleMap,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue;
|
||||
|
||||
if ( availableBundleMapQueue.length ) {
|
||||
arrayForEach( availableBundleMapQueue, function( bundle, i ) {
|
||||
var existing, maxBundle, minBundle, subtags;
|
||||
subtags = coreSubtags( bundle );
|
||||
maxBundle = coreLikelySubtags( Cldr, cldr, subtags );
|
||||
if ( maxBundle === undefined ) {
|
||||
availableBundleMapQueue.splice( i, 1 );
|
||||
throw new Error( "Could not find likelySubtags for " + bundle );
|
||||
}
|
||||
minBundle = coreRemoveLikelySubtags( Cldr, cldr, maxBundle );
|
||||
minBundle = minBundle.join( Cldr.localeSep );
|
||||
existing = availableBundleMap[ minBundle ];
|
||||
if ( existing && existing.length < bundle.length ) {
|
||||
return;
|
||||
}
|
||||
availableBundleMap[ minBundle ] = bundle;
|
||||
});
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
}
|
||||
|
||||
return availableBundleMap[ minLanguageId ] || null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var objectKeys = function( object ) {
|
||||
var i,
|
||||
result = [];
|
||||
|
||||
if ( Object.keys ) {
|
||||
return Object.keys( object );
|
||||
}
|
||||
|
||||
for ( i in object ) {
|
||||
result.push( i );
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var createError = function( code, attributes ) {
|
||||
var error, message;
|
||||
|
||||
message = code + ( attributes && JSON ? ": " + JSON.stringify( attributes ) : "" );
|
||||
error = new Error( message );
|
||||
error.code = code;
|
||||
|
||||
// extend( error, attributes );
|
||||
arrayForEach( objectKeys( attributes ), function( attribute ) {
|
||||
error[ attribute ] = attributes[ attribute ];
|
||||
});
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validate = function( code, check, attributes ) {
|
||||
if ( !check ) {
|
||||
throw createError( code, attributes );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validatePresence = function( value, name ) {
|
||||
validate( "E_MISSING_PARAMETER", typeof value !== "undefined", {
|
||||
name: name
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateType = function( value, name, check, expected ) {
|
||||
validate( "E_INVALID_PAR_TYPE", check, {
|
||||
expected: expected,
|
||||
name: name,
|
||||
value: value
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateTypePath = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || arrayIsArray( value ), "String or Array" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function inspired by jQuery Core, but reduced to our use case.
|
||||
*/
|
||||
var isPlainObject = function( obj ) {
|
||||
return obj !== null && "" + obj === "[object Object]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateTypePlainObject = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || isPlainObject( value ), "Plain Object" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateTypeString = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string", "a string" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceGet = function( data, path ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
node = node[ path[ i ] ];
|
||||
if ( !node ) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return node[ path[ i ] ];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* setAvailableBundles( Cldr, json )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @json resolved/unresolved cldr data.
|
||||
*
|
||||
* Set available bundles queue based on passed json CLDR data. Considers a bundle as any String at /main/{bundle}.
|
||||
*/
|
||||
var coreSetAvailableBundles = function( Cldr, json ) {
|
||||
var bundle,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue,
|
||||
main = resourceGet( json, [ "main" ] );
|
||||
|
||||
if ( main ) {
|
||||
for ( bundle in main ) {
|
||||
if ( main.hasOwnProperty( bundle ) && bundle !== "root" &&
|
||||
availableBundleMapQueue.indexOf( bundle ) === -1 ) {
|
||||
availableBundleMapQueue.push( bundle );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var alwaysArray = function( somethingOrArray ) {
|
||||
return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
|
||||
};
|
||||
|
||||
|
||||
var jsonMerge = (function() {
|
||||
|
||||
// Returns new deeply merged JSON.
|
||||
//
|
||||
// Eg.
|
||||
// merge( { a: { b: 1, c: 2 } }, { a: { b: 3, d: 4 } } )
|
||||
// -> { a: { b: 3, c: 2, d: 4 } }
|
||||
//
|
||||
// @arguments JSON's
|
||||
//
|
||||
var merge = function() {
|
||||
var destination = {},
|
||||
sources = [].slice.call( arguments, 0 );
|
||||
arrayForEach( sources, function( source ) {
|
||||
var prop;
|
||||
for ( prop in source ) {
|
||||
if ( prop in destination && typeof destination[ prop ] === "object" && !arrayIsArray( destination[ prop ] ) ) {
|
||||
|
||||
// Merge Objects
|
||||
destination[ prop ] = merge( destination[ prop ], source[ prop ] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set new values
|
||||
destination[ prop ] = source[ prop ];
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return destination;
|
||||
};
|
||||
|
||||
return merge;
|
||||
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* load( Cldr, source, jsons )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @source [Object]
|
||||
*
|
||||
* @jsons [arguments]
|
||||
*/
|
||||
var coreLoad = function( Cldr, source, jsons ) {
|
||||
var i, j, json;
|
||||
|
||||
validatePresence( jsons[ 0 ], "json" );
|
||||
|
||||
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
|
||||
for ( i = 0; i < jsons.length; i++ ) {
|
||||
|
||||
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
|
||||
json = alwaysArray( jsons[ i ] );
|
||||
|
||||
for ( j = 0; j < json.length; j++ ) {
|
||||
validateTypePlainObject( json[ j ], "json" );
|
||||
source = jsonMerge( source, json[ j ] );
|
||||
coreSetAvailableBundles( Cldr, json[ j ] );
|
||||
}
|
||||
}
|
||||
|
||||
return source;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var itemGetResolved = function( Cldr, path, attributes ) {
|
||||
// Resolve path
|
||||
var normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
return resourceGet( Cldr._resolved, normalizedPath );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* new Cldr()
|
||||
*/
|
||||
var Cldr = function( locale ) {
|
||||
this.init( locale );
|
||||
};
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
Cldr._alwaysArray = alwaysArray;
|
||||
Cldr._coreLoad = coreLoad;
|
||||
Cldr._createError = createError;
|
||||
Cldr._itemGetResolved = itemGetResolved;
|
||||
Cldr._jsonMerge = jsonMerge;
|
||||
Cldr._pathNormalize = pathNormalize;
|
||||
Cldr._resourceGet = resourceGet;
|
||||
Cldr._validatePresence = validatePresence;
|
||||
Cldr._validateType = validateType;
|
||||
Cldr._validateTypePath = validateTypePath;
|
||||
Cldr._validateTypePlainObject = validateTypePlainObject;
|
||||
|
||||
Cldr._availableBundleMap = {};
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
Cldr._resolved = {};
|
||||
|
||||
// Allow user to override locale separator "-" (default) | "_". According to http://www.unicode.org/reports/tr35/#Unicode_language_identifier, both "-" and "_" are valid locale separators (eg. "en_GB", "en-GB"). According to http://unicode.org/cldr/trac/ticket/6786 its usage must be consistent throughout the data set.
|
||||
Cldr.localeSep = "-";
|
||||
|
||||
/**
|
||||
* Cldr.load( json [, json, ...] )
|
||||
*
|
||||
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||||
*
|
||||
* Load resolved cldr data.
|
||||
*/
|
||||
Cldr.load = function() {
|
||||
Cldr._resolved = coreLoad( Cldr, Cldr._resolved, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* .init() automatically run on instantiation/construction.
|
||||
*/
|
||||
Cldr.prototype.init = function( locale ) {
|
||||
var attributes, language, maxLanguageId, minLanguageId, script, subtags, territory, unicodeLocaleExtensions, variant,
|
||||
sep = Cldr.localeSep,
|
||||
unicodeLocaleExtensionsRaw = "";
|
||||
|
||||
validatePresence( locale, "locale" );
|
||||
validateTypeString( locale, "locale" );
|
||||
|
||||
subtags = coreSubtags( locale );
|
||||
|
||||
if ( subtags.length === 5 ) {
|
||||
unicodeLocaleExtensions = subtags.pop();
|
||||
unicodeLocaleExtensionsRaw = sep + "u" + sep + unicodeLocaleExtensions;
|
||||
// Remove trailing null when there is unicodeLocaleExtensions but no variants.
|
||||
if ( !subtags[ 3 ] ) {
|
||||
subtags.pop();
|
||||
}
|
||||
}
|
||||
variant = subtags[ 3 ];
|
||||
|
||||
// Normalize locale code.
|
||||
// Get (or deduce) the "triple subtags": language, territory (also aliased as region), and script subtags.
|
||||
// Get the variant subtags (calendar, collation, currency, etc).
|
||||
// refs:
|
||||
// - http://www.unicode.org/reports/tr35/#Field_Definitions
|
||||
// - http://www.unicode.org/reports/tr35/#Language_and_Locale_IDs
|
||||
// - http://www.unicode.org/reports/tr35/#Unicode_locale_identifier
|
||||
|
||||
// When a locale id does not specify a language, or territory (region), or script, they are obtained by Likely Subtags.
|
||||
maxLanguageId = coreLikelySubtags( Cldr, this, subtags, { force: true } ) || subtags;
|
||||
language = maxLanguageId[ 0 ];
|
||||
script = maxLanguageId[ 1 ];
|
||||
territory = maxLanguageId[ 2 ];
|
||||
|
||||
minLanguageId = coreRemoveLikelySubtags( Cldr, this, maxLanguageId ).join( sep );
|
||||
|
||||
// Set attributes
|
||||
this.attributes = attributes = {
|
||||
bundle: bundleLookup( Cldr, this, minLanguageId ),
|
||||
|
||||
// Unicode Language Id
|
||||
minLanguageId: minLanguageId + unicodeLocaleExtensionsRaw,
|
||||
maxLanguageId: maxLanguageId.join( sep ) + unicodeLocaleExtensionsRaw,
|
||||
|
||||
// Unicode Language Id Subtabs
|
||||
language: language,
|
||||
script: script,
|
||||
territory: territory,
|
||||
region: territory, /* alias */
|
||||
variant: variant
|
||||
};
|
||||
|
||||
// Unicode locale extensions.
|
||||
unicodeLocaleExtensions && ( "-" + unicodeLocaleExtensions ).replace( /-[a-z]{3,8}|(-[a-z]{2})-([a-z]{3,8})/g, function( attribute, key, type ) {
|
||||
|
||||
if ( key ) {
|
||||
|
||||
// Extension is in the `keyword` form.
|
||||
attributes[ "u" + key ] = type;
|
||||
} else {
|
||||
|
||||
// Extension is in the `attribute` form.
|
||||
attributes[ "u" + attribute ] = true;
|
||||
}
|
||||
});
|
||||
|
||||
this.locale = locale;
|
||||
};
|
||||
|
||||
/**
|
||||
* .get()
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
return itemGetResolved( Cldr, path, this.attributes );
|
||||
};
|
||||
|
||||
/**
|
||||
* .main()
|
||||
*/
|
||||
Cldr.prototype.main = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
validate( "E_MISSING_BUNDLE", this.attributes.bundle !== null, {
|
||||
locale: this.locale
|
||||
});
|
||||
|
||||
path = alwaysArray( path );
|
||||
return this.get( [ "main/{bundle}" ].concat( path ) );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
define("cldr", function(){});
|
||||
}));
|
||||
585
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr_event.js
vendored
Normal file
585
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr_event.js
vendored
Normal file
@@ -0,0 +1,585 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var pathNormalize = Cldr._pathNormalize,
|
||||
validatePresence = Cldr._validatePresence,
|
||||
validateType = Cldr._validateType;
|
||||
|
||||
/*!
|
||||
* EventEmitter v4.2.7 - git.io/ee
|
||||
* Oliver Caldwell
|
||||
* MIT license
|
||||
* @preserve
|
||||
*/
|
||||
|
||||
var EventEmitter;
|
||||
/* jshint ignore:start */
|
||||
EventEmitter = (function () {
|
||||
|
||||
|
||||
/**
|
||||
* Class for managing events.
|
||||
* Can be extended to provide event functionality in other classes.
|
||||
*
|
||||
* @class EventEmitter Manages event registering and emitting.
|
||||
*/
|
||||
function EventEmitter() {}
|
||||
|
||||
// Shortcuts to improve speed and size
|
||||
var proto = EventEmitter.prototype;
|
||||
var exports = {};
|
||||
|
||||
|
||||
/**
|
||||
* Finds the index of the listener for the event in it's storage array.
|
||||
*
|
||||
* @param {Function[]} listeners Array of listeners to search through.
|
||||
* @param {Function} listener Method to look for.
|
||||
* @return {Number} Index of the specified listener, -1 if not found
|
||||
* @api private
|
||||
*/
|
||||
function indexOfListener(listeners, listener) {
|
||||
var i = listeners.length;
|
||||
while (i--) {
|
||||
if (listeners[i].listener === listener) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias a method while keeping the context correct, to allow for overwriting of target method.
|
||||
*
|
||||
* @param {String} name The name of the target method.
|
||||
* @return {Function} The aliased method
|
||||
* @api private
|
||||
*/
|
||||
function alias(name) {
|
||||
return function aliasClosure() {
|
||||
return this[name].apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the listener array for the specified event.
|
||||
* Will initialise the event object and listener arrays if required.
|
||||
* Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
|
||||
* Each property in the object response is an array of listener functions.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
||||
* @return {Function[]|Object} All listener functions for the event.
|
||||
*/
|
||||
proto.getListeners = function getListeners(evt) {
|
||||
var events = this._getEvents();
|
||||
var response;
|
||||
var key;
|
||||
|
||||
// Return a concatenated array of all matching events if
|
||||
// the selector is a regular expression.
|
||||
if (evt instanceof RegExp) {
|
||||
response = {};
|
||||
for (key in events) {
|
||||
if (events.hasOwnProperty(key) && evt.test(key)) {
|
||||
response[key] = events[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
response = events[evt] || (events[evt] = []);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a list of listener objects and flattens it into a list of listener functions.
|
||||
*
|
||||
* @param {Object[]} listeners Raw listener objects.
|
||||
* @return {Function[]} Just the listener functions.
|
||||
*/
|
||||
proto.flattenListeners = function flattenListeners(listeners) {
|
||||
var flatListeners = [];
|
||||
var i;
|
||||
|
||||
for (i = 0; i < listeners.length; i += 1) {
|
||||
flatListeners.push(listeners[i].listener);
|
||||
}
|
||||
|
||||
return flatListeners;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
||||
* @return {Object} All listener functions for an event in an object.
|
||||
*/
|
||||
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
||||
var listeners = this.getListeners(evt);
|
||||
var response;
|
||||
|
||||
if (listeners instanceof Array) {
|
||||
response = {};
|
||||
response[evt] = listeners;
|
||||
}
|
||||
|
||||
return response || listeners;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a listener function to the specified event.
|
||||
* The listener will not be added if it is a duplicate.
|
||||
* If the listener returns true then it will be removed after it is called.
|
||||
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
||||
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addListener = function addListener(evt, listener) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var listenerIsWrapped = typeof listener === 'object';
|
||||
var key;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
||||
listeners[key].push(listenerIsWrapped ? listener : {
|
||||
listener: listener,
|
||||
once: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of addListener
|
||||
*/
|
||||
proto.on = alias('addListener');
|
||||
|
||||
/**
|
||||
* Semi-alias of addListener. It will add a listener that will be
|
||||
* automatically removed after it's first execution.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
||||
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addOnceListener = function addOnceListener(evt, listener) {
|
||||
return this.addListener(evt, {
|
||||
listener: listener,
|
||||
once: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of addOnceListener.
|
||||
*/
|
||||
proto.once = alias('addOnceListener');
|
||||
|
||||
/**
|
||||
* Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
|
||||
* You need to tell it what event names should be matched by a regex.
|
||||
*
|
||||
* @param {String} evt Name of the event to create.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.defineEvent = function defineEvent(evt) {
|
||||
this.getListeners(evt);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Uses defineEvent to define multiple events.
|
||||
*
|
||||
* @param {String[]} evts An array of event names to define.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.defineEvents = function defineEvents(evts) {
|
||||
for (var i = 0; i < evts.length; i += 1) {
|
||||
this.defineEvent(evts[i]);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a listener function from the specified event.
|
||||
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
||||
* @param {Function} listener Method to remove from the event.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeListener = function removeListener(evt, listener) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var index;
|
||||
var key;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key)) {
|
||||
index = indexOfListener(listeners[key], listener);
|
||||
|
||||
if (index !== -1) {
|
||||
listeners[key].splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of removeListener
|
||||
*/
|
||||
proto.off = alias('removeListener');
|
||||
|
||||
/**
|
||||
* Adds listeners in bulk using the manipulateListeners method.
|
||||
* If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
|
||||
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
||||
* Yeah, this function does quite a bit. That's probably a bad thing.
|
||||
*
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addListeners = function addListeners(evt, listeners) {
|
||||
// Pass through to manipulateListeners
|
||||
return this.manipulateListeners(false, evt, listeners);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes listeners in bulk using the manipulateListeners method.
|
||||
* If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
||||
* You can also pass it an event name and an array of listeners to be removed.
|
||||
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
||||
*
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to remove.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeListeners = function removeListeners(evt, listeners) {
|
||||
// Pass through to manipulateListeners
|
||||
return this.manipulateListeners(true, evt, listeners);
|
||||
};
|
||||
|
||||
/**
|
||||
* Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
|
||||
* The first argument will determine if the listeners are removed (true) or added (false).
|
||||
* If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
||||
* You can also pass it an event name and an array of listeners to be added/removed.
|
||||
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
||||
*
|
||||
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
||||
var i;
|
||||
var value;
|
||||
var single = remove ? this.removeListener : this.addListener;
|
||||
var multiple = remove ? this.removeListeners : this.addListeners;
|
||||
|
||||
// If evt is an object then pass each of it's properties to this method
|
||||
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
|
||||
for (i in evt) {
|
||||
if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
||||
// Pass the single listener straight through to the singular method
|
||||
if (typeof value === 'function') {
|
||||
single.call(this, i, value);
|
||||
}
|
||||
else {
|
||||
// Otherwise pass back to the multiple function
|
||||
multiple.call(this, i, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// So evt must be a string
|
||||
// And listeners must be an array of listeners
|
||||
// Loop over it and pass each one to the multiple method
|
||||
i = listeners.length;
|
||||
while (i--) {
|
||||
single.call(this, evt, listeners[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all listeners from a specified event.
|
||||
* If you do not specify an event then all listeners will be removed.
|
||||
* That means every event will be emptied.
|
||||
* You can also pass a regex to remove all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeEvent = function removeEvent(evt) {
|
||||
var type = typeof evt;
|
||||
var events = this._getEvents();
|
||||
var key;
|
||||
|
||||
// Remove different things depending on the state of evt
|
||||
if (type === 'string') {
|
||||
// Remove all listeners for the specified event
|
||||
delete events[evt];
|
||||
}
|
||||
else if (evt instanceof RegExp) {
|
||||
// Remove all events matching the regex.
|
||||
for (key in events) {
|
||||
if (events.hasOwnProperty(key) && evt.test(key)) {
|
||||
delete events[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Remove all listeners in all events
|
||||
delete this._events;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of removeEvent.
|
||||
*
|
||||
* Added to mirror the node API.
|
||||
*/
|
||||
proto.removeAllListeners = alias('removeEvent');
|
||||
|
||||
/**
|
||||
* Emits an event of your choice.
|
||||
* When emitted, every listener attached to that event will be executed.
|
||||
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
||||
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
||||
* So they will not arrive within the array on the other side, they will be separate.
|
||||
* You can also pass a regular expression to emit to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
||||
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.emitEvent = function emitEvent(evt, args) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var listener;
|
||||
var i;
|
||||
var key;
|
||||
var response;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key)) {
|
||||
i = listeners[key].length;
|
||||
|
||||
while (i--) {
|
||||
// If the listener returns true then it shall be removed from the event
|
||||
// The function is executed either with a basic call or an apply if there is an args array
|
||||
listener = listeners[key][i];
|
||||
|
||||
if (listener.once === true) {
|
||||
this.removeListener(evt, listener.listener);
|
||||
}
|
||||
|
||||
response = listener.listener.apply(this, args || []);
|
||||
|
||||
if (response === this._getOnceReturnValue()) {
|
||||
this.removeListener(evt, listener.listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of emitEvent
|
||||
*/
|
||||
proto.trigger = alias('emitEvent');
|
||||
|
||||
/**
|
||||
* Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
|
||||
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
||||
* @param {...*} Optional additional arguments to be passed to each listener.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.emit = function emit(evt) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return this.emitEvent(evt, args);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current value to check against when executing listeners. If a
|
||||
* listeners return value matches the one set here then it will be removed
|
||||
* after execution. This value defaults to true.
|
||||
*
|
||||
* @param {*} value The new value to check for when executing listeners.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
||||
this._onceReturnValue = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the current value to check against when executing listeners. If
|
||||
* the listeners return value matches this one then it should be removed
|
||||
* automatically. It will return true by default.
|
||||
*
|
||||
* @return {*|Boolean} The current value to check for or the default, true.
|
||||
* @api private
|
||||
*/
|
||||
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
||||
if (this.hasOwnProperty('_onceReturnValue')) {
|
||||
return this._onceReturnValue;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the events object and creates one if required.
|
||||
*
|
||||
* @return {Object} The events storage object.
|
||||
* @api private
|
||||
*/
|
||||
proto._getEvents = function _getEvents() {
|
||||
return this._events || (this._events = {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
|
||||
*
|
||||
* @return {Function} Non conflicting EventEmitter class.
|
||||
*/
|
||||
EventEmitter.noConflict = function noConflict() {
|
||||
exports.EventEmitter = originalGlobalValue;
|
||||
return EventEmitter;
|
||||
};
|
||||
|
||||
return EventEmitter;
|
||||
}());
|
||||
/* jshint ignore:end */
|
||||
|
||||
|
||||
|
||||
var validateTypeFunction = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || typeof value === "function", "Function" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var superGet, superInit,
|
||||
globalEe = new EventEmitter();
|
||||
|
||||
function validateTypeEvent( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || value instanceof RegExp, "String or RegExp" );
|
||||
}
|
||||
|
||||
function validateThenCall( method, self ) {
|
||||
return function( event, listener ) {
|
||||
validatePresence( event, "event" );
|
||||
validateTypeEvent( event, "event" );
|
||||
|
||||
validatePresence( listener, "listener" );
|
||||
validateTypeFunction( listener, "listener" );
|
||||
|
||||
return self[ method ].apply( self, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
function off( self ) {
|
||||
return validateThenCall( "off", self );
|
||||
}
|
||||
|
||||
function on( self ) {
|
||||
return validateThenCall( "on", self );
|
||||
}
|
||||
|
||||
function once( self ) {
|
||||
return validateThenCall( "once", self );
|
||||
}
|
||||
|
||||
Cldr.off = off( globalEe );
|
||||
Cldr.on = on( globalEe );
|
||||
Cldr.once = once( globalEe );
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.init().
|
||||
*/
|
||||
superInit = Cldr.prototype.init;
|
||||
Cldr.prototype.init = function() {
|
||||
var ee;
|
||||
this.ee = ee = new EventEmitter();
|
||||
this.off = off( ee );
|
||||
this.on = on( ee );
|
||||
this.once = once( ee );
|
||||
superInit.apply( this, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* getOverload is encapsulated, because of cldr/unresolved. If it's loaded
|
||||
* after cldr/event (and note it overwrites .get), it can trigger this
|
||||
* overload again.
|
||||
*/
|
||||
function getOverload() {
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.get().
|
||||
*/
|
||||
superGet = Cldr.prototype.get;
|
||||
Cldr.prototype.get = function( path ) {
|
||||
var value = superGet.apply( this, arguments );
|
||||
path = pathNormalize( path, this.attributes ).join( "/" );
|
||||
globalEe.trigger( "get", [ path, value ] );
|
||||
this.ee.trigger( "get", [ path, value ] );
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
Cldr._eventInit = getOverload;
|
||||
getOverload();
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
define("cldr_event", function(){});
|
||||
}));
|
||||
101
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr_supplemental.js
vendored
Normal file
101
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr_supplemental.js
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var alwaysArray = Cldr._alwaysArray;
|
||||
|
||||
|
||||
|
||||
var supplementalMain = function( cldr ) {
|
||||
|
||||
var prepend, supplemental;
|
||||
|
||||
prepend = function( prepend ) {
|
||||
return function( path ) {
|
||||
path = alwaysArray( path );
|
||||
return cldr.get( [ prepend ].concat( path ) );
|
||||
};
|
||||
};
|
||||
|
||||
supplemental = prepend( "supplemental" );
|
||||
|
||||
// Week Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Week_Data
|
||||
supplemental.weekData = prepend( "supplemental/weekData" );
|
||||
|
||||
supplemental.weekData.firstDay = function() {
|
||||
return cldr.get( "supplemental/weekData/firstDay/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/firstDay/001" );
|
||||
};
|
||||
|
||||
supplemental.weekData.minDays = function() {
|
||||
var minDays = cldr.get( "supplemental/weekData/minDays/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/minDays/001" );
|
||||
return parseInt( minDays, 10 );
|
||||
};
|
||||
|
||||
// Time Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
|
||||
supplemental.timeData = prepend( "supplemental/timeData" );
|
||||
|
||||
supplemental.timeData.allowed = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_allowed" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_allowed" );
|
||||
};
|
||||
|
||||
supplemental.timeData.preferred = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_preferred" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_preferred" );
|
||||
};
|
||||
|
||||
return supplemental;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var initSuper = Cldr.prototype.init;
|
||||
|
||||
/**
|
||||
* .init() automatically ran on construction.
|
||||
*
|
||||
* Overload .init().
|
||||
*/
|
||||
Cldr.prototype.init = function() {
|
||||
initSuper.apply( this, arguments );
|
||||
this.supplemental = supplementalMain( this );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
define("cldr_supplemental", function(){});
|
||||
}));
|
||||
164
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr_unresolved.js
vendored
Normal file
164
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/cldr_unresolved.js
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v@VERSION
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: @DATE
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var coreLoad = Cldr._coreLoad;
|
||||
var jsonMerge = Cldr._jsonMerge;
|
||||
var pathNormalize = Cldr._pathNormalize;
|
||||
var resourceGet = Cldr._resourceGet;
|
||||
var validatePresence = Cldr._validatePresence;
|
||||
var validateTypePath = Cldr._validateTypePath;
|
||||
|
||||
|
||||
|
||||
var bundleParentLookup = function( Cldr, locale ) {
|
||||
var normalizedPath, parent;
|
||||
|
||||
if ( locale === "root" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First, try to find parent on supplemental data.
|
||||
normalizedPath = pathNormalize( [ "supplemental/parentLocales/parentLocale", locale ] );
|
||||
parent = resourceGet( Cldr._resolved, normalizedPath ) || resourceGet( Cldr._raw, normalizedPath );
|
||||
if ( parent ) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
// Or truncate locale.
|
||||
parent = locale.substr( 0, locale.lastIndexOf( Cldr.localeSep ) );
|
||||
if ( !parent ) {
|
||||
return "root";
|
||||
}
|
||||
|
||||
return parent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceSet = function( data, path, value ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
if ( !node[ path[ i ] ] ) {
|
||||
node[ path[ i ] ] = {};
|
||||
}
|
||||
node = node[ path[ i ] ];
|
||||
}
|
||||
node[ path[ i ] ] = value;
|
||||
};
|
||||
|
||||
|
||||
var itemLookup = (function() {
|
||||
|
||||
var lookup;
|
||||
|
||||
lookup = function( Cldr, locale, path, attributes, childLocale ) {
|
||||
var normalizedPath, parent, value;
|
||||
|
||||
// 1: Finish recursion
|
||||
// 2: Avoid infinite loop
|
||||
if ( typeof locale === "undefined" /* 1 */ || locale === childLocale /* 2 */ ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve path
|
||||
normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
// Check resolved (cached) data first
|
||||
// 1: Due to #16, never use the cached resolved non-leaf nodes. It may not
|
||||
// represent its leafs in its entirety.
|
||||
value = resourceGet( Cldr._resolved, normalizedPath );
|
||||
if ( value !== undefined && typeof value !== "object" /* 1 */ ) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Check raw data
|
||||
value = resourceGet( Cldr._raw, normalizedPath );
|
||||
|
||||
if ( value === undefined ) {
|
||||
// Or, lookup at parent locale
|
||||
parent = bundleParentLookup( Cldr, locale );
|
||||
value = lookup( Cldr, parent, path, jsonMerge( attributes, { bundle: parent }), locale );
|
||||
}
|
||||
|
||||
if ( value !== undefined ) {
|
||||
// Set resolved (cached)
|
||||
resourceSet( Cldr._resolved, normalizedPath, value );
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
return lookup;
|
||||
|
||||
}());
|
||||
|
||||
|
||||
Cldr._raw = {};
|
||||
|
||||
/**
|
||||
* Cldr.load( json [, json, ...] )
|
||||
*
|
||||
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||||
*
|
||||
* Load resolved or unresolved cldr data.
|
||||
* Overwrite Cldr.load().
|
||||
*/
|
||||
Cldr.load = function() {
|
||||
Cldr._raw = coreLoad( Cldr, Cldr._raw, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* Overwrite Cldr.prototype.get().
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
// 1: use bundle as locale on item lookup for simplification purposes, because no other extended subtag is used anyway on bundle parent lookup.
|
||||
// 2: during init(), this method is called, but bundle is yet not defined. Use "" as a workaround in this very specific scenario.
|
||||
return itemLookup( Cldr, this.attributes && this.attributes.bundle /* 1 */ || "" /* 2 */, path, this.attributes );
|
||||
};
|
||||
|
||||
// In case cldr/unresolved is loaded after cldr/event, we trigger its overloads again. Because, .get is overwritten in here.
|
||||
if ( Cldr._eventInit ) {
|
||||
Cldr._eventInit();
|
||||
}
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
define("cldr_unresolved", function(){});
|
||||
}));
|
||||
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/create_error.js
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/create_error.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
var createError = function( code, attributes ) {
|
||||
var error, message;
|
||||
|
||||
message = code + ( attributes && JSON ? ": " + JSON.stringify( attributes ) : "" );
|
||||
error = new Error( message );
|
||||
error.code = code;
|
||||
|
||||
// extend( error, attributes );
|
||||
arrayForEach( objectKeys( attributes ), function( attribute ) {
|
||||
error[ attribute ] = attributes[ attribute ];
|
||||
});
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
8
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate.js
vendored
Normal file
8
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
var validate = function( code, check, attributes ) {
|
||||
if ( !check ) {
|
||||
throw createError( code, attributes );
|
||||
}
|
||||
};
|
||||
|
||||
8
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/presence.js
vendored
Normal file
8
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/presence.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
var validatePresence = function( value, name ) {
|
||||
validate( "E_MISSING_PARAMETER", typeof value !== "undefined", {
|
||||
name: name
|
||||
});
|
||||
};
|
||||
|
||||
10
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type.js
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
var validateType = function( value, name, check, expected ) {
|
||||
validate( "E_INVALID_PAR_TYPE", check, {
|
||||
expected: expected,
|
||||
name: name,
|
||||
value: value
|
||||
});
|
||||
};
|
||||
|
||||
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/function.js
vendored
Normal file
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/function.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypeFunction = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || typeof value === "function", "Function" );
|
||||
};
|
||||
|
||||
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/path.js
vendored
Normal file
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/path.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypePath = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || arrayIsArray( value ), "String or Array" );
|
||||
};
|
||||
|
||||
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/plain_object.js
vendored
Normal file
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/plain_object.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypePlainObject = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || isPlainObject( value ), "Plain Object" );
|
||||
};
|
||||
|
||||
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/string.js
vendored
Normal file
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/common/validate/type/string.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypeString = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string", "a string" );
|
||||
};
|
||||
|
||||
140
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core.js
vendored
Normal file
140
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core.js
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
|
||||
|
||||
/**
|
||||
* new Cldr()
|
||||
*/
|
||||
var Cldr = function( locale ) {
|
||||
this.init( locale );
|
||||
};
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
Cldr._alwaysArray = alwaysArray;
|
||||
Cldr._coreLoad = coreLoad;
|
||||
Cldr._createError = createError;
|
||||
Cldr._itemGetResolved = itemGetResolved;
|
||||
Cldr._jsonMerge = jsonMerge;
|
||||
Cldr._pathNormalize = pathNormalize;
|
||||
Cldr._resourceGet = resourceGet;
|
||||
Cldr._validatePresence = validatePresence;
|
||||
Cldr._validateType = validateType;
|
||||
Cldr._validateTypePath = validateTypePath;
|
||||
Cldr._validateTypePlainObject = validateTypePlainObject;
|
||||
|
||||
Cldr._availableBundleMap = {};
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
Cldr._resolved = {};
|
||||
|
||||
// Allow user to override locale separator "-" (default) | "_". According to http://www.unicode.org/reports/tr35/#Unicode_language_identifier, both "-" and "_" are valid locale separators (eg. "en_GB", "en-GB"). According to http://unicode.org/cldr/trac/ticket/6786 its usage must be consistent throughout the data set.
|
||||
Cldr.localeSep = "-";
|
||||
|
||||
/**
|
||||
* Cldr.load( json [, json, ...] )
|
||||
*
|
||||
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||||
*
|
||||
* Load resolved cldr data.
|
||||
*/
|
||||
Cldr.load = function() {
|
||||
Cldr._resolved = coreLoad( Cldr, Cldr._resolved, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* .init() automatically run on instantiation/construction.
|
||||
*/
|
||||
Cldr.prototype.init = function( locale ) {
|
||||
var attributes, language, maxLanguageId, minLanguageId, script, subtags, territory, unicodeLocaleExtensions, variant,
|
||||
sep = Cldr.localeSep,
|
||||
unicodeLocaleExtensionsRaw = "";
|
||||
|
||||
validatePresence( locale, "locale" );
|
||||
validateTypeString( locale, "locale" );
|
||||
|
||||
subtags = coreSubtags( locale );
|
||||
|
||||
if ( subtags.length === 5 ) {
|
||||
unicodeLocaleExtensions = subtags.pop();
|
||||
unicodeLocaleExtensionsRaw = sep + "u" + sep + unicodeLocaleExtensions;
|
||||
// Remove trailing null when there is unicodeLocaleExtensions but no variants.
|
||||
if ( !subtags[ 3 ] ) {
|
||||
subtags.pop();
|
||||
}
|
||||
}
|
||||
variant = subtags[ 3 ];
|
||||
|
||||
// Normalize locale code.
|
||||
// Get (or deduce) the "triple subtags": language, territory (also aliased as region), and script subtags.
|
||||
// Get the variant subtags (calendar, collation, currency, etc).
|
||||
// refs:
|
||||
// - http://www.unicode.org/reports/tr35/#Field_Definitions
|
||||
// - http://www.unicode.org/reports/tr35/#Language_and_Locale_IDs
|
||||
// - http://www.unicode.org/reports/tr35/#Unicode_locale_identifier
|
||||
|
||||
// When a locale id does not specify a language, or territory (region), or script, they are obtained by Likely Subtags.
|
||||
maxLanguageId = coreLikelySubtags( Cldr, this, subtags, { force: true } ) || subtags;
|
||||
language = maxLanguageId[ 0 ];
|
||||
script = maxLanguageId[ 1 ];
|
||||
territory = maxLanguageId[ 2 ];
|
||||
|
||||
minLanguageId = coreRemoveLikelySubtags( Cldr, this, maxLanguageId ).join( sep );
|
||||
|
||||
// Set attributes
|
||||
this.attributes = attributes = {
|
||||
bundle: bundleLookup( Cldr, this, minLanguageId ),
|
||||
|
||||
// Unicode Language Id
|
||||
minLanguageId: minLanguageId + unicodeLocaleExtensionsRaw,
|
||||
maxLanguageId: maxLanguageId.join( sep ) + unicodeLocaleExtensionsRaw,
|
||||
|
||||
// Unicode Language Id Subtabs
|
||||
language: language,
|
||||
script: script,
|
||||
territory: territory,
|
||||
region: territory, /* alias */
|
||||
variant: variant
|
||||
};
|
||||
|
||||
// Unicode locale extensions.
|
||||
unicodeLocaleExtensions && ( "-" + unicodeLocaleExtensions ).replace( /-[a-z]{3,8}|(-[a-z]{2})-([a-z]{3,8})/g, function( attribute, key, type ) {
|
||||
|
||||
if ( key ) {
|
||||
|
||||
// Extension is in the `keyword` form.
|
||||
attributes[ "u" + key ] = type;
|
||||
} else {
|
||||
|
||||
// Extension is in the `attribute` form.
|
||||
attributes[ "u" + attribute ] = true;
|
||||
}
|
||||
});
|
||||
|
||||
this.locale = locale;
|
||||
};
|
||||
|
||||
/**
|
||||
* .get()
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
return itemGetResolved( Cldr, path, this.attributes );
|
||||
};
|
||||
|
||||
/**
|
||||
* .main()
|
||||
*/
|
||||
Cldr.prototype.main = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
validate( "E_MISSING_BUNDLE", this.attributes.bundle !== null, {
|
||||
locale: this.locale
|
||||
});
|
||||
|
||||
path = alwaysArray( path );
|
||||
return this.get( [ "main/{bundle}" ].concat( path ) );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
91
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/likely_subtags.js
vendored
Normal file
91
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/likely_subtags.js
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
|
||||
|
||||
/**
|
||||
* Return the maximized language id as defined in
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. Canonicalize.
|
||||
* 1.1 Make sure the input locale is in canonical form: uses the right
|
||||
* separator, and has the right casing.
|
||||
* TODO Right casing? What df? It seems languages are lowercase, scripts are
|
||||
* Capitalized, territory is uppercase. I am leaving this as an exercise to
|
||||
* the user.
|
||||
*
|
||||
* 1.2 Replace any deprecated subtags with their canonical values using the
|
||||
* <alias> data in supplemental metadata. Use the first value in the
|
||||
* replacement list, if it exists. Language tag replacements may have multiple
|
||||
* parts, such as "sh" ➞ "sr_Latn" or mo" ➞ "ro_MD". In such a case, the
|
||||
* original script and/or region are retained if there is one. Thus
|
||||
* "sh_Arab_AQ" ➞ "sr_Arab_AQ", not "sr_Latn_AQ".
|
||||
* TODO What <alias> data?
|
||||
*
|
||||
* 1.3 If the tag is grandfathered (see <variable id="$grandfathered"
|
||||
* type="choice"> in the supplemental data), then return it.
|
||||
* TODO grandfathered?
|
||||
*
|
||||
* 1.4 Remove the script code 'Zzzz' and the region code 'ZZ' if they occur.
|
||||
* 1.5 Get the components of the cleaned-up source tag (languages, scripts,
|
||||
* and regions), plus any variants and extensions.
|
||||
* 2. Lookup. Lookup each of the following in order, and stop on the first
|
||||
* match:
|
||||
* 2.1 languages_scripts_regions
|
||||
* 2.2 languages_regions
|
||||
* 2.3 languages_scripts
|
||||
* 2.4 languages
|
||||
* 2.5 und_scripts
|
||||
* 3. Return
|
||||
* 3.1 If there is no match, either return an error value, or the match for
|
||||
* "und" (in APIs where a valid language tag is required).
|
||||
* 3.2 Otherwise there is a match = languagem_scriptm_regionm
|
||||
* 3.3 Let xr = xs if xs is not empty, and xm otherwise.
|
||||
* 3.4 Return the language tag composed of languager _ scriptr _ regionr +
|
||||
* variants + extensions.
|
||||
*
|
||||
* @subtags [Array] normalized language id subtags tuple (see init.js).
|
||||
*/
|
||||
var coreLikelySubtags = function( Cldr, cldr, subtags, options ) {
|
||||
var match, matchFound,
|
||||
language = subtags[ 0 ],
|
||||
script = subtags[ 1 ],
|
||||
sep = Cldr.localeSep,
|
||||
territory = subtags[ 2 ],
|
||||
variants = subtags.slice( 3, 4 );
|
||||
options = options || {};
|
||||
|
||||
// Skip if (language, script, territory) is not empty [3.3]
|
||||
if ( language !== "und" && script !== "Zzzz" && territory !== "ZZ" ) {
|
||||
return [ language, script, territory ].concat( variants );
|
||||
}
|
||||
|
||||
// Skip if no supplemental likelySubtags data is present
|
||||
if ( typeof cldr.get( "supplemental/likelySubtags" ) === "undefined" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// [2]
|
||||
matchFound = arraySome([
|
||||
[ language, script, territory ],
|
||||
[ language, territory ],
|
||||
[ language, script ],
|
||||
[ language ],
|
||||
[ "und", script ]
|
||||
], function( test ) {
|
||||
return match = !(/\b(Zzzz|ZZ)\b/).test( test.join( sep ) ) /* [1.4] */ && cldr.get( [ "supplemental/likelySubtags", test.join( sep ) ] );
|
||||
});
|
||||
|
||||
// [3]
|
||||
if ( matchFound ) {
|
||||
// [3.2 .. 3.4]
|
||||
match = match.split( sep );
|
||||
return [
|
||||
language !== "und" ? language : match[ 0 ],
|
||||
script !== "Zzzz" ? script : match[ 1 ],
|
||||
territory !== "ZZ" ? territory : match[ 2 ]
|
||||
].concat( variants );
|
||||
} else if ( options.force ) {
|
||||
// [3.1.2]
|
||||
return cldr.get( "supplemental/likelySubtags/und" ).split( sep );
|
||||
} else {
|
||||
// [3.1.1]
|
||||
return;
|
||||
}
|
||||
};
|
||||
31
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/load.js
vendored
Normal file
31
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/load.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
/**
|
||||
* load( Cldr, source, jsons )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @source [Object]
|
||||
*
|
||||
* @jsons [arguments]
|
||||
*/
|
||||
var coreLoad = function( Cldr, source, jsons ) {
|
||||
var i, j, json;
|
||||
|
||||
validatePresence( jsons[ 0 ], "json" );
|
||||
|
||||
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
|
||||
for ( i = 0; i < jsons.length; i++ ) {
|
||||
|
||||
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
|
||||
json = alwaysArray( jsons[ i ] );
|
||||
|
||||
for ( j = 0; j < json.length; j++ ) {
|
||||
validateTypePlainObject( json[ j ], "json" );
|
||||
source = jsonMerge( source, json[ j ] );
|
||||
coreSetAvailableBundles( Cldr, json[ j ] );
|
||||
}
|
||||
}
|
||||
|
||||
return source;
|
||||
};
|
||||
45
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/remove_likely_subtags.js
vendored
Normal file
45
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/remove_likely_subtags.js
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
|
||||
/**
|
||||
* Given a locale, remove any fields that Add Likely Subtags would add.
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. First get max = AddLikelySubtags(inputLocale). If an error is signaled,
|
||||
* return it.
|
||||
* 2. Remove the variants from max.
|
||||
* 3. Then for trial in {language, language _ region, language _ script}. If
|
||||
* AddLikelySubtags(trial) = max, then return trial + variants.
|
||||
* 4. If you do not get a match, return max + variants.
|
||||
*
|
||||
* @maxLanguageId [Array] maxLanguageId tuple (see init.js).
|
||||
*/
|
||||
var coreRemoveLikelySubtags = function( Cldr, cldr, maxLanguageId ) {
|
||||
var match, matchFound,
|
||||
language = maxLanguageId[ 0 ],
|
||||
script = maxLanguageId[ 1 ],
|
||||
territory = maxLanguageId[ 2 ],
|
||||
variants = maxLanguageId[ 3 ];
|
||||
|
||||
// [3]
|
||||
matchFound = arraySome([
|
||||
[ [ language, "Zzzz", "ZZ" ], [ language ] ],
|
||||
[ [ language, "Zzzz", territory ], [ language, territory ] ],
|
||||
[ [ language, script, "ZZ" ], [ language, script ] ]
|
||||
], function( test ) {
|
||||
var result = coreLikelySubtags( Cldr, cldr, test[ 0 ] );
|
||||
match = test[ 1 ];
|
||||
return result && result[ 0 ] === maxLanguageId[ 0 ] &&
|
||||
result[ 1 ] === maxLanguageId[ 1 ] &&
|
||||
result[ 2 ] === maxLanguageId[ 2 ];
|
||||
});
|
||||
|
||||
if ( matchFound ) {
|
||||
if ( variants ) {
|
||||
match.push( variants );
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
// [4]
|
||||
return maxLanguageId;
|
||||
};
|
||||
|
||||
25
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/set_available_bundles.js
vendored
Normal file
25
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/set_available_bundles.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
/**
|
||||
* setAvailableBundles( Cldr, json )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @json resolved/unresolved cldr data.
|
||||
*
|
||||
* Set available bundles queue based on passed json CLDR data. Considers a bundle as any String at /main/{bundle}.
|
||||
*/
|
||||
var coreSetAvailableBundles = function( Cldr, json ) {
|
||||
var bundle,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue,
|
||||
main = resourceGet( json, [ "main" ] );
|
||||
|
||||
if ( main ) {
|
||||
for ( bundle in main ) {
|
||||
if ( main.hasOwnProperty( bundle ) && bundle !== "root" &&
|
||||
availableBundleMapQueue.indexOf( bundle ) === -1 ) {
|
||||
availableBundleMapQueue.push( bundle );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
51
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/subtags.js
vendored
Normal file
51
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/core/subtags.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
/**
|
||||
* subtags( locale )
|
||||
*
|
||||
* @locale [String]
|
||||
*/
|
||||
var coreSubtags = function( locale ) {
|
||||
var aux, unicodeLanguageId,
|
||||
subtags = [];
|
||||
|
||||
locale = locale.replace( /_/, "-" );
|
||||
|
||||
// Unicode locale extensions.
|
||||
aux = locale.split( "-u-" );
|
||||
if ( aux[ 1 ] ) {
|
||||
aux[ 1 ] = aux[ 1 ].split( "-t-" );
|
||||
locale = aux[ 0 ] + ( aux[ 1 ][ 1 ] ? "-t-" + aux[ 1 ][ 1 ] : "");
|
||||
subtags[ 4 /* unicodeLocaleExtensions */ ] = aux[ 1 ][ 0 ];
|
||||
}
|
||||
|
||||
// TODO normalize transformed extensions. Currently, skipped.
|
||||
// subtags[ x ] = locale.split( "-t-" )[ 1 ];
|
||||
unicodeLanguageId = locale.split( "-t-" )[ 0 ];
|
||||
|
||||
// unicode_language_id = "root"
|
||||
// | unicode_language_subtag
|
||||
// (sep unicode_script_subtag)?
|
||||
// (sep unicode_region_subtag)?
|
||||
// (sep unicode_variant_subtag)* ;
|
||||
//
|
||||
// Although unicode_language_subtag = alpha{2,8}, I'm using alpha{2,3}. Because, there's no language on CLDR lengthier than 3.
|
||||
aux = unicodeLanguageId.match( /^(([a-z]{2,3})(-([A-Z][a-z]{3}))?(-([A-Z]{2}|[0-9]{3}))?)((-([a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3}))*)$|^(root)$/ );
|
||||
if ( aux === null ) {
|
||||
return [ "und", "Zzzz", "ZZ" ];
|
||||
}
|
||||
subtags[ 0 /* language */ ] = aux[ 10 ] /* root */ || aux[ 2 ] || "und";
|
||||
subtags[ 1 /* script */ ] = aux[ 4 ] || "Zzzz";
|
||||
subtags[ 2 /* territory */ ] = aux[ 6 ] || "ZZ";
|
||||
if ( aux[ 7 ] && aux[ 7 ].length ) {
|
||||
subtags[ 3 /* variant */ ] = aux[ 7 ].slice( 1 ) /* remove leading "-" */;
|
||||
}
|
||||
|
||||
// 0: language
|
||||
// 1: script
|
||||
// 2: territory (aka region)
|
||||
// 3: variant
|
||||
// 4: unicodeLocaleExtensions
|
||||
return subtags;
|
||||
};
|
||||
|
||||
75
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/event.js
vendored
Normal file
75
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/event.js
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
|
||||
var superGet, superInit,
|
||||
globalEe = new EventEmitter();
|
||||
|
||||
function validateTypeEvent( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || value instanceof RegExp, "String or RegExp" );
|
||||
}
|
||||
|
||||
function validateThenCall( method, self ) {
|
||||
return function( event, listener ) {
|
||||
validatePresence( event, "event" );
|
||||
validateTypeEvent( event, "event" );
|
||||
|
||||
validatePresence( listener, "listener" );
|
||||
validateTypeFunction( listener, "listener" );
|
||||
|
||||
return self[ method ].apply( self, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
function off( self ) {
|
||||
return validateThenCall( "off", self );
|
||||
}
|
||||
|
||||
function on( self ) {
|
||||
return validateThenCall( "on", self );
|
||||
}
|
||||
|
||||
function once( self ) {
|
||||
return validateThenCall( "once", self );
|
||||
}
|
||||
|
||||
Cldr.off = off( globalEe );
|
||||
Cldr.on = on( globalEe );
|
||||
Cldr.once = once( globalEe );
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.init().
|
||||
*/
|
||||
superInit = Cldr.prototype.init;
|
||||
Cldr.prototype.init = function() {
|
||||
var ee;
|
||||
this.ee = ee = new EventEmitter();
|
||||
this.off = off( ee );
|
||||
this.on = on( ee );
|
||||
this.once = once( ee );
|
||||
superInit.apply( this, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* getOverload is encapsulated, because of cldr/unresolved. If it's loaded
|
||||
* after cldr/event (and note it overwrites .get), it can trigger this
|
||||
* overload again.
|
||||
*/
|
||||
function getOverload() {
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.get().
|
||||
*/
|
||||
superGet = Cldr.prototype.get;
|
||||
Cldr.prototype.get = function( path ) {
|
||||
var value = superGet.apply( this, arguments );
|
||||
path = pathNormalize( path, this.attributes ).join( "/" );
|
||||
globalEe.trigger( "get", [ path, value ] );
|
||||
this.ee.trigger( "get", [ path, value ] );
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
Cldr._eventInit = getOverload;
|
||||
getOverload();
|
||||
|
||||
return Cldr;
|
||||
|
||||
9
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/item/get_resolved.js
vendored
Normal file
9
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/item/get_resolved.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
var itemGetResolved = function( Cldr, path, attributes ) {
|
||||
// Resolve path
|
||||
var normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
return resourceGet( Cldr._resolved, normalizedPath );
|
||||
};
|
||||
|
||||
44
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/item/lookup.js
vendored
Normal file
44
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/item/lookup.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var itemLookup = (function() {
|
||||
|
||||
var lookup;
|
||||
|
||||
lookup = function( Cldr, locale, path, attributes, childLocale ) {
|
||||
var normalizedPath, parent, value;
|
||||
|
||||
// 1: Finish recursion
|
||||
// 2: Avoid infinite loop
|
||||
if ( typeof locale === "undefined" /* 1 */ || locale === childLocale /* 2 */ ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve path
|
||||
normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
// Check resolved (cached) data first
|
||||
// 1: Due to #16, never use the cached resolved non-leaf nodes. It may not
|
||||
// represent its leafs in its entirety.
|
||||
value = resourceGet( Cldr._resolved, normalizedPath );
|
||||
if ( value !== undefined && typeof value !== "object" /* 1 */ ) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Check raw data
|
||||
value = resourceGet( Cldr._raw, normalizedPath );
|
||||
|
||||
if ( value === undefined ) {
|
||||
// Or, lookup at parent locale
|
||||
parent = bundleParentLookup( Cldr, locale );
|
||||
value = lookup( Cldr, parent, path, jsonMerge( attributes, { bundle: parent }), locale );
|
||||
}
|
||||
|
||||
if ( value !== undefined ) {
|
||||
// Set resolved (cached)
|
||||
resourceSet( Cldr._resolved, normalizedPath, value );
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
return lookup;
|
||||
|
||||
}());
|
||||
24
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/path/normalize.js
vendored
Normal file
24
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/path/normalize.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
var pathNormalize = function( path, attributes ) {
|
||||
if ( arrayIsArray( path ) ) {
|
||||
path = path.join( "/" );
|
||||
}
|
||||
if ( typeof path !== "string" ) {
|
||||
throw new Error( "invalid path \"" + path + "\"" );
|
||||
}
|
||||
// 1: Ignore leading slash `/`
|
||||
// 2: Ignore leading `cldr/`
|
||||
path = path
|
||||
.replace( /^\// , "" ) /* 1 */
|
||||
.replace( /^cldr\// , "" ); /* 2 */
|
||||
|
||||
// Replace {attribute}'s
|
||||
path = path.replace( /{[a-zA-Z]+}/g, function( name ) {
|
||||
name = name.replace( /^{([^}]*)}$/, "$1" );
|
||||
return attributes[ name ];
|
||||
});
|
||||
|
||||
return path.split( "/" );
|
||||
};
|
||||
|
||||
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/resource/get.js
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/resource/get.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceGet = function( data, path ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
node = node[ path[ i ] ];
|
||||
if ( !node ) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return node[ path[ i ] ];
|
||||
};
|
||||
|
||||
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/resource/set.js
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/resource/set.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceSet = function( data, path, value ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
if ( !node[ path[ i ] ] ) {
|
||||
node[ path[ i ] ] = {};
|
||||
}
|
||||
node = node[ path[ i ] ];
|
||||
}
|
||||
node[ path[ i ] ] = value;
|
||||
};
|
||||
|
||||
16
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/supplemental.js
vendored
Normal file
16
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/supplemental.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
var initSuper = Cldr.prototype.init;
|
||||
|
||||
/**
|
||||
* .init() automatically ran on construction.
|
||||
*
|
||||
* Overload .init().
|
||||
*/
|
||||
Cldr.prototype.init = function() {
|
||||
initSuper.apply( this, arguments );
|
||||
this.supplemental = supplementalMain( this );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
48
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/supplemental/main.js
vendored
Normal file
48
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/supplemental/main.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
var supplementalMain = function( cldr ) {
|
||||
|
||||
var prepend, supplemental;
|
||||
|
||||
prepend = function( prepend ) {
|
||||
return function( path ) {
|
||||
path = alwaysArray( path );
|
||||
return cldr.get( [ prepend ].concat( path ) );
|
||||
};
|
||||
};
|
||||
|
||||
supplemental = prepend( "supplemental" );
|
||||
|
||||
// Week Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Week_Data
|
||||
supplemental.weekData = prepend( "supplemental/weekData" );
|
||||
|
||||
supplemental.weekData.firstDay = function() {
|
||||
return cldr.get( "supplemental/weekData/firstDay/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/firstDay/001" );
|
||||
};
|
||||
|
||||
supplemental.weekData.minDays = function() {
|
||||
var minDays = cldr.get( "supplemental/weekData/minDays/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/minDays/001" );
|
||||
return parseInt( minDays, 10 );
|
||||
};
|
||||
|
||||
// Time Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
|
||||
supplemental.timeData = prepend( "supplemental/timeData" );
|
||||
|
||||
supplemental.timeData.allowed = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_allowed" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_allowed" );
|
||||
};
|
||||
|
||||
supplemental.timeData.preferred = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_preferred" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_preferred" );
|
||||
};
|
||||
|
||||
return supplemental;
|
||||
|
||||
};
|
||||
|
||||
35
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/unresolved.js
vendored
Normal file
35
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/unresolved.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
Cldr._raw = {};
|
||||
|
||||
/**
|
||||
* Cldr.load( json [, json, ...] )
|
||||
*
|
||||
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||||
*
|
||||
* Load resolved or unresolved cldr data.
|
||||
* Overwrite Cldr.load().
|
||||
*/
|
||||
Cldr.load = function() {
|
||||
Cldr._raw = coreLoad( Cldr, Cldr._raw, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* Overwrite Cldr.prototype.get().
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
// 1: use bundle as locale on item lookup for simplification purposes, because no other extended subtag is used anyway on bundle parent lookup.
|
||||
// 2: during init(), this method is called, but bundle is yet not defined. Use "" as a workaround in this very specific scenario.
|
||||
return itemLookup( Cldr, this.attributes && this.attributes.bundle /* 1 */ || "" /* 2 */, path, this.attributes );
|
||||
};
|
||||
|
||||
// In case cldr/unresolved is loaded after cldr/event, we trigger its overloads again. Because, .get is overwritten in here.
|
||||
if ( Cldr._eventInit ) {
|
||||
Cldr._eventInit();
|
||||
}
|
||||
|
||||
return Cldr;
|
||||
|
||||
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/always_array.js
vendored
Normal file
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/always_array.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var alwaysArray = function( somethingOrArray ) {
|
||||
return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
|
||||
};
|
||||
|
||||
12
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/array/for_each.js
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/array/for_each.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
var arrayForEach = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.forEach ) {
|
||||
return array.forEach( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
callback( array[ i ], i, array );
|
||||
}
|
||||
};
|
||||
|
||||
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/array/is_array.js
vendored
Normal file
6
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/array/is_array.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var arrayIsArray = Array.isArray || function( obj ) {
|
||||
return Object.prototype.toString.call( obj ) === "[object Array]";
|
||||
};
|
||||
|
||||
15
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/array/some.js
vendored
Normal file
15
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/array/some.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
var arraySome = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.some ) {
|
||||
return array.some( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
if ( callback( array[ i ], i, array ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
9
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/is_plain_object.js
vendored
Normal file
9
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/is_plain_object.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
/**
|
||||
* Function inspired by jQuery Core, but reduced to our use case.
|
||||
*/
|
||||
var isPlainObject = function( obj ) {
|
||||
return obj !== null && "" + obj === "[object Object]";
|
||||
};
|
||||
|
||||
35
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/json/merge.js
vendored
Normal file
35
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/json/merge.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
var jsonMerge = (function() {
|
||||
|
||||
// Returns new deeply merged JSON.
|
||||
//
|
||||
// Eg.
|
||||
// merge( { a: { b: 1, c: 2 } }, { a: { b: 3, d: 4 } } )
|
||||
// -> { a: { b: 3, c: 2, d: 4 } }
|
||||
//
|
||||
// @arguments JSON's
|
||||
//
|
||||
var merge = function() {
|
||||
var destination = {},
|
||||
sources = [].slice.call( arguments, 0 );
|
||||
arrayForEach( sources, function( source ) {
|
||||
var prop;
|
||||
for ( prop in source ) {
|
||||
if ( prop in destination && typeof destination[ prop ] === "object" && !arrayIsArray( destination[ prop ] ) ) {
|
||||
|
||||
// Merge Objects
|
||||
destination[ prop ] = merge( destination[ prop ], source[ prop ] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set new values
|
||||
destination[ prop ] = source[ prop ];
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return destination;
|
||||
};
|
||||
|
||||
return merge;
|
||||
|
||||
}());
|
||||
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/object/keys.js
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/cldrjs/dist/.build/util/object/keys.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
var objectKeys = function( object ) {
|
||||
var i,
|
||||
result = [];
|
||||
|
||||
if ( Object.keys ) {
|
||||
return Object.keys( object );
|
||||
}
|
||||
|
||||
for ( i in object ) {
|
||||
result.push( i );
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
686
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr.js
vendored
Normal file
686
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr.js
vendored
Normal file
@@ -0,0 +1,686 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.5.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2020-10-22T15:56Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.5.4 2020-10-22T15:56Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Global
|
||||
root.Cldr = factory();
|
||||
}
|
||||
|
||||
}( this, function() {
|
||||
|
||||
|
||||
var arrayIsArray = Array.isArray || function( obj ) {
|
||||
return Object.prototype.toString.call( obj ) === "[object Array]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var pathNormalize = function( path, attributes ) {
|
||||
if ( arrayIsArray( path ) ) {
|
||||
path = path.join( "/" );
|
||||
}
|
||||
if ( typeof path !== "string" ) {
|
||||
throw new Error( "invalid path \"" + path + "\"" );
|
||||
}
|
||||
// 1: Ignore leading slash `/`
|
||||
// 2: Ignore leading `cldr/`
|
||||
path = path
|
||||
.replace( /^\// , "" ) /* 1 */
|
||||
.replace( /^cldr\// , "" ); /* 2 */
|
||||
|
||||
// Replace {attribute}'s
|
||||
path = path.replace( /{[a-zA-Z]+}/g, function( name ) {
|
||||
name = name.replace( /^{([^}]*)}$/, "$1" );
|
||||
return attributes[ name ];
|
||||
});
|
||||
|
||||
return path.split( "/" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var arraySome = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.some ) {
|
||||
return array.some( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
if ( callback( array[ i ], i, array ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the maximized language id as defined in
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. Canonicalize.
|
||||
* 1.1 Make sure the input locale is in canonical form: uses the right
|
||||
* separator, and has the right casing.
|
||||
* TODO Right casing? What df? It seems languages are lowercase, scripts are
|
||||
* Capitalized, territory is uppercase. I am leaving this as an exercise to
|
||||
* the user.
|
||||
*
|
||||
* 1.2 Replace any deprecated subtags with their canonical values using the
|
||||
* <alias> data in supplemental metadata. Use the first value in the
|
||||
* replacement list, if it exists. Language tag replacements may have multiple
|
||||
* parts, such as "sh" ➞ "sr_Latn" or mo" ➞ "ro_MD". In such a case, the
|
||||
* original script and/or region are retained if there is one. Thus
|
||||
* "sh_Arab_AQ" ➞ "sr_Arab_AQ", not "sr_Latn_AQ".
|
||||
* TODO What <alias> data?
|
||||
*
|
||||
* 1.3 If the tag is grandfathered (see <variable id="$grandfathered"
|
||||
* type="choice"> in the supplemental data), then return it.
|
||||
* TODO grandfathered?
|
||||
*
|
||||
* 1.4 Remove the script code 'Zzzz' and the region code 'ZZ' if they occur.
|
||||
* 1.5 Get the components of the cleaned-up source tag (languages, scripts,
|
||||
* and regions), plus any variants and extensions.
|
||||
* 2. Lookup. Lookup each of the following in order, and stop on the first
|
||||
* match:
|
||||
* 2.1 languages_scripts_regions
|
||||
* 2.2 languages_regions
|
||||
* 2.3 languages_scripts
|
||||
* 2.4 languages
|
||||
* 2.5 und_scripts
|
||||
* 3. Return
|
||||
* 3.1 If there is no match, either return an error value, or the match for
|
||||
* "und" (in APIs where a valid language tag is required).
|
||||
* 3.2 Otherwise there is a match = languagem_scriptm_regionm
|
||||
* 3.3 Let xr = xs if xs is not empty, and xm otherwise.
|
||||
* 3.4 Return the language tag composed of languager _ scriptr _ regionr +
|
||||
* variants + extensions.
|
||||
*
|
||||
* @subtags [Array] normalized language id subtags tuple (see init.js).
|
||||
*/
|
||||
var coreLikelySubtags = function( Cldr, cldr, subtags, options ) {
|
||||
var match, matchFound,
|
||||
language = subtags[ 0 ],
|
||||
script = subtags[ 1 ],
|
||||
sep = Cldr.localeSep,
|
||||
territory = subtags[ 2 ],
|
||||
variants = subtags.slice( 3, 4 );
|
||||
options = options || {};
|
||||
|
||||
// Skip if (language, script, territory) is not empty [3.3]
|
||||
if ( language !== "und" && script !== "Zzzz" && territory !== "ZZ" ) {
|
||||
return [ language, script, territory ].concat( variants );
|
||||
}
|
||||
|
||||
// Skip if no supplemental likelySubtags data is present
|
||||
if ( typeof cldr.get( "supplemental/likelySubtags" ) === "undefined" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// [2]
|
||||
matchFound = arraySome([
|
||||
[ language, script, territory ],
|
||||
[ language, territory ],
|
||||
[ language, script ],
|
||||
[ language ],
|
||||
[ "und", script ]
|
||||
], function( test ) {
|
||||
return match = !(/\b(Zzzz|ZZ)\b/).test( test.join( sep ) ) /* [1.4] */ && cldr.get( [ "supplemental/likelySubtags", test.join( sep ) ] );
|
||||
});
|
||||
|
||||
// [3]
|
||||
if ( matchFound ) {
|
||||
// [3.2 .. 3.4]
|
||||
match = match.split( sep );
|
||||
return [
|
||||
language !== "und" ? language : match[ 0 ],
|
||||
script !== "Zzzz" ? script : match[ 1 ],
|
||||
territory !== "ZZ" ? territory : match[ 2 ]
|
||||
].concat( variants );
|
||||
} else if ( options.force ) {
|
||||
// [3.1.2]
|
||||
return cldr.get( "supplemental/likelySubtags/und" ).split( sep );
|
||||
} else {
|
||||
// [3.1.1]
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a locale, remove any fields that Add Likely Subtags would add.
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. First get max = AddLikelySubtags(inputLocale). If an error is signaled,
|
||||
* return it.
|
||||
* 2. Remove the variants from max.
|
||||
* 3. Then for trial in {language, language _ region, language _ script}. If
|
||||
* AddLikelySubtags(trial) = max, then return trial + variants.
|
||||
* 4. If you do not get a match, return max + variants.
|
||||
*
|
||||
* @maxLanguageId [Array] maxLanguageId tuple (see init.js).
|
||||
*/
|
||||
var coreRemoveLikelySubtags = function( Cldr, cldr, maxLanguageId ) {
|
||||
var match, matchFound,
|
||||
language = maxLanguageId[ 0 ],
|
||||
script = maxLanguageId[ 1 ],
|
||||
territory = maxLanguageId[ 2 ],
|
||||
variants = maxLanguageId[ 3 ];
|
||||
|
||||
// [3]
|
||||
matchFound = arraySome([
|
||||
[ [ language, "Zzzz", "ZZ" ], [ language ] ],
|
||||
[ [ language, "Zzzz", territory ], [ language, territory ] ],
|
||||
[ [ language, script, "ZZ" ], [ language, script ] ]
|
||||
], function( test ) {
|
||||
var result = coreLikelySubtags( Cldr, cldr, test[ 0 ] );
|
||||
match = test[ 1 ];
|
||||
return result && result[ 0 ] === maxLanguageId[ 0 ] &&
|
||||
result[ 1 ] === maxLanguageId[ 1 ] &&
|
||||
result[ 2 ] === maxLanguageId[ 2 ];
|
||||
});
|
||||
|
||||
if ( matchFound ) {
|
||||
if ( variants ) {
|
||||
match.push( variants );
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
// [4]
|
||||
return maxLanguageId;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* subtags( locale )
|
||||
*
|
||||
* @locale [String]
|
||||
*/
|
||||
var coreSubtags = function( locale ) {
|
||||
var aux, unicodeLanguageId,
|
||||
subtags = [];
|
||||
|
||||
locale = locale.replace( /_/, "-" );
|
||||
|
||||
// Unicode locale extensions.
|
||||
aux = locale.split( "-u-" );
|
||||
if ( aux[ 1 ] ) {
|
||||
aux[ 1 ] = aux[ 1 ].split( "-t-" );
|
||||
locale = aux[ 0 ] + ( aux[ 1 ][ 1 ] ? "-t-" + aux[ 1 ][ 1 ] : "");
|
||||
subtags[ 4 /* unicodeLocaleExtensions */ ] = aux[ 1 ][ 0 ];
|
||||
}
|
||||
|
||||
// TODO normalize transformed extensions. Currently, skipped.
|
||||
// subtags[ x ] = locale.split( "-t-" )[ 1 ];
|
||||
unicodeLanguageId = locale.split( "-t-" )[ 0 ];
|
||||
|
||||
// unicode_language_id = "root"
|
||||
// | unicode_language_subtag
|
||||
// (sep unicode_script_subtag)?
|
||||
// (sep unicode_region_subtag)?
|
||||
// (sep unicode_variant_subtag)* ;
|
||||
//
|
||||
// Although unicode_language_subtag = alpha{2,8}, I'm using alpha{2,3}. Because, there's no language on CLDR lengthier than 3.
|
||||
aux = unicodeLanguageId.match( /^(([a-z]{2,3})(-([A-Z][a-z]{3}))?(-([A-Z]{2}|[0-9]{3}))?)((-([a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3}))*)$|^(root)$/ );
|
||||
if ( aux === null ) {
|
||||
return [ "und", "Zzzz", "ZZ" ];
|
||||
}
|
||||
subtags[ 0 /* language */ ] = aux[ 10 ] /* root */ || aux[ 2 ] || "und";
|
||||
subtags[ 1 /* script */ ] = aux[ 4 ] || "Zzzz";
|
||||
subtags[ 2 /* territory */ ] = aux[ 6 ] || "ZZ";
|
||||
if ( aux[ 7 ] && aux[ 7 ].length ) {
|
||||
subtags[ 3 /* variant */ ] = aux[ 7 ].slice( 1 ) /* remove leading "-" */;
|
||||
}
|
||||
|
||||
// 0: language
|
||||
// 1: script
|
||||
// 2: territory (aka region)
|
||||
// 3: variant
|
||||
// 4: unicodeLocaleExtensions
|
||||
return subtags;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var arrayForEach = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.forEach ) {
|
||||
return array.forEach( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
callback( array[ i ], i, array );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* bundleLookup( minLanguageId )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @cldr [Cldr instance]
|
||||
*
|
||||
* @minLanguageId [String] requested languageId after applied remove likely subtags.
|
||||
*/
|
||||
var bundleLookup = function( Cldr, cldr, minLanguageId ) {
|
||||
var availableBundleMap = Cldr._availableBundleMap,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue;
|
||||
|
||||
if ( availableBundleMapQueue.length ) {
|
||||
arrayForEach( availableBundleMapQueue, function( bundle, i ) {
|
||||
var existing, maxBundle, minBundle, subtags;
|
||||
subtags = coreSubtags( bundle );
|
||||
maxBundle = coreLikelySubtags( Cldr, cldr, subtags );
|
||||
if ( maxBundle === undefined ) {
|
||||
availableBundleMapQueue.splice( i, 1 );
|
||||
throw new Error( "Could not find likelySubtags for " + bundle );
|
||||
}
|
||||
minBundle = coreRemoveLikelySubtags( Cldr, cldr, maxBundle );
|
||||
minBundle = minBundle.join( Cldr.localeSep );
|
||||
existing = availableBundleMap[ minBundle ];
|
||||
if ( existing && existing.length < bundle.length ) {
|
||||
return;
|
||||
}
|
||||
availableBundleMap[ minBundle ] = bundle;
|
||||
});
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
}
|
||||
|
||||
return availableBundleMap[ minLanguageId ] || null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var objectKeys = function( object ) {
|
||||
var i,
|
||||
result = [];
|
||||
|
||||
if ( Object.keys ) {
|
||||
return Object.keys( object );
|
||||
}
|
||||
|
||||
for ( i in object ) {
|
||||
result.push( i );
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var createError = function( code, attributes ) {
|
||||
var error, message;
|
||||
|
||||
message = code + ( attributes && JSON ? ": " + JSON.stringify( attributes ) : "" );
|
||||
error = new Error( message );
|
||||
error.code = code;
|
||||
|
||||
// extend( error, attributes );
|
||||
arrayForEach( objectKeys( attributes ), function( attribute ) {
|
||||
error[ attribute ] = attributes[ attribute ];
|
||||
});
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validate = function( code, check, attributes ) {
|
||||
if ( !check ) {
|
||||
throw createError( code, attributes );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validatePresence = function( value, name ) {
|
||||
validate( "E_MISSING_PARAMETER", typeof value !== "undefined", {
|
||||
name: name
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateType = function( value, name, check, expected ) {
|
||||
validate( "E_INVALID_PAR_TYPE", check, {
|
||||
expected: expected,
|
||||
name: name,
|
||||
value: value
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateTypePath = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || arrayIsArray( value ), "String or Array" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function inspired by jQuery Core, but reduced to our use case.
|
||||
*/
|
||||
var isPlainObject = function( obj ) {
|
||||
return obj !== null && "" + obj === "[object Object]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateTypePlainObject = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || isPlainObject( value ), "Plain Object" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateTypeString = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string", "a string" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceGet = function( data, path ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
node = node[ path[ i ] ];
|
||||
if ( !node ) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return node[ path[ i ] ];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* setAvailableBundles( Cldr, json )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @json resolved/unresolved cldr data.
|
||||
*
|
||||
* Set available bundles queue based on passed json CLDR data. Considers a bundle as any String at /main/{bundle}.
|
||||
*/
|
||||
var coreSetAvailableBundles = function( Cldr, json ) {
|
||||
var bundle,
|
||||
availableBundleMapQueue = Cldr._availableBundleMapQueue,
|
||||
main = resourceGet( json, [ "main" ] );
|
||||
|
||||
if ( main ) {
|
||||
for ( bundle in main ) {
|
||||
if ( main.hasOwnProperty( bundle ) && bundle !== "root" &&
|
||||
availableBundleMapQueue.indexOf( bundle ) === -1 ) {
|
||||
availableBundleMapQueue.push( bundle );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var alwaysArray = function( somethingOrArray ) {
|
||||
return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
|
||||
};
|
||||
|
||||
|
||||
var jsonMerge = (function() {
|
||||
|
||||
// Returns new deeply merged JSON.
|
||||
//
|
||||
// Eg.
|
||||
// merge( { a: { b: 1, c: 2 } }, { a: { b: 3, d: 4 } } )
|
||||
// -> { a: { b: 3, c: 2, d: 4 } }
|
||||
//
|
||||
// @arguments JSON's
|
||||
//
|
||||
var merge = function() {
|
||||
var destination = {},
|
||||
sources = [].slice.call( arguments, 0 );
|
||||
arrayForEach( sources, function( source ) {
|
||||
var prop;
|
||||
for ( prop in source ) {
|
||||
if ( prop in destination && typeof destination[ prop ] === "object" && !arrayIsArray( destination[ prop ] ) ) {
|
||||
|
||||
// Merge Objects
|
||||
destination[ prop ] = merge( destination[ prop ], source[ prop ] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set new values
|
||||
destination[ prop ] = source[ prop ];
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return destination;
|
||||
};
|
||||
|
||||
return merge;
|
||||
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* load( Cldr, source, jsons )
|
||||
*
|
||||
* @Cldr [Cldr class]
|
||||
*
|
||||
* @source [Object]
|
||||
*
|
||||
* @jsons [arguments]
|
||||
*/
|
||||
var coreLoad = function( Cldr, source, jsons ) {
|
||||
var i, j, json;
|
||||
|
||||
validatePresence( jsons[ 0 ], "json" );
|
||||
|
||||
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
|
||||
for ( i = 0; i < jsons.length; i++ ) {
|
||||
|
||||
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
|
||||
json = alwaysArray( jsons[ i ] );
|
||||
|
||||
for ( j = 0; j < json.length; j++ ) {
|
||||
validateTypePlainObject( json[ j ], "json" );
|
||||
source = jsonMerge( source, json[ j ] );
|
||||
coreSetAvailableBundles( Cldr, json[ j ] );
|
||||
}
|
||||
}
|
||||
|
||||
return source;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var itemGetResolved = function( Cldr, path, attributes ) {
|
||||
// Resolve path
|
||||
var normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
return resourceGet( Cldr._resolved, normalizedPath );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* new Cldr()
|
||||
*/
|
||||
var Cldr = function( locale ) {
|
||||
this.init( locale );
|
||||
};
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
Cldr._alwaysArray = alwaysArray;
|
||||
Cldr._coreLoad = coreLoad;
|
||||
Cldr._createError = createError;
|
||||
Cldr._itemGetResolved = itemGetResolved;
|
||||
Cldr._jsonMerge = jsonMerge;
|
||||
Cldr._pathNormalize = pathNormalize;
|
||||
Cldr._resourceGet = resourceGet;
|
||||
Cldr._validatePresence = validatePresence;
|
||||
Cldr._validateType = validateType;
|
||||
Cldr._validateTypePath = validateTypePath;
|
||||
Cldr._validateTypePlainObject = validateTypePlainObject;
|
||||
|
||||
Cldr._availableBundleMap = {};
|
||||
Cldr._availableBundleMapQueue = [];
|
||||
Cldr._resolved = {};
|
||||
|
||||
// Allow user to override locale separator "-" (default) | "_". According to http://www.unicode.org/reports/tr35/#Unicode_language_identifier, both "-" and "_" are valid locale separators (eg. "en_GB", "en-GB"). According to http://unicode.org/cldr/trac/ticket/6786 its usage must be consistent throughout the data set.
|
||||
Cldr.localeSep = "-";
|
||||
|
||||
/**
|
||||
* Cldr.load( json [, json, ...] )
|
||||
*
|
||||
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||||
*
|
||||
* Load resolved cldr data.
|
||||
*/
|
||||
Cldr.load = function() {
|
||||
Cldr._resolved = coreLoad( Cldr, Cldr._resolved, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* .init() automatically run on instantiation/construction.
|
||||
*/
|
||||
Cldr.prototype.init = function( locale ) {
|
||||
var attributes, language, maxLanguageId, minLanguageId, script, subtags, territory, unicodeLocaleExtensions, variant,
|
||||
sep = Cldr.localeSep,
|
||||
unicodeLocaleExtensionsRaw = "";
|
||||
|
||||
validatePresence( locale, "locale" );
|
||||
validateTypeString( locale, "locale" );
|
||||
|
||||
subtags = coreSubtags( locale );
|
||||
|
||||
if ( subtags.length === 5 ) {
|
||||
unicodeLocaleExtensions = subtags.pop();
|
||||
unicodeLocaleExtensionsRaw = sep + "u" + sep + unicodeLocaleExtensions;
|
||||
// Remove trailing null when there is unicodeLocaleExtensions but no variants.
|
||||
if ( !subtags[ 3 ] ) {
|
||||
subtags.pop();
|
||||
}
|
||||
}
|
||||
variant = subtags[ 3 ];
|
||||
|
||||
// Normalize locale code.
|
||||
// Get (or deduce) the "triple subtags": language, territory (also aliased as region), and script subtags.
|
||||
// Get the variant subtags (calendar, collation, currency, etc).
|
||||
// refs:
|
||||
// - http://www.unicode.org/reports/tr35/#Field_Definitions
|
||||
// - http://www.unicode.org/reports/tr35/#Language_and_Locale_IDs
|
||||
// - http://www.unicode.org/reports/tr35/#Unicode_locale_identifier
|
||||
|
||||
// When a locale id does not specify a language, or territory (region), or script, they are obtained by Likely Subtags.
|
||||
maxLanguageId = coreLikelySubtags( Cldr, this, subtags, { force: true } ) || subtags;
|
||||
language = maxLanguageId[ 0 ];
|
||||
script = maxLanguageId[ 1 ];
|
||||
territory = maxLanguageId[ 2 ];
|
||||
|
||||
minLanguageId = coreRemoveLikelySubtags( Cldr, this, maxLanguageId ).join( sep );
|
||||
|
||||
// Set attributes
|
||||
this.attributes = attributes = {
|
||||
bundle: bundleLookup( Cldr, this, minLanguageId ),
|
||||
|
||||
// Unicode Language Id
|
||||
minLanguageId: minLanguageId + unicodeLocaleExtensionsRaw,
|
||||
maxLanguageId: maxLanguageId.join( sep ) + unicodeLocaleExtensionsRaw,
|
||||
|
||||
// Unicode Language Id Subtabs
|
||||
language: language,
|
||||
script: script,
|
||||
territory: territory,
|
||||
region: territory, /* alias */
|
||||
variant: variant
|
||||
};
|
||||
|
||||
// Unicode locale extensions.
|
||||
unicodeLocaleExtensions && ( "-" + unicodeLocaleExtensions ).replace( /-[a-z]{3,8}|(-[a-z]{2})-([a-z]{3,8})/g, function( attribute, key, type ) {
|
||||
|
||||
if ( key ) {
|
||||
|
||||
// Extension is in the `keyword` form.
|
||||
attributes[ "u" + key ] = type;
|
||||
} else {
|
||||
|
||||
// Extension is in the `attribute` form.
|
||||
attributes[ "u" + attribute ] = true;
|
||||
}
|
||||
});
|
||||
|
||||
this.locale = locale;
|
||||
};
|
||||
|
||||
/**
|
||||
* .get()
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
return itemGetResolved( Cldr, path, this.attributes );
|
||||
};
|
||||
|
||||
/**
|
||||
* .main()
|
||||
*/
|
||||
Cldr.prototype.main = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
validate( "E_MISSING_BUNDLE", this.attributes.bundle !== null, {
|
||||
locale: this.locale
|
||||
});
|
||||
|
||||
path = alwaysArray( path );
|
||||
return this.get( [ "main/{bundle}" ].concat( path ) );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
585
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr/event.js
vendored
Normal file
585
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr/event.js
vendored
Normal file
@@ -0,0 +1,585 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.5.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2020-10-22T15:56Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.5.4 2020-10-22T15:56Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var pathNormalize = Cldr._pathNormalize,
|
||||
validatePresence = Cldr._validatePresence,
|
||||
validateType = Cldr._validateType;
|
||||
|
||||
/*!
|
||||
* EventEmitter v4.2.7 - git.io/ee
|
||||
* Oliver Caldwell
|
||||
* MIT license
|
||||
* @preserve
|
||||
*/
|
||||
|
||||
var EventEmitter;
|
||||
/* jshint ignore:start */
|
||||
EventEmitter = (function () {
|
||||
|
||||
|
||||
/**
|
||||
* Class for managing events.
|
||||
* Can be extended to provide event functionality in other classes.
|
||||
*
|
||||
* @class EventEmitter Manages event registering and emitting.
|
||||
*/
|
||||
function EventEmitter() {}
|
||||
|
||||
// Shortcuts to improve speed and size
|
||||
var proto = EventEmitter.prototype;
|
||||
var exports = {};
|
||||
|
||||
|
||||
/**
|
||||
* Finds the index of the listener for the event in it's storage array.
|
||||
*
|
||||
* @param {Function[]} listeners Array of listeners to search through.
|
||||
* @param {Function} listener Method to look for.
|
||||
* @return {Number} Index of the specified listener, -1 if not found
|
||||
* @api private
|
||||
*/
|
||||
function indexOfListener(listeners, listener) {
|
||||
var i = listeners.length;
|
||||
while (i--) {
|
||||
if (listeners[i].listener === listener) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias a method while keeping the context correct, to allow for overwriting of target method.
|
||||
*
|
||||
* @param {String} name The name of the target method.
|
||||
* @return {Function} The aliased method
|
||||
* @api private
|
||||
*/
|
||||
function alias(name) {
|
||||
return function aliasClosure() {
|
||||
return this[name].apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the listener array for the specified event.
|
||||
* Will initialise the event object and listener arrays if required.
|
||||
* Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
|
||||
* Each property in the object response is an array of listener functions.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
||||
* @return {Function[]|Object} All listener functions for the event.
|
||||
*/
|
||||
proto.getListeners = function getListeners(evt) {
|
||||
var events = this._getEvents();
|
||||
var response;
|
||||
var key;
|
||||
|
||||
// Return a concatenated array of all matching events if
|
||||
// the selector is a regular expression.
|
||||
if (evt instanceof RegExp) {
|
||||
response = {};
|
||||
for (key in events) {
|
||||
if (events.hasOwnProperty(key) && evt.test(key)) {
|
||||
response[key] = events[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
response = events[evt] || (events[evt] = []);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a list of listener objects and flattens it into a list of listener functions.
|
||||
*
|
||||
* @param {Object[]} listeners Raw listener objects.
|
||||
* @return {Function[]} Just the listener functions.
|
||||
*/
|
||||
proto.flattenListeners = function flattenListeners(listeners) {
|
||||
var flatListeners = [];
|
||||
var i;
|
||||
|
||||
for (i = 0; i < listeners.length; i += 1) {
|
||||
flatListeners.push(listeners[i].listener);
|
||||
}
|
||||
|
||||
return flatListeners;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
||||
* @return {Object} All listener functions for an event in an object.
|
||||
*/
|
||||
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
||||
var listeners = this.getListeners(evt);
|
||||
var response;
|
||||
|
||||
if (listeners instanceof Array) {
|
||||
response = {};
|
||||
response[evt] = listeners;
|
||||
}
|
||||
|
||||
return response || listeners;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a listener function to the specified event.
|
||||
* The listener will not be added if it is a duplicate.
|
||||
* If the listener returns true then it will be removed after it is called.
|
||||
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
||||
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addListener = function addListener(evt, listener) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var listenerIsWrapped = typeof listener === 'object';
|
||||
var key;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
||||
listeners[key].push(listenerIsWrapped ? listener : {
|
||||
listener: listener,
|
||||
once: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of addListener
|
||||
*/
|
||||
proto.on = alias('addListener');
|
||||
|
||||
/**
|
||||
* Semi-alias of addListener. It will add a listener that will be
|
||||
* automatically removed after it's first execution.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
||||
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addOnceListener = function addOnceListener(evt, listener) {
|
||||
return this.addListener(evt, {
|
||||
listener: listener,
|
||||
once: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of addOnceListener.
|
||||
*/
|
||||
proto.once = alias('addOnceListener');
|
||||
|
||||
/**
|
||||
* Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
|
||||
* You need to tell it what event names should be matched by a regex.
|
||||
*
|
||||
* @param {String} evt Name of the event to create.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.defineEvent = function defineEvent(evt) {
|
||||
this.getListeners(evt);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Uses defineEvent to define multiple events.
|
||||
*
|
||||
* @param {String[]} evts An array of event names to define.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.defineEvents = function defineEvents(evts) {
|
||||
for (var i = 0; i < evts.length; i += 1) {
|
||||
this.defineEvent(evts[i]);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a listener function from the specified event.
|
||||
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
||||
* @param {Function} listener Method to remove from the event.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeListener = function removeListener(evt, listener) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var index;
|
||||
var key;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key)) {
|
||||
index = indexOfListener(listeners[key], listener);
|
||||
|
||||
if (index !== -1) {
|
||||
listeners[key].splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of removeListener
|
||||
*/
|
||||
proto.off = alias('removeListener');
|
||||
|
||||
/**
|
||||
* Adds listeners in bulk using the manipulateListeners method.
|
||||
* If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
|
||||
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
||||
* Yeah, this function does quite a bit. That's probably a bad thing.
|
||||
*
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addListeners = function addListeners(evt, listeners) {
|
||||
// Pass through to manipulateListeners
|
||||
return this.manipulateListeners(false, evt, listeners);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes listeners in bulk using the manipulateListeners method.
|
||||
* If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
||||
* You can also pass it an event name and an array of listeners to be removed.
|
||||
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
||||
*
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to remove.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeListeners = function removeListeners(evt, listeners) {
|
||||
// Pass through to manipulateListeners
|
||||
return this.manipulateListeners(true, evt, listeners);
|
||||
};
|
||||
|
||||
/**
|
||||
* Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
|
||||
* The first argument will determine if the listeners are removed (true) or added (false).
|
||||
* If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
||||
* You can also pass it an event name and an array of listeners to be added/removed.
|
||||
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
||||
*
|
||||
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
||||
var i;
|
||||
var value;
|
||||
var single = remove ? this.removeListener : this.addListener;
|
||||
var multiple = remove ? this.removeListeners : this.addListeners;
|
||||
|
||||
// If evt is an object then pass each of it's properties to this method
|
||||
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
|
||||
for (i in evt) {
|
||||
if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
||||
// Pass the single listener straight through to the singular method
|
||||
if (typeof value === 'function') {
|
||||
single.call(this, i, value);
|
||||
}
|
||||
else {
|
||||
// Otherwise pass back to the multiple function
|
||||
multiple.call(this, i, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// So evt must be a string
|
||||
// And listeners must be an array of listeners
|
||||
// Loop over it and pass each one to the multiple method
|
||||
i = listeners.length;
|
||||
while (i--) {
|
||||
single.call(this, evt, listeners[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all listeners from a specified event.
|
||||
* If you do not specify an event then all listeners will be removed.
|
||||
* That means every event will be emptied.
|
||||
* You can also pass a regex to remove all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeEvent = function removeEvent(evt) {
|
||||
var type = typeof evt;
|
||||
var events = this._getEvents();
|
||||
var key;
|
||||
|
||||
// Remove different things depending on the state of evt
|
||||
if (type === 'string') {
|
||||
// Remove all listeners for the specified event
|
||||
delete events[evt];
|
||||
}
|
||||
else if (evt instanceof RegExp) {
|
||||
// Remove all events matching the regex.
|
||||
for (key in events) {
|
||||
if (events.hasOwnProperty(key) && evt.test(key)) {
|
||||
delete events[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Remove all listeners in all events
|
||||
delete this._events;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of removeEvent.
|
||||
*
|
||||
* Added to mirror the node API.
|
||||
*/
|
||||
proto.removeAllListeners = alias('removeEvent');
|
||||
|
||||
/**
|
||||
* Emits an event of your choice.
|
||||
* When emitted, every listener attached to that event will be executed.
|
||||
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
||||
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
||||
* So they will not arrive within the array on the other side, they will be separate.
|
||||
* You can also pass a regular expression to emit to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
||||
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.emitEvent = function emitEvent(evt, args) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var listener;
|
||||
var i;
|
||||
var key;
|
||||
var response;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key)) {
|
||||
i = listeners[key].length;
|
||||
|
||||
while (i--) {
|
||||
// If the listener returns true then it shall be removed from the event
|
||||
// The function is executed either with a basic call or an apply if there is an args array
|
||||
listener = listeners[key][i];
|
||||
|
||||
if (listener.once === true) {
|
||||
this.removeListener(evt, listener.listener);
|
||||
}
|
||||
|
||||
response = listener.listener.apply(this, args || []);
|
||||
|
||||
if (response === this._getOnceReturnValue()) {
|
||||
this.removeListener(evt, listener.listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of emitEvent
|
||||
*/
|
||||
proto.trigger = alias('emitEvent');
|
||||
|
||||
/**
|
||||
* Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
|
||||
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
||||
* @param {...*} Optional additional arguments to be passed to each listener.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.emit = function emit(evt) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return this.emitEvent(evt, args);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current value to check against when executing listeners. If a
|
||||
* listeners return value matches the one set here then it will be removed
|
||||
* after execution. This value defaults to true.
|
||||
*
|
||||
* @param {*} value The new value to check for when executing listeners.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
||||
this._onceReturnValue = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the current value to check against when executing listeners. If
|
||||
* the listeners return value matches this one then it should be removed
|
||||
* automatically. It will return true by default.
|
||||
*
|
||||
* @return {*|Boolean} The current value to check for or the default, true.
|
||||
* @api private
|
||||
*/
|
||||
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
||||
if (this.hasOwnProperty('_onceReturnValue')) {
|
||||
return this._onceReturnValue;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the events object and creates one if required.
|
||||
*
|
||||
* @return {Object} The events storage object.
|
||||
* @api private
|
||||
*/
|
||||
proto._getEvents = function _getEvents() {
|
||||
return this._events || (this._events = {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
|
||||
*
|
||||
* @return {Function} Non conflicting EventEmitter class.
|
||||
*/
|
||||
EventEmitter.noConflict = function noConflict() {
|
||||
exports.EventEmitter = originalGlobalValue;
|
||||
return EventEmitter;
|
||||
};
|
||||
|
||||
return EventEmitter;
|
||||
}());
|
||||
/* jshint ignore:end */
|
||||
|
||||
|
||||
|
||||
var validateTypeFunction = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || typeof value === "function", "Function" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var superGet, superInit,
|
||||
globalEe = new EventEmitter();
|
||||
|
||||
function validateTypeEvent( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || value instanceof RegExp, "String or RegExp" );
|
||||
}
|
||||
|
||||
function validateThenCall( method, self ) {
|
||||
return function( event, listener ) {
|
||||
validatePresence( event, "event" );
|
||||
validateTypeEvent( event, "event" );
|
||||
|
||||
validatePresence( listener, "listener" );
|
||||
validateTypeFunction( listener, "listener" );
|
||||
|
||||
return self[ method ].apply( self, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
function off( self ) {
|
||||
return validateThenCall( "off", self );
|
||||
}
|
||||
|
||||
function on( self ) {
|
||||
return validateThenCall( "on", self );
|
||||
}
|
||||
|
||||
function once( self ) {
|
||||
return validateThenCall( "once", self );
|
||||
}
|
||||
|
||||
Cldr.off = off( globalEe );
|
||||
Cldr.on = on( globalEe );
|
||||
Cldr.once = once( globalEe );
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.init().
|
||||
*/
|
||||
superInit = Cldr.prototype.init;
|
||||
Cldr.prototype.init = function() {
|
||||
var ee;
|
||||
this.ee = ee = new EventEmitter();
|
||||
this.off = off( ee );
|
||||
this.on = on( ee );
|
||||
this.once = once( ee );
|
||||
superInit.apply( this, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* getOverload is encapsulated, because of cldr/unresolved. If it's loaded
|
||||
* after cldr/event (and note it overwrites .get), it can trigger this
|
||||
* overload again.
|
||||
*/
|
||||
function getOverload() {
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.get().
|
||||
*/
|
||||
superGet = Cldr.prototype.get;
|
||||
Cldr.prototype.get = function( path ) {
|
||||
var value = superGet.apply( this, arguments );
|
||||
path = pathNormalize( path, this.attributes ).join( "/" );
|
||||
globalEe.trigger( "get", [ path, value ] );
|
||||
this.ee.trigger( "get", [ path, value ] );
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
Cldr._eventInit = getOverload;
|
||||
getOverload();
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
101
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr/supplemental.js
vendored
Normal file
101
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr/supplemental.js
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.5.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2020-10-22T15:56Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.5.4 2020-10-22T15:56Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var alwaysArray = Cldr._alwaysArray;
|
||||
|
||||
|
||||
|
||||
var supplementalMain = function( cldr ) {
|
||||
|
||||
var prepend, supplemental;
|
||||
|
||||
prepend = function( prepend ) {
|
||||
return function( path ) {
|
||||
path = alwaysArray( path );
|
||||
return cldr.get( [ prepend ].concat( path ) );
|
||||
};
|
||||
};
|
||||
|
||||
supplemental = prepend( "supplemental" );
|
||||
|
||||
// Week Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Week_Data
|
||||
supplemental.weekData = prepend( "supplemental/weekData" );
|
||||
|
||||
supplemental.weekData.firstDay = function() {
|
||||
return cldr.get( "supplemental/weekData/firstDay/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/firstDay/001" );
|
||||
};
|
||||
|
||||
supplemental.weekData.minDays = function() {
|
||||
var minDays = cldr.get( "supplemental/weekData/minDays/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/minDays/001" );
|
||||
return parseInt( minDays, 10 );
|
||||
};
|
||||
|
||||
// Time Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
|
||||
supplemental.timeData = prepend( "supplemental/timeData" );
|
||||
|
||||
supplemental.timeData.allowed = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_allowed" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_allowed" );
|
||||
};
|
||||
|
||||
supplemental.timeData.preferred = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_preferred" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_preferred" );
|
||||
};
|
||||
|
||||
return supplemental;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var initSuper = Cldr.prototype.init;
|
||||
|
||||
/**
|
||||
* .init() automatically ran on construction.
|
||||
*
|
||||
* Overload .init().
|
||||
*/
|
||||
Cldr.prototype.init = function() {
|
||||
initSuper.apply( this, arguments );
|
||||
this.supplemental = supplementalMain( this );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
164
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr/unresolved.js
vendored
Normal file
164
EveryThing/wwwroot/vendor/libs/cldrjs/dist/cldr/unresolved.js
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.5.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2020-10-22T15:56Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.5.4 2020-10-22T15:56Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "../cldr" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var coreLoad = Cldr._coreLoad;
|
||||
var jsonMerge = Cldr._jsonMerge;
|
||||
var pathNormalize = Cldr._pathNormalize;
|
||||
var resourceGet = Cldr._resourceGet;
|
||||
var validatePresence = Cldr._validatePresence;
|
||||
var validateTypePath = Cldr._validateTypePath;
|
||||
|
||||
|
||||
|
||||
var bundleParentLookup = function( Cldr, locale ) {
|
||||
var normalizedPath, parent;
|
||||
|
||||
if ( locale === "root" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First, try to find parent on supplemental data.
|
||||
normalizedPath = pathNormalize( [ "supplemental/parentLocales/parentLocale", locale ] );
|
||||
parent = resourceGet( Cldr._resolved, normalizedPath ) || resourceGet( Cldr._raw, normalizedPath );
|
||||
if ( parent ) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
// Or truncate locale.
|
||||
parent = locale.substr( 0, locale.lastIndexOf( Cldr.localeSep ) );
|
||||
if ( !parent ) {
|
||||
return "root";
|
||||
}
|
||||
|
||||
return parent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceSet = function( data, path, value ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
if ( !node[ path[ i ] ] ) {
|
||||
node[ path[ i ] ] = {};
|
||||
}
|
||||
node = node[ path[ i ] ];
|
||||
}
|
||||
node[ path[ i ] ] = value;
|
||||
};
|
||||
|
||||
|
||||
var itemLookup = (function() {
|
||||
|
||||
var lookup;
|
||||
|
||||
lookup = function( Cldr, locale, path, attributes, childLocale ) {
|
||||
var normalizedPath, parent, value;
|
||||
|
||||
// 1: Finish recursion
|
||||
// 2: Avoid infinite loop
|
||||
if ( typeof locale === "undefined" /* 1 */ || locale === childLocale /* 2 */ ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve path
|
||||
normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
// Check resolved (cached) data first
|
||||
// 1: Due to #16, never use the cached resolved non-leaf nodes. It may not
|
||||
// represent its leafs in its entirety.
|
||||
value = resourceGet( Cldr._resolved, normalizedPath );
|
||||
if ( value !== undefined && typeof value !== "object" /* 1 */ ) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Check raw data
|
||||
value = resourceGet( Cldr._raw, normalizedPath );
|
||||
|
||||
if ( value === undefined ) {
|
||||
// Or, lookup at parent locale
|
||||
parent = bundleParentLookup( Cldr, locale );
|
||||
value = lookup( Cldr, parent, path, jsonMerge( attributes, { bundle: parent }), locale );
|
||||
}
|
||||
|
||||
if ( value !== undefined ) {
|
||||
// Set resolved (cached)
|
||||
resourceSet( Cldr._resolved, normalizedPath, value );
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
return lookup;
|
||||
|
||||
}());
|
||||
|
||||
|
||||
Cldr._raw = {};
|
||||
|
||||
/**
|
||||
* Cldr.load( json [, json, ...] )
|
||||
*
|
||||
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||||
*
|
||||
* Load resolved or unresolved cldr data.
|
||||
* Overwrite Cldr.load().
|
||||
*/
|
||||
Cldr.load = function() {
|
||||
Cldr._raw = coreLoad( Cldr, Cldr._raw, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* Overwrite Cldr.prototype.get().
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
// 1: use bundle as locale on item lookup for simplification purposes, because no other extended subtag is used anyway on bundle parent lookup.
|
||||
// 2: during init(), this method is called, but bundle is yet not defined. Use "" as a workaround in this very specific scenario.
|
||||
return itemLookup( Cldr, this.attributes && this.attributes.bundle /* 1 */ || "" /* 2 */, path, this.attributes );
|
||||
};
|
||||
|
||||
// In case cldr/unresolved is loaded after cldr/event, we trigger its overloads again. Because, .get is overwritten in here.
|
||||
if ( Cldr._eventInit ) {
|
||||
Cldr._eventInit();
|
||||
}
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
22
EveryThing/wwwroot/vendor/libs/cldrjs/dist/node_main.js
vendored
Normal file
22
EveryThing/wwwroot/vendor/libs/cldrjs/dist/node_main.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.5.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2020-10-22T15:56Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.5.4 2020-10-22T15:56Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
|
||||
// Cldr
|
||||
module.exports = require( "./cldr" );
|
||||
|
||||
// Extent Cldr with the following modules
|
||||
require( "./cldr/event" );
|
||||
require( "./cldr/supplemental" );
|
||||
require( "./cldr/unresolved" );
|
||||
15
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/attributes.md
vendored
Normal file
15
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/attributes.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
## .attributes
|
||||
|
||||
Attributes is an Object created during instance initialization (construction), and are used internally by `.get()` to replace dynamic parts of an item path.
|
||||
|
||||
| Attribute | Field |
|
||||
| --- | --- |
|
||||
| `language` | Language Subtag ([spec](http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions)) |
|
||||
| `script` | Script Subtag ([spec](http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions)) |
|
||||
| `region` or `territory` | Region Subtag ([spec](http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions)) |
|
||||
| `languageId` | Language Id ([spec](http://www.unicode.org/reports/tr35/#Unicode_language_identifier)) |
|
||||
| `maxLanguageId` | Maximized Language Id ([spec](http://www.unicode.org/reports/tr35/#Likely_Subtags)) |
|
||||
|
||||
- `language`, `script`, `territory` (also aliased as `region`), and `maxLanguageId` are computed by [adding likely subtags](./src/likely-subtags.js) according to the [specification](http://www.unicode.org/reports/tr35/#Likely_Subtags).
|
||||
- `languageId` is always in the succint form, obtained by [removing the likely subtags from `maxLanguageId`](./src/remove-likely-subtags.js) according to the [specification](http://www.unicode.org/reports/tr35/#Likely_Subtags).
|
||||
|
||||
9
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/constructor.md
vendored
Normal file
9
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/constructor.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
## new Cldr( locale )
|
||||
|
||||
Create a new instance of Cldr.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *locale* | String | `"en"`, `"pt-BR"` |
|
||||
|
||||
More information in the [specification](http://www.unicode.org/reports/tr35/#Locale).
|
||||
18
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/get.md
vendored
Normal file
18
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/get.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
## .get( path )
|
||||
|
||||
Get the item data given its path, or `undefined` if missing.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *path* | String or<br>Array | `"/cldr/main/{languageId}/numbers/symbols-numberSystem-latn/decimal"`<br>`[ "cldr", "main", "{languageId}", "numbers", "symbols-numberSystem-latn", "decimal" ]` |
|
||||
|
||||
On *path* parameter, note the leading "/cldr" can be ommited. Also, note that its Array form accepts subpaths, eg. `[ "cldr/main", "{languageId}", "numbers/symbols-numberSystem-latn/"decimal" ]`.
|
||||
|
||||
The [locale attributes](#cldrattributes), eg. `{languageId}`, are replaced with their appropriate values.
|
||||
|
||||
If extended with the `cldr/unresolved.js` module, get the item data or lookup by following [locale inheritance](http://www.unicode.org/reports/tr35/#Locale_Inheritance), set a local resolved cache if it's found (for subsequent faster access), or return `undefined`.
|
||||
|
||||
```javascript
|
||||
ptBr.get( "main/{languageId}/numbers/symbols-numberSystem-latn/decimal" );
|
||||
// ➡ ","
|
||||
```
|
||||
23
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/load.md
vendored
Normal file
23
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/load.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Cldr.load( json, ... )
|
||||
|
||||
Load resolved or unresolved [1] JSON data.
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| *json* | Object | Resolved or unresolved [1] CLDR JSON data |
|
||||
|
||||
```javascript
|
||||
Cldr.load({
|
||||
"main": {
|
||||
"pt-BR": {
|
||||
"numbers": {
|
||||
"symbols-numberSystem-latn": {
|
||||
"decimal": ","
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
1: Unresolved processing is **only available** after loading `cldr/unresolved.js` extension module.
|
||||
12
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/main.md
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/core/main.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
## .main( path )
|
||||
|
||||
It's an alias for `.get([ "main/{languageId}", ... ])`.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *path* | String or<br>Array | See `cldr.get()` for more information |
|
||||
|
||||
```javascript
|
||||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" );
|
||||
// ➡ ","
|
||||
```
|
||||
10
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/event_get.md
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/event_get.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
## get ➡ ( path, value )
|
||||
|
||||
Triggered before a `.get()` (or any alias) return. The triggered listener receives the normalized *path* and the *value* found.
|
||||
|
||||
| Parameter | Description |
|
||||
| --- | --- |
|
||||
| *path* | See [../core/get.md](.get()) for more information |
|
||||
| *value* | See [../core/get.md](.get()) for more information |
|
||||
|
||||
See [Cldr.on()](global_on.md) or [.on()](on.md) for example.
|
||||
10
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/global_off.md
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/global_off.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
## Cldr.off( event, listener )
|
||||
|
||||
Removes a listener function from the specified event globally (for all instances).
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *event* | String | `"get"` |
|
||||
| *listener* | Function | |
|
||||
|
||||
See [Cldr.on()](global_on.md) for example.
|
||||
32
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/global_on.md
vendored
Normal file
32
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/global_on.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
## Cldr.on( event, listener )
|
||||
|
||||
Add a listener function to the specified event globally (for all instances).
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *event* | String | `"get"` |
|
||||
| *listener* | Function | |
|
||||
|
||||
```javascript
|
||||
Cldr.load({
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
function log( path, value ) {
|
||||
console.log( "Got", path, value );
|
||||
}
|
||||
|
||||
Cldr.on( "get", log );
|
||||
|
||||
en = new Cldr( "en" );
|
||||
en.get( "foo" );
|
||||
// Got foo bar (logged)
|
||||
// ➡ bar
|
||||
|
||||
zh = new Cldr( "zh" );
|
||||
zh.get( "foo" );
|
||||
// Got foo bar (logged)
|
||||
// ➡ bar
|
||||
|
||||
Cldr.off( "get", log );
|
||||
```
|
||||
28
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/global_once.md
vendored
Normal file
28
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/global_once.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
## Cldr.once( event, listener )
|
||||
|
||||
Add a listener function to the specified event globally (for all instances). It will be automatically removed after it's first execution.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *event* | String | `"get"` |
|
||||
| *listener* | Function | |
|
||||
|
||||
```javascript
|
||||
Cldr.load({
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
function log( path, value ) {
|
||||
console.log( "Got", path, value );
|
||||
}
|
||||
|
||||
Cldr.once( "get", log );
|
||||
|
||||
cldr = new Cldr( "en" );
|
||||
cldr.get( "foo" );
|
||||
// Got foo bar (logged)
|
||||
// ➡ bar
|
||||
|
||||
cldr.get( "foo" );
|
||||
// ➡ bar
|
||||
```
|
||||
10
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/off.md
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/off.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
## .off( event, listener )
|
||||
|
||||
Removes a listener function from the specified event for this instance.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *event* | String | `"get"` |
|
||||
| *listener* | Function | |
|
||||
|
||||
See [cldr.on()](on.md) for example.
|
||||
26
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/on.md
vendored
Normal file
26
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/on.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
## .on( event, listener )
|
||||
|
||||
Add a listener function to the specified event for this instance.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *event* | String | `"get"` |
|
||||
| *listener* | Function | |
|
||||
|
||||
```javascript
|
||||
Cldr.load({
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
function log( path, value ) {
|
||||
console.log( "Got", path, value );
|
||||
}
|
||||
|
||||
cldr = new Cldr( "en" );
|
||||
cldr.on( "get", log );
|
||||
cldr.get( "foo" );
|
||||
// Got foo bar (logged)
|
||||
// ➡ bar
|
||||
|
||||
cldr.off( "get", log );
|
||||
```
|
||||
27
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/once.md
vendored
Normal file
27
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/event/once.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
## .once( event, listener )
|
||||
|
||||
Add a listener function to the specified event for this instance. It will be automatically removed after it's first execution.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *event* | String | `"get"` |
|
||||
| *listener* | Function | |
|
||||
|
||||
```javascript
|
||||
Cldr.load({
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
function log( path, value ) {
|
||||
console.log( "Got", path, value );
|
||||
}
|
||||
|
||||
cldr = new Cldr( "en" );
|
||||
cldr.once( "get", log );
|
||||
cldr.get( "foo" );
|
||||
// Got foo bar (logged)
|
||||
// ➡ bar
|
||||
|
||||
cldr.get( "foo" );
|
||||
// ➡ bar
|
||||
```
|
||||
12
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental.md
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
## .supplemental( path )
|
||||
|
||||
It's an alias for `.get([ "supplemental", ... ])`.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *path* | String or<br>Array | See `cldr.get()` for more information |
|
||||
|
||||
```javascript
|
||||
en.supplemental( "gender/personList/{language}" );
|
||||
// ➡ "neutral"
|
||||
```
|
||||
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/time_data_allowed.md
vendored
Normal file
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/time_data_allowed.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
## .supplemental.timeData.allowed()
|
||||
|
||||
Helper function. Return the supplemental timeData allowed of locale's territory.
|
||||
|
||||
```javascript
|
||||
en.supplemental.timeData.allowed();
|
||||
// ➡ "H h"
|
||||
```
|
||||
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/time_data_preferred.md
vendored
Normal file
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/time_data_preferred.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
## .supplemental.timeData.preferred()
|
||||
|
||||
Helper function. Return the supplemental timeData preferred of locale's territory.
|
||||
|
||||
```javascript
|
||||
en.supplemental.timeData.preferred();
|
||||
// ➡ "h"
|
||||
```
|
||||
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/week_data_first_day.md
vendored
Normal file
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/week_data_first_day.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
## .supplemental.weekData.firstDay()
|
||||
|
||||
Helper function. Return the supplemental weekData firstDay of locale's territory.
|
||||
|
||||
```javascript
|
||||
en.supplemental.weekData.firstDay();
|
||||
// ➡ "sun"
|
||||
```
|
||||
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/week_data_min_days.md
vendored
Normal file
8
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/supplemental/week_data_min_days.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
## .supplemental.weekData.minDays()
|
||||
|
||||
Helper function. Return the supplemental weekData minDays of locale's territory as a Number.
|
||||
|
||||
```javascript
|
||||
en.supplemental.weekData.minDays();
|
||||
// ➡ 1
|
||||
```
|
||||
12
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/unresolved/get.md
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/cldrjs/doc/api/unresolved/get.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
## .get( path )
|
||||
|
||||
Overload (extend) `.get()` to get the item data or lookup by following [locale inheritance](http://www.unicode.org/reports/tr35/#Locale_Inheritance), set a local resolved cache if it's found (for subsequent faster access), or return `undefined`.
|
||||
|
||||
| Parameter | Type | Example |
|
||||
| --- | --- | --- |
|
||||
| *path* | String or<br>Array | See `cldr.get()` above for more information |
|
||||
|
||||
```javascript
|
||||
ptBr.get( "main/{languageId}/numbers/symbols-numberSystem-latn/decimal" );
|
||||
// ➡ ","
|
||||
```
|
||||
BIN
EveryThing/wwwroot/vendor/libs/cldrjs/doc/asset/jquery.png
vendored
Normal file
BIN
EveryThing/wwwroot/vendor/libs/cldrjs/doc/asset/jquery.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
134
EveryThing/wwwroot/vendor/libs/cldrjs/doc/bundle_lookup_matcher.md
vendored
Normal file
134
EveryThing/wwwroot/vendor/libs/cldrjs/doc/bundle_lookup_matcher.md
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
## Bundle Lookup Matcher
|
||||
|
||||
Bundle Lookup is the process of selecting the right dataset for the requested locale. We run this process during instance creation and set it on `instance.attributes.bundle`, which is further used when traversing items of the **main** dataset.
|
||||
|
||||
User must load likelySubtags and any wanted main datasets prior to creating an instance. For example:
|
||||
|
||||
```javascript
|
||||
Cldr.load(
|
||||
require( "cldr-data/supplemental/likelySubtags" ), // JSON data from supplemental/likelySubtags.json
|
||||
require( "cldr-data/main/en-US/ca-gregorian" ), // JSON data from main/en-US/ca-gregorian.json
|
||||
require( "cldr-data/main/en-GB/ca-gregorian" ) // JSON data from main/en-GB/ca-gregorian.json
|
||||
);
|
||||
|
||||
var enUs = new Cldr( "en-US" );
|
||||
console.log( enUs.attributes.bundle ); // "en-US"
|
||||
console.log( enUs.main( "dates/calendars/gregorian/dateFormats/short" ) ); // "M/d/yy"
|
||||
|
||||
var enGb = new Cldr( "en-GB" );
|
||||
console.log( enGb.attributes.bundle ); // "en-GB"
|
||||
console.log( enGb.main( "dates/calendars/gregorian/dateFormats/short" ) ); // "dd/MM/y"
|
||||
```
|
||||
|
||||
When instances are created, its `.attributes.bundle` reveals the matched bundle. The `.main` method uses this information to traverse the correct main item.
|
||||
|
||||
What happens if we include `main/en/ca-gregorian` to the above example?
|
||||
|
||||
```javascript
|
||||
Cldr.load(
|
||||
require( "cldr-data/supplemental/likelySubtags" ), // JSON data from supplemental/likelySubtags.json
|
||||
require( "cldr-data/main/en/ca-gregorian" ), // JSON data from main/en/ca-gregorian.json
|
||||
require( "cldr-data/main/en-US/ca-gregorian" ), // JSON data from main/en-US/ca-gregorian.json
|
||||
require( "cldr-data/main/en-GB/ca-gregorian" ) // JSON data from main/en-GB/ca-gregorian.json
|
||||
);
|
||||
|
||||
var enUs = new Cldr( "en-US" ); // English as spoken in United States.
|
||||
console.log( enUs.attributes.bundle ); // "en"
|
||||
console.log( enUs.main( "dates/calendars/gregorian/dateFormats/short" ) ); // "M/d/yy"
|
||||
|
||||
var enGb = new Cldr( "en-GB" ); // English as spoken in Great Britain.
|
||||
console.log( enGb.attributes.bundle ); // "en-GB"
|
||||
console.log( enGb.main( "dates/calendars/gregorian/dateFormats/short" ) ); // "dd/MM/y"
|
||||
```
|
||||
|
||||
Now, the `en-US` requested locale uses the `en` bundle (not the `en-US` bundle as used in the first example) and `en-GB` still uses the `en-GB` bundle. Why? Because, `en` is the default content for `en-US` (deduced from likelySubtags data). Default content means that the child content is all in the parent. Therefore, both `en` and `en-US` are identical. Our bundle lookup matching algorithm always picks the grandest available parent. Note the retrieved main item is still the correct one (as it should be).
|
||||
|
||||
A good observer may notice that loading both `main/en/ca-gregorian` and `main/en-US/ca-gregorian` is redundant. Although loading both is not a problem, loading either the `en` or the `en-US` bundle alone is enough.
|
||||
|
||||
Let's add a bit of sugar to the requested locales.
|
||||
|
||||
```javascript
|
||||
var en = new Cldr( "en" ); // English.
|
||||
console.log( en.attributes.bundle ); // "en"
|
||||
|
||||
var enUs = new Cldr( "en-US" ); // English as spoken in United States.
|
||||
console.log( enUs.attributes.bundle ); // "en"
|
||||
|
||||
var enLatnUs = new Cldr( "en-Latn-US" ); // English in Latin script as spoken in the United States.
|
||||
console.log( enLatnUs.attributes.bundle ); // "en"
|
||||
```
|
||||
|
||||
All instances above obviously matches the same `en` bundle. Because, (a) `en` is the default content for `en-US` and (b) `en-US` is the default content for `en-Latn-US`.
|
||||
|
||||
What happens if the requested locale includes [Unicode extensions][]?
|
||||
|
||||
```javascript
|
||||
var en = new Cldr( "en-US-u-cu-USD" );
|
||||
console.log( en.attributes.bundle ); // "en"
|
||||
console.log( en.main( "numbers/currencies/{u-cu}/displayName" ) ); // "US Dollar"
|
||||
```
|
||||
|
||||
[Unicode extensions][] are obviously ignored on bundle lookup. Note they are accessible via variable replacements.
|
||||
|
||||
Below are other non-obvious lookups.
|
||||
|
||||
```javascript
|
||||
Cldr.load(
|
||||
require( "cldr-data/supplemental/likelySubtags" ), // JSON data from supplemental/likelySubtags.json
|
||||
require( "cldr-data/main/sr-Cyrl/numbers" ), // JSON data from main/sr-Cyrl/numbers.json
|
||||
require( "cldr-data/main/sr-Latn/numbers" ), // JSON data from main/sr-Latn/numbers.json
|
||||
require( "cldr-data/main/zh-Hant/numbers" ) // JSON data from main/zh-Hant/numbers.json
|
||||
);
|
||||
|
||||
var srCyrl = new Cldr( "sr-Cyrl" );
|
||||
console.log( srCyrl.attributes.bundle ); // "sr-Cyrl"
|
||||
console.log( srCyrl.main( "numbers/decimalFormats-numberSystem-latn/short/decimalFormat/1000-count-one" ) );
|
||||
// ➜ "0 хиљ'.'"
|
||||
|
||||
var srRS = new Cldr( "sr-RS" );
|
||||
console.log( srRs.attributes.bundle ); // "sr-Cyrl"
|
||||
console.log( srRs.main( "numbers/decimalFormats-numberSystem-latn/short/decimalFormat/1000-count-one" ) );
|
||||
// ➜ "0 хиљ'.'"
|
||||
|
||||
var srLatnRS = new Cldr( "sr-Latn-RS" );
|
||||
console.log( srLatnRS.attributes.bundle ); // "sr-Latn"
|
||||
console.log( srLatnRS.main( "numbers/decimalFormats-numberSystem-latn/short/decimalFormat/1000-count-one" ) );
|
||||
// ➜ "0 hilj'.'"
|
||||
|
||||
var zhTW = new Cldr( "zh-TW" );
|
||||
console.log( zhTW.attributes.bundle ); // "zh-Hant"
|
||||
console.log( zhTW.main( "numbers/symbols-numberSystem-hanidec/nan" ) ); // "非數值"
|
||||
```
|
||||
|
||||
Finally, if an instance is created whose bundle hasn't been loaded yet, its `.attributes.bundle` is set as `null`. If this instance is used to traverse a main dataset, an error is thrown. If this instance is used to traverse any non-main dataset (e.g., supplemental/postalCodeData.json) it can be used just fine.
|
||||
|
||||
```javascript
|
||||
var zhCN = new Cldr( "zh-CN" );
|
||||
console.log( zhCN.attributes.bundle ); // null
|
||||
console.log( zhCN.main( /* something */ ) ); // Error: E_MISSING_BUNDLE
|
||||
```
|
||||
|
||||
### Implementation details
|
||||
|
||||
[UTS#35][] doesn't specify how bundle lookup matcher should be implemented. [RFC 4647][] section 3.4 "Lookup" has an algorithm for that, although it fails in various cases listed above. Mark Davis, the co-founder and president of the Unicode Consortium, said (via CLDR mailing list and via [Fixing Inheritance doc][]) that bundle lookup should happen via [LanguageMatching](http://www.unicode.org/reports/tr35/#LanguageMatching).
|
||||
|
||||
Our belief is that LanguageMatching is a great algorithm for Best Fit Matcher. Although, it's an overkill for Lookup Matcher.
|
||||
|
||||
ICU (a known CLDR implementation) doesn't use LanguageMatching for Bundle Lookup Matcher either. But, it has its own implementation, which has its own flaws as Mark Davis says in the Fixing Inheritance doc "ICU uses the %%ALIAS element to counteract some of these problems... It doesn’t fix all of them, and the data is not derivable from CLDR."
|
||||
|
||||
We also believe ICU's aliases approach is not the best solution. Instead we believe in the following approach, whose result matches LanguageMatching with a score threshold of 100%.
|
||||
|
||||
`BundleLookupMatcher( requestedLocale, availableBundles )` is used for bundle lookup given an arbitrary `requestedLocale`.
|
||||
|
||||
1. Create a Hash (aka Dictionary or Key-Value-Pair) object, named `availableBundlesMap`, that maps each `availableBundle` (value) to its respective [Remove Likely Subtags][] result (key).
|
||||
1. In case of a duplicate key, keep the smaller value, i.e., keep the available bundle locale whose length is the smallest; e.g., keep { "en": "en" } instead of { "en": "en-US" }.
|
||||
1. [Remove Likely Subtags][] from `requestedLocale` and let `minRequestedLocale` keep its result.
|
||||
1. Return `availableBundlesMap[ minRequestedLocale ]`.
|
||||
|
||||
This algorithm is faster than LanguageMatching and needs no extra CLDR to be created and maintained (likelySubtags is sufficient). Note the `availableBundlesMap` can be cached for improved performance on repeated calls.
|
||||
|
||||
[Fixing Inheritance doc]: https://docs.google.com/document/d/1qZwEVb4kfODi2TK5f4x15FYWj5rJRijXmSIg5m6OH8s/edit
|
||||
[Remove Likely Subtags]: http://www.unicode.org/reports/tr35/tr35.html#Likely_Subtags
|
||||
[RFC 4647]: http://www.ietf.org/rfc/rfc4647.txt
|
||||
[Unicode extensions]: http://Www.unicode.org/reports/tr35/#u_Extension
|
||||
[UTS#35]: http://www.unicode.org/reports/tr35
|
||||
90
EveryThing/wwwroot/vendor/libs/cldrjs/package.json
vendored
Normal file
90
EveryThing/wwwroot/vendor/libs/cldrjs/package.json
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"_from": "cldrjs@~0.5.5",
|
||||
"_id": "cldrjs@0.5.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-KDwzwbmLIPfCgd8JERVDpQKrUUM1U4KpFJJg2IROv89rF172lLufoJnqJ/Wea6fXL5bO6WjuLMzY8V52UWPvkA==",
|
||||
"_location": "/cldrjs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cldrjs@~0.5.5",
|
||||
"name": "cldrjs",
|
||||
"escapedName": "cldrjs",
|
||||
"rawSpec": "~0.5.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.5.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/globalize"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cldrjs/-/cldrjs-0.5.5.tgz",
|
||||
"_shasum": "5c92ca2de89a8a16dea76cb2dfc4e00104428e52",
|
||||
"_spec": "cldrjs@~0.5.5",
|
||||
"_where": "D:\\EveryThing\\EveryThing\\EveryThing",
|
||||
"author": {
|
||||
"name": "Rafael Xavier de Souza",
|
||||
"email": "rxaviers@gmail.com",
|
||||
"url": "http://rafael.xavier.blog.br"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/rxaviers/cldrjs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Simple CLDR traverser",
|
||||
"devDependencies": {
|
||||
"cldr-data-downloader": "0.2.x",
|
||||
"grunt": "0.4.x",
|
||||
"grunt-compare-size": "0.4.0",
|
||||
"grunt-contrib-connect": "0.3.x",
|
||||
"grunt-contrib-copy": "0.4.x",
|
||||
"grunt-contrib-jshint": "0.12.x",
|
||||
"grunt-contrib-requirejs": "0.4.x",
|
||||
"grunt-contrib-uglify": "0.2.x",
|
||||
"grunt-dco": "0.0.3",
|
||||
"grunt-mocha": "0.3.x",
|
||||
"gzip-js": "0.3.2",
|
||||
"matchdep": "*"
|
||||
},
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"DCO.md",
|
||||
"dist/",
|
||||
"doc/",
|
||||
"LICENSE-MIT",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/rxaviers/cldrjs#readme",
|
||||
"keywords": [
|
||||
"utility",
|
||||
"globalization",
|
||||
"internationalization",
|
||||
"multilingualization",
|
||||
"localization",
|
||||
"g11n",
|
||||
"i18n",
|
||||
"m17n",
|
||||
"L10n",
|
||||
"localize",
|
||||
"locale",
|
||||
"cldr",
|
||||
"json",
|
||||
"inheritance",
|
||||
"compiler"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/rxaviers/cldrjs/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"main": "dist/node_main.js",
|
||||
"name": "cldrjs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/rxaviers/cldrjs.git"
|
||||
},
|
||||
"version": "0.5.5"
|
||||
}
|
||||
Reference in New Issue
Block a user