Fat-Client:
Es ist möglich, allen Termin-Einladungen auf einmal zuzusagen MoK: DevExpress von Version 17.1 auf 21.1 aktualisiert Reports testweise eingebaut DevExpress-Scheduler testweise eingebaut
This commit is contained in:
45
BeWoPlanerMobil/node_modules/bootstrap/dist/js/bootstrap.js
generated
vendored
45
BeWoPlanerMobil/node_modules/bootstrap/dist/js/bootstrap.js
generated
vendored
@@ -7,26 +7,39 @@
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
|
||||
(global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
|
||||
}(this, (function (exports, $, Popper) { 'use strict';
|
||||
}(this, (function (exports, $, Popper) {
|
||||
'use strict';
|
||||
|
||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
||||
console.log($().jquery);
|
||||
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
||||
|
||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
||||
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
||||
function _defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
|
||||
function _defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
|
||||
if ("value" in descriptor) {
|
||||
descriptor.writable = true;
|
||||
}
|
||||
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) {
|
||||
_defineProperties(Constructor.prototype, protoProps);
|
||||
}
|
||||
|
||||
if (staticProps) {
|
||||
_defineProperties(Constructor, staticProps);
|
||||
}
|
||||
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
|
||||
13
BeWoPlanerMobil/node_modules/cldrjs/CHANGELOG.md
generated
vendored
Normal file
13
BeWoPlanerMobil/node_modules/cldrjs/CHANGELOG.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/DCO.md
generated
vendored
Normal file
27
BeWoPlanerMobil/node_modules/cldrjs/DCO.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/LICENSE-MIT
generated
vendored
Normal file
22
BeWoPlanerMobil/node_modules/cldrjs/LICENSE-MIT
generated
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
BeWoPlanerMobil/node_modules/cldrjs/README.md
generated
vendored
Normal file
561
BeWoPlanerMobil/node_modules/cldrjs/README.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/.dist_jshintrc
generated
vendored
Normal file
17
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/.dist_jshintrc
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/.jshintrc
generated
vendored
Normal file
17
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/.jshintrc
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build.txt
generated
vendored
Normal file
45
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build.txt
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro.min.js
generated
vendored
Normal file
4
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro.min.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/*!
|
||||
* CLDR JavaScript Library v@VERSION @DATE MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
27
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_core.js
generated
vendored
Normal file
27
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_core.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_event.js
generated
vendored
Normal file
33
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_event.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_supplemental.js
generated
vendored
Normal file
31
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_supplemental.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_unresolved.js
generated
vendored
Normal file
36
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/intro_unresolved.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/node_main.js
generated
vendored
Normal file
22
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/node_main.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/outro.js
generated
vendored
Normal file
1
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/build/outro.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
}));
|
||||
38
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/bundle/lookup.js
generated
vendored
Normal file
38
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/bundle/lookup.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/bundle/lookup.js.orig
generated
vendored
Normal file
76
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/bundle/lookup.js.orig
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/bundle/parent_lookup.js
generated
vendored
Normal file
25
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/bundle/parent_lookup.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr.js
generated
vendored
Normal file
686
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr_event.js
generated
vendored
Normal file
585
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr_event.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr_supplemental.js
generated
vendored
Normal file
101
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr_supplemental.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr_unresolved.js
generated
vendored
Normal file
164
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/cldr_unresolved.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/create_error.js
generated
vendored
Normal file
17
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/create_error.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate.js
generated
vendored
Normal file
8
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
var validate = function( code, check, attributes ) {
|
||||
if ( !check ) {
|
||||
throw createError( code, attributes );
|
||||
}
|
||||
};
|
||||
|
||||
8
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/presence.js
generated
vendored
Normal file
8
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/presence.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
var validatePresence = function( value, name ) {
|
||||
validate( "E_MISSING_PARAMETER", typeof value !== "undefined", {
|
||||
name: name
|
||||
});
|
||||
};
|
||||
|
||||
10
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type.js
generated
vendored
Normal file
10
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/function.js
generated
vendored
Normal file
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/function.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypeFunction = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || typeof value === "function", "Function" );
|
||||
};
|
||||
|
||||
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/path.js
generated
vendored
Normal file
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/path.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypePath = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || arrayIsArray( value ), "String or Array" );
|
||||
};
|
||||
|
||||
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/plain_object.js
generated
vendored
Normal file
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/plain_object.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypePlainObject = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || isPlainObject( value ), "Plain Object" );
|
||||
};
|
||||
|
||||
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/string.js
generated
vendored
Normal file
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/common/validate/type/string.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var validateTypeString = function( value, name ) {
|
||||
validateType( value, name, typeof value === "string", "a string" );
|
||||
};
|
||||
|
||||
140
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core.js
generated
vendored
Normal file
140
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/likely_subtags.js
generated
vendored
Normal file
91
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/likely_subtags.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/load.js
generated
vendored
Normal file
31
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/load.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/remove_likely_subtags.js
generated
vendored
Normal file
45
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/remove_likely_subtags.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/set_available_bundles.js
generated
vendored
Normal file
25
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/set_available_bundles.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/subtags.js
generated
vendored
Normal file
51
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/core/subtags.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/event.js
generated
vendored
Normal file
75
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/event.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/item/get_resolved.js
generated
vendored
Normal file
9
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/item/get_resolved.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/item/lookup.js
generated
vendored
Normal file
44
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/item/lookup.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/path/normalize.js
generated
vendored
Normal file
24
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/path/normalize.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/resource/get.js
generated
vendored
Normal file
17
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/resource/get.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/resource/set.js
generated
vendored
Normal file
17
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/resource/set.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/supplemental.js
generated
vendored
Normal file
16
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/supplemental.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/supplemental/main.js
generated
vendored
Normal file
48
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/supplemental/main.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/unresolved.js
generated
vendored
Normal file
35
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/unresolved.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/always_array.js
generated
vendored
Normal file
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/always_array.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var alwaysArray = function( somethingOrArray ) {
|
||||
return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
|
||||
};
|
||||
|
||||
12
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/array/for_each.js
generated
vendored
Normal file
12
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/array/for_each.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/array/is_array.js
generated
vendored
Normal file
6
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/array/is_array.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var arrayIsArray = Array.isArray || function( obj ) {
|
||||
return Object.prototype.toString.call( obj ) === "[object Array]";
|
||||
};
|
||||
|
||||
15
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/array/some.js
generated
vendored
Normal file
15
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/array/some.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/is_plain_object.js
generated
vendored
Normal file
9
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/is_plain_object.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/json/merge.js
generated
vendored
Normal file
35
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/json/merge.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/object/keys.js
generated
vendored
Normal file
17
BeWoPlanerMobil/node_modules/cldrjs/dist/.build/util/object/keys.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr.js
generated
vendored
Normal file
686
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr/event.js
generated
vendored
Normal file
585
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr/event.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr/supplemental.js
generated
vendored
Normal file
101
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr/supplemental.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr/unresolved.js
generated
vendored
Normal file
164
BeWoPlanerMobil/node_modules/cldrjs/dist/cldr/unresolved.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/dist/node_main.js
generated
vendored
Normal file
22
BeWoPlanerMobil/node_modules/cldrjs/dist/node_main.js
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/attributes.md
generated
vendored
Normal file
15
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/attributes.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/constructor.md
generated
vendored
Normal file
9
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/constructor.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/get.md
generated
vendored
Normal file
18
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/get.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/load.md
generated
vendored
Normal file
23
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/load.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/main.md
generated
vendored
Normal file
12
BeWoPlanerMobil/node_modules/cldrjs/doc/api/core/main.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/event_get.md
generated
vendored
Normal file
10
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/event_get.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/global_off.md
generated
vendored
Normal file
10
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/global_off.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/global_on.md
generated
vendored
Normal file
32
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/global_on.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/global_once.md
generated
vendored
Normal file
28
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/global_once.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/off.md
generated
vendored
Normal file
10
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/off.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/on.md
generated
vendored
Normal file
26
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/on.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/once.md
generated
vendored
Normal file
27
BeWoPlanerMobil/node_modules/cldrjs/doc/api/event/once.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental.md
generated
vendored
Normal file
12
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/time_data_allowed.md
generated
vendored
Normal file
8
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/time_data_allowed.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/time_data_preferred.md
generated
vendored
Normal file
8
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/time_data_preferred.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/week_data_first_day.md
generated
vendored
Normal file
8
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/week_data_first_day.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/week_data_min_days.md
generated
vendored
Normal file
8
BeWoPlanerMobil/node_modules/cldrjs/doc/api/supplemental/week_data_min_days.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/api/unresolved/get.md
generated
vendored
Normal file
12
BeWoPlanerMobil/node_modules/cldrjs/doc/api/unresolved/get.md
generated
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
BeWoPlanerMobil/node_modules/cldrjs/doc/asset/jquery.png
generated
vendored
Normal file
BIN
BeWoPlanerMobil/node_modules/cldrjs/doc/asset/jquery.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
134
BeWoPlanerMobil/node_modules/cldrjs/doc/bundle_lookup_matcher.md
generated
vendored
Normal file
134
BeWoPlanerMobil/node_modules/cldrjs/doc/bundle_lookup_matcher.md
generated
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
|
||||
89
BeWoPlanerMobil/node_modules/cldrjs/package.json
generated
vendored
Normal file
89
BeWoPlanerMobil/node_modules/cldrjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"_from": "cldrjs@^0.5.4",
|
||||
"_id": "cldrjs@0.5.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-KDwzwbmLIPfCgd8JERVDpQKrUUM1U4KpFJJg2IROv89rF172lLufoJnqJ/Wea6fXL5bO6WjuLMzY8V52UWPvkA==",
|
||||
"_location": "/cldrjs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cldrjs@^0.5.4",
|
||||
"name": "cldrjs",
|
||||
"escapedName": "cldrjs",
|
||||
"rawSpec": "^0.5.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.5.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/globalize"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cldrjs/-/cldrjs-0.5.5.tgz",
|
||||
"_shasum": "5c92ca2de89a8a16dea76cb2dfc4e00104428e52",
|
||||
"_spec": "cldrjs@^0.5.4",
|
||||
"_where": "C:\\Users\\lyndo\\BeWo\\BeWoPlanerMobil\\node_modules\\globalize",
|
||||
"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"
|
||||
}
|
||||
5
BeWoPlanerMobil/node_modules/globalize/CONTRIBUTING.md
generated
vendored
Normal file
5
BeWoPlanerMobil/node_modules/globalize/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Welcome! Thanks for your interest in contributing to Globalize. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](http://contribute.jquery.org). Before writing code for this project, be sure to read [Writing Code for jQuery Foundation Projects](http://contribute.jquery.org/code/).
|
||||
|
||||
You may also want to take a look at our [commit & pull request guide](http://contribute.jquery.org/commits-and-pull-requests/) and [style guides](http://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](http://contribute.jquery.org/cla).
|
||||
|
||||
You can find us on [Slack](https://globalizejs.slack.com/). If you're new, [join here](https://join.slack.com/t/globalizejs/shared_invite/enQtMjk4OTUwNzM1Nzk0LTk2YmY0YjY3Yzk4YzU3M2NkMDZjNThlNzcwNTkyNGJhNDhiNjdkMWUyN2Q2MjVmNTk0ZjkyNGQ3MWEyNzNmMWU). If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/).
|
||||
20
BeWoPlanerMobil/node_modules/globalize/LICENSE
generated
vendored
Normal file
20
BeWoPlanerMobil/node_modules/globalize/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org
|
||||
|
||||
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.
|
||||
818
BeWoPlanerMobil/node_modules/globalize/README.md
generated
vendored
Normal file
818
BeWoPlanerMobil/node_modules/globalize/README.md
generated
vendored
Normal file
@@ -0,0 +1,818 @@
|
||||
# Globalize
|
||||
|
||||
[](http://travis-ci.org/globalizejs/globalize)
|
||||
[](https://david-dm.org/globalizejs/globalize#info=dependencies)
|
||||
[](https://david-dm.org/globalizejs/globalize#info=devDependencies)
|
||||
|
||||
A JavaScript library for internationalization and localization that leverage the official [Unicode CLDR](http://cldr.unicode.org/) JSON data. The library works both for the browser and as a
|
||||
Node.js module.
|
||||
|
||||
- [About Globalize](#about-globalize)
|
||||
- [Why globalization?](#why-globalization)
|
||||
- [Why Globalize?](#why-globalize)
|
||||
- [Migrating from Globalize 0.x](#migrating-from-globalize-0x)
|
||||
- [Where to use it?](#where-to-use-it)
|
||||
- [Where does the data come from?](#where-does-the-data-come-from)
|
||||
- [Only load and use what you need](#pick-the-modules-you-need)
|
||||
- [Browser support](#browser-support)
|
||||
- [Getting started](#getting-started)
|
||||
- [Requirements](#requirements)
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Performance](#performance)
|
||||
- [Compilation and the Runtime modules](#compilation-and-the-runtime-modules)
|
||||
- [Examples](#examples)
|
||||
- [Community](#community)
|
||||
- [API](#api)
|
||||
- [Core](#core-module)
|
||||
- [Date module](#date-module)
|
||||
- [Message module](#message-module)
|
||||
- [Number module](#number-module)
|
||||
- [Currency module](#currency-module)
|
||||
- [Plural module](#plural-module)
|
||||
- [Relative time module](#relative-time-module)
|
||||
- [Unit module](#unit-module)
|
||||
- more to come...
|
||||
- [Error reference](#error-reference)
|
||||
- [Contributing](#contributing)
|
||||
- [Roadmap](#roadmap)
|
||||
- [Development](#development)
|
||||
- [File structure](#file-structure)
|
||||
- [Source files](#source-files)
|
||||
- [Tests](#tests)
|
||||
- [Build](#build)
|
||||
|
||||
|
||||
## About Globalize
|
||||
|
||||
### Why globalization?
|
||||
|
||||
Each language, and the countries that speak that language, have different expectations when it comes to how numbers (including currency and percentages) and dates should appear. Obviously, each language has different names for the days of the week and the months of the year. But they also have different expectations for the structure of dates, such as what order the day, month and year are in. In number formatting, not only does the character used to delineate number groupings and the decimal portion differ, but the placement of those characters differ as well.
|
||||
|
||||
A user using an application should be able to read and write dates and numbers in the format they are accustomed to. This library makes this possible, providing an API to convert user-entered number and date strings - in their own format - into actual numbers and dates, and conversely, to format numbers and dates into that string format.
|
||||
|
||||
Even if the application deals only with the English locale, it may still need globalization to format programming language bytes into human-understandable language and vice-versa in an effective and reasonable way. For example, to display something better than "Edited 1 minutes ago".
|
||||
|
||||
### Why Globalize?
|
||||
|
||||
Globalize provides number formatting and parsing, date and time formatting and parsing, currency formatting, message formatting (ICU message format pattern), and plural support.
|
||||
|
||||
Design Goals.
|
||||
|
||||
- Leverages the Unicode CLDR data and follows its UTS#35 specification.
|
||||
- Keeps code separate from i18n content. Doesn't host or embed any locale data in the library. Empowers developers to control the loading mechanism of their choice.
|
||||
- Allows developers to load as much or as little data as they need. Avoids duplicating data if using multiple i18n libraries that leverage CLDR.
|
||||
- Keeps code modular. Allows developers to load the i18n functionalities they need.
|
||||
- Runs in browsers and Node.js, consistently across all of them.
|
||||
- Makes globalization as easy to use as jQuery.
|
||||
|
||||
Globalize is based on the Unicode Consortium's Common Locale Data Repository (CLDR), the largest and most extensive standard repository of locale data available. CLDR is constantly updated and is used by many large applications and operating systems, so you'll always have access to the most accurate and up-to-date locale data.
|
||||
|
||||
Globalize needs CLDR content to function properly, although it doesn't embed, hard-code, or host such content. Instead, Globalize empowers developers to load CLDR data the way they want. Vanilla CLDR in its official JSON format (no pre-processing) is expected to be provided. As a consequence, (a) Globalize avoids bugs caused by outdated i18n content. Developers can use up-to-date CLDR data directly from Unicode as soon as it's released, without having to wait for any pipeline on our side. (b) Developers have full control over which locale coverage they want to provide on their applications. (c) Developers are able to share the same i18n dataset between Globalize and other libraries that leverage CLDR. There's no need for duplicating data.
|
||||
|
||||
Globalize is systematically tested against desktop and mobile browsers and Node.js. So, using it you'll get consistent results across different browsers and across browsers and the server.
|
||||
|
||||
Globalize doesn't use native Ecma-402 yet, which could potentially improve date and number formatting performance. Although Ecma-402 support is improving among modern browsers and even Node.js, the functionality and locale coverage level varies between different environments (see Comparing JavaScript Libraries [slide 25][]). Globalize needs to do more research and testings to use it reliably.
|
||||
|
||||
For alternative libraries and more, check out this [JavaScript globalization overview][].
|
||||
|
||||
[slide 25]: http://jsi18n.com/jsi18n.pdf
|
||||
[JavaScript globalization overview]: http://rxaviers.github.io/javascript-globalization/
|
||||
|
||||
### Migrating from Globalize 0.x
|
||||
|
||||
Are you coming from Globalize 0.x? Read our [migration guide][] to learn what have changed and how to migrate older 0.x code to up-to-date 1.x.
|
||||
|
||||
[migration guide]: doc/migrating-from-0.x.md
|
||||
|
||||
### Where to use it?
|
||||
|
||||
Globalize is designed to work both in the [browser](#browser-support), or in [Node.js](#usage). It supports both [AMD](#usage) and [CommonJS](#usage).
|
||||
|
||||
### Where does the data come from?
|
||||
|
||||
Globalize uses the [Unicode CLDR](http://cldr.unicode.org/), the largest and most extensive standard repository of locale data.
|
||||
|
||||
We do NOT embed any i18n data within our library. However, we make it really easy to use. Read [How to get and load CLDR JSON data](#2-cldr-content) for more information on its usage.
|
||||
|
||||
### Pick the modules you need
|
||||
|
||||
| File | Minified + gzipped size | Runtime minified + gzipped size | Summary |
|
||||
| -------------------------- | ----------------------: | ------------------------------: | ------------------------------------------------------------ |
|
||||
| globalize.js | 1.7KB | 1.1KB | [Core library](#core-module) |
|
||||
| globalize/currency.js | 3.0KB | 0.7KB | [Currency module](#currency-module) provides currency formatting |
|
||||
| globalize/date.js | 7.7KB | 4.3KB | [Date module](#date-module) provides date formatting and parsing |
|
||||
| globalize/message.js | 5.3KB | 0.7KB | [Message module](#message-module) provides ICU message format support |
|
||||
| globalize/number.js | 4.4KB | 2.6KB | [Number module](#number-module) provides number formatting and parsing |
|
||||
| globalize/plural.js | 2.3KB | 0.4KB | [Plural module](#plural-module) provides pluralization support |
|
||||
| globalize/relative-time.js | 0.8KB | 0.5KB | [Relative time module](#relative-time-module) provides relative time formatting support |
|
||||
| globalize/unit.js | 0.9KB | 0.6KB | [Unit module](#unit-module) provides unit formatting support |
|
||||
|
||||
### Browser Support
|
||||
|
||||
Globalize 1.x supports the following browsers:
|
||||
|
||||
- Chrome: (Current - 1) or Current
|
||||
- Firefox: (Current - 1) or Current
|
||||
- Safari: 5.1+
|
||||
- Opera: 12.1x, (Current - 1) or Current
|
||||
- IE9+
|
||||
|
||||
*(Current - 1)* or *Current* denotes that we support the current stable version of the browser and the version that preceded it. For example, if the current version of a browser is 24.x, we support the 24.x and 23.x versions.
|
||||
|
||||
## Getting Started
|
||||
|
||||
npm install globalize cldr-data iana-tz-data
|
||||
|
||||
```js
|
||||
var Globalize = require( "globalize" );
|
||||
Globalize.load( require( "cldr-data" ).entireSupplemental() );
|
||||
Globalize.load( require( "cldr-data" ).entireMainFor( "en", "es" ) );
|
||||
Globalize.loadTimeZone( require( "iana-tz-data" ) );
|
||||
|
||||
Globalize("en").formatDate(new Date());
|
||||
// > "11/27/2015"
|
||||
|
||||
Globalize("es").formatDate(new Date());
|
||||
// > "27/11/2015"
|
||||
```
|
||||
|
||||
Note `cldr-data` is an optional module, read [CLDR content](#2-cldr-content) section below for more information on how to get CLDR from different sources.
|
||||
|
||||
The [`iana-tz-data`](https://github.com/rxaviers/iana-tz-data) module is only needed when IANA time zones (via `options.timeZone`) are used with date functions. Read [IANA time zone data](#3-iana-time-zone-data) below for more information.
|
||||
|
||||
Read the [Locales section](#locales) for more information about supported locales. For AMD, bower and other usage examples, see [Examples section](#examples).
|
||||
|
||||
### Installation
|
||||
|
||||
#### Downloading a ZIP or tarball archive
|
||||
|
||||
Click the GitHub [releases tab](https://github.com/globalizejs/globalize/releases) and download the latest available Globalize package.
|
||||
|
||||
#### Using a package manager
|
||||
|
||||
You can use either npm or bower:
|
||||
|
||||
- `npm install globalize`
|
||||
- `bower install globalize`
|
||||
|
||||
#### Building from source
|
||||
|
||||
1. `git clone https://github.com/globalizejs/globalize.git`
|
||||
2. [Build the distribution files](#build)
|
||||
|
||||
### Requirements
|
||||
|
||||
#### 1. Dependencies
|
||||
|
||||
If you use module loading like ES6 import, CommonJS, or AMD and fetch your code using package managers like *npm* or *bower*, you don't need to worry about this and can skip reading this section. Otherwise, you need to satisfy Globalize dependencies prior to using it. There is only one external dependency: [cldr.js][], which is a CLDR low level manipulation tool. Additionally, you need to satisfy the cross-dependencies between modules.
|
||||
|
||||
| Module | Dependencies (load in order) |
|
||||
| -------------------- | ---------------------------------------- |
|
||||
| Core module | [cldr.js][] |
|
||||
| Currency module | globalize.js (core), globalize/number.js, and globalize/plural.js (only required for "code" or "name" styles) |
|
||||
| Date module | globalize.js (core) and globalize/number.js |
|
||||
| Message module | globalize.js (core) and globalize/plural.js (if using messages that need pluralization support) |
|
||||
| Number module | globalize.js (core) |
|
||||
| Plural | globalize.js (core) |
|
||||
| Relative time module | globalize.js (core), globalize/number.js, and globalize/plural.js |
|
||||
| Unit module | globalize.js (core), globalize/number.js, and globalize/plural.js |
|
||||
|
||||
As an alternative to deducing this yourself, use this [online tool](http://johnnyreilly.github.io/globalize-so-what-cha-want/). The tool allows you to select the modules you're interested in using and tells you the Globalize files *and* CLDR JSON that you need.
|
||||
|
||||
[cldr.js]: https://github.com/rxaviers/cldrjs
|
||||
|
||||
#### 2. CLDR content
|
||||
|
||||
Globalize is the i18n software (the engine). Unicode CLDR is the i18n content (the fuel). You need to feed Globalize on the appropriate portions of CLDR prior to using it.
|
||||
|
||||
*(a) How do I figure out which CLDR portions are appropriate for my needs?*
|
||||
|
||||
Each Globalize function requires a special set of CLDR portions. Once you know which Globalize functionalities you need, you can deduce its respective CLDR requirements. See table below.
|
||||
|
||||
| Module | Required CLDR JSON files |
|
||||
| -------------------- | ---------------------------------------- |
|
||||
| Core module | cldr/supplemental/likelySubtags.json |
|
||||
| Currency module | cldr/main/`locale`/currencies.json<br>cldr/supplemental/currencyData.json<br>+CLDR JSON files from number module<br>+CLDR JSON files from plural module for name style support |
|
||||
| Date module | cldr/main/`locale`/ca-gregorian.json<br>cldr/main/`locale`/timeZoneNames.json<br>cldr/supplemental/metaZones.json<br>cldr/supplemental/timeData.json<br>cldr/supplemental/weekData.json<br>+CLDR JSON files from number module |
|
||||
| Number module | cldr/main/`locale`/numbers.json<br>cldr/supplemental/numberingSystems.json |
|
||||
| Plural module | cldr/supplemental/plurals.json (for cardinals)<br>cldr/supplemental/ordinals.json (for ordinals) |
|
||||
| Relative time module | cldr/main/`locale`/dateFields.json<br>+CLDR JSON files from number and plural modules |
|
||||
| Unit module | cldr/main/`locale`/units.json<br>+CLDR JSON files from number and plural module |
|
||||
|
||||
As an alternative to deducing this yourself, use this [online tool](http://johnnyreilly.github.io/globalize-so-what-cha-want/). The tool allows you to select the modules you're interested in using and tells you the Globalize files *and* CLDR JSON that you need.
|
||||
|
||||
*(b) How am I supposed to get and load CLDR content?*
|
||||
|
||||
Learn [how to get and load CLDR content...](doc/cldr.md) and use
|
||||
[`Globalize.load()`](#core-module) to load it.
|
||||
|
||||
#### 3. IANA time zone data
|
||||
|
||||
The IANA time zone (tz) database, sometimes called the Olson database, is the standard data used by Unicode CLDR, ECMA-402, Linux, UNIX, Java, ICU, and others. It's used by Globalize to circumvent the JavaScript limitations with respect to manipulating date in time zones other than the user's environment.
|
||||
|
||||
In short, feed Globalize on IANA time zone data if you need to format or parse dates in a specific time zone, independently of the user's environment, e.g., `America/Los_Angeles`.
|
||||
|
||||
It's important to note there's no official IANA time zone data in the JSON format. Therefore, [`iana-tz-data`](https://github.com/rxaviers/iana-tz-data) has been adopted for convenience.
|
||||
|
||||
Learn more on [`Globalize.loadTimeZone()`](#date-module).
|
||||
|
||||
### Usage
|
||||
|
||||
Globalize's consumable-files are located in the `./dist` directory. If you don't find it, it's because you are using a development branch. You should either use a tagged version or [build the distribution files yourself](#build). Read [installation](#installation) above if you need more information on how to download.
|
||||
|
||||
Globalize can be used for a variety of different i18n tasks, eg. formatting or parsing dates, formatting or parsing numbers, formatting messages, etc. You may NOT need Globalize in its entirety. For that reason, we made it modular. So, you can cherry-pick the pieces you need, eg. load `dist/globalize.js` to get Globalize core, load `dist/globalize/date.js` to extend Globalize with Date functionalities, etc.
|
||||
|
||||
An example is worth a thousand words. Check out our [Examples](#examples) section below.
|
||||
|
||||
### Performance
|
||||
|
||||
When formatting or parsing, there's actually a two-step process: (a) the formatter (or parser) *creation* and (b) its *execution*, where creation takes an order of magnitude more time (more expensive) than execution. In the creation phase, Globalize traverses the CLDR tree, processes data (e.g., expands date patterns, parses plural rules, etc), and returns a function that actually executes the formatting or parsing.
|
||||
|
||||
```js
|
||||
// Formatter creation.
|
||||
var formatter = Globalize.numberFormatter();
|
||||
|
||||
// Formatter execution (roughly 10x faster than above).
|
||||
formatter( Math.PI );
|
||||
// > 3.141
|
||||
```
|
||||
|
||||
As a rule of thumb for optimal performance, cache your formatters and parsers. For example: (a) on iterations, generate them outside the loop and reuse while looping; (b) on server applications, generate them in advance and execute when requests arrive.
|
||||
|
||||
### Compilation and the Runtime modules
|
||||
|
||||
Take advantage of compiling your formatters and/or parsers during build time when deploying to production. It's much faster than generating them in real-time and it's also much smaller (i.e., better loading performance).
|
||||
|
||||
Your compiled formatters and parsers allow you to skip a big part of the library and also allow you to skip loading CLDR data, because they have already been created (see [Performance](#performance) above for more information).
|
||||
|
||||
To illustrate, see our [Basic Globalize Compiler example][].
|
||||
|
||||
|
||||
#### Globalize Compiler
|
||||
|
||||
For information about the Globalize Compiler CLI or its JavaScript API, see the [Globalize Compiler documentation][].
|
||||
|
||||
[Globalize Compiler documentation]: https://github.com/globalizejs/globalize-compiler#README
|
||||
|
||||
### Examples
|
||||
|
||||
The fastest and easiest way to use Globalize is by integrating it into your existing tools.
|
||||
|
||||
- [Application example using webpack and npm](examples/app-npm-webpack/): easy to get started, automated CLDR loading and precompilation for production, but requires npm and webpack knowledge.
|
||||
- [Application example using globalize-express middleware with any express web app](https://github.com/devangnegandhi/globalize-express/tree/master/example): easy to incorporate globalize as a middleware within your Express web app. (also checkout [globalize-express](https://github.com/devangnegandhi/globalize))
|
||||
|
||||
If you're using a different tool than the one above, but you're comfortable using JavaScript modules (such as ES6 modules, CommonJS, or AMD) and package managers like npm or bower, you may want to check out the following examples. Note you'll need to compile your code for production yourself.
|
||||
|
||||
- [Basic example using AMD and bower](examples/amd-bower/): feeding Globalize on CLDR is not completely transparent.
|
||||
- [Basic example using Node.js and npm](examples/node-npm/): feeding Globalize on CLDR is not completely transparent.
|
||||
- [Basic Globalize Compiler example][]: shows how to use Globalize Compiler CLI.
|
||||
|
||||
[Basic Globalize Compiler example]: examples/globalize-compiler/
|
||||
|
||||
If you're using none of the tools above, but instead you're using the plain and old script tags only, the following example may interest you. Note Globalize allows you to go low level like this. But, acknowledge that you'll need to handle dependencies and CLDR loading manually yourself.
|
||||
|
||||
- [Basic example using plain JavaScript](examples/plain-javascript/): requires loading CLDR and handling dependencies manually.
|
||||
|
||||
### Community
|
||||
|
||||
You can find us on [Slack](https://globalizejs.slack.com/). If you're new, [join here](https://join.slack.com/t/globalizejs/shared_invite/zt-3tc3js1e-ETn09rNHL_5fclun8jtckQ).
|
||||
|
||||
## API
|
||||
|
||||
### Core module
|
||||
|
||||
#### `Globalize.load( cldrJSONData, ... )`
|
||||
|
||||
This method allows you to load CLDR JSON locale data. `Globalize.load()` is a proxy to `Cldr.load()`. [Read more...](doc/api/core/load.md)
|
||||
|
||||
#### `Globalize.locale( [locale|cldr] )`
|
||||
|
||||
Set default locale, or get it if locale argument is omitted. [Read more...](doc/api/core/locale.md)
|
||||
|
||||
#### `[new] Globalize( locale|cldr )`
|
||||
|
||||
Create a Globalize instance. [Read more...](doc/api/core/constructor.md)
|
||||
|
||||
#### Locales
|
||||
|
||||
A locale is an identifier (id) that refers to a set of user preferences that tend to be shared across significant swaths of the world. In technical terms, it's a String composed of three parts: language, script, and region. For example:
|
||||
|
||||
| locale | description |
|
||||
| ------------ | ---------------------------------------- |
|
||||
| *en-Latn-US* | English as spoken in the Unites States in the Latin script. |
|
||||
| *en-US* | English as spoken in the Unites States (Latin script is deduced given it's the most likely script used in this place). |
|
||||
| *en* | English (United States region and Latin script are deduced given they are respectively the most likely region and script used in this place). |
|
||||
| *en-GB* | English as spoken in the United Kingdom (Latin script is deduced given it's the most likely script used in this place). |
|
||||
| *en-IN* | English as spoken in India (Latin script is deduced). |
|
||||
| *es* | Spanish (Spain region and Latin script are deduced). |
|
||||
| *es-MX* | Spanish as spoken in Mexico (Latin script is deduced). |
|
||||
| *zh* | Chinese (China region and Simplified Han script are deduced). |
|
||||
| *zh-TW* | Chinese as spoken in Taiwan (Traditional Han script is deduced). |
|
||||
| *ja* | Japanese (Japan region and Japanese script are deduced). |
|
||||
| *de* | German (Germany region and Latin script are deduced). |
|
||||
| *pt* | Portuguese (Brazil region and Latin script are deduced). |
|
||||
| *pt-PT* | Portuguese as spoken in Portugal (Latin script is deduced). |
|
||||
| *fr* | French (France region and Latin script are deduced). |
|
||||
| *ru* | Russian (Russia region and Cyrillic script are deduced). |
|
||||
| *ar* | Arabic (Egypt region and Arabic script are deduced). |
|
||||
|
||||
The likely deductibility is computed by using CLDR data, which is based on the population and the suppress-script data in BCP47 (among others). The data is heuristically derived, and may change over time.
|
||||
|
||||
Figure out the deduced information by looking at the `cldr.attributes.maxLanguageId` property of a Globalize instance:
|
||||
|
||||
```js
|
||||
var Globalize = require( "globalize" );
|
||||
Globalize.load( require( "cldr-data" ).entireSupplemental() );
|
||||
Globalize( "en" ).cldr.attributes.maxLanguageId;
|
||||
// > "en-Latn-US"
|
||||
```
|
||||
|
||||
Globalize supports all the locales available in CLDR, which are around 740. For more information, search for coverage charts at the downloads section of http://cldr.unicode.org/.
|
||||
|
||||
Read more details about locale at [UTS#35 locale][].
|
||||
|
||||
[UTS#35 locale]: http://www.unicode.org/reports/tr35/#Locale
|
||||
|
||||
### Date module
|
||||
|
||||
#### `Globalize.loadTimeZone( ianaTzData )`
|
||||
|
||||
This method allows you to load IANA time zone data to enable `options.timeZone` feature on date formatters and parsers.
|
||||
|
||||
[Read more...](doc/api/date/load-iana-time-zone.md)
|
||||
|
||||
#### `.dateFormatter( [options] )`
|
||||
|
||||
Return a function that formats a date according to the given `options`. The default formatting is numeric year, month, and day (i.e., `{ skeleton: "yMd" }`.
|
||||
|
||||
```javascript
|
||||
.dateFormatter()( new Date() )
|
||||
// > "11/30/2010"
|
||||
|
||||
.dateFormatter({ skeleton: "GyMMMd" })( new Date() )
|
||||
// > "Nov 30, 2010 AD"
|
||||
|
||||
.dateFormatter({ date: "medium" })( new Date() )
|
||||
// > "Nov 1, 2010"
|
||||
|
||||
.dateFormatter({ time: "medium" })( new Date() )
|
||||
// > "5:55:00 PM"
|
||||
|
||||
.dateFormatter({ datetime: "medium" })( new Date() )
|
||||
// > "Nov 1, 2010, 5:55:00 PM"
|
||||
|
||||
.dateFormatter({ datetime: "full", timeZone: "America/New_York" })( new Date() );
|
||||
// > "Monday, November 1, 2010 at 3:55:00 AM Eastern Daylight Time"
|
||||
|
||||
.dateFormatter({ datetime: "full", timeZone: "America/Los_Angeles" })( new Date() );
|
||||
// > "Monday, November 1, 2010 at 12:55:00 AM Pacific Daylight Time"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/date/date-formatter.md)
|
||||
|
||||
#### `.dateToPartsFormatter( [options] )`
|
||||
|
||||
Return a function that formats a date into parts tokens according to the given `options`. The default formatting is numeric year, month, and day (i.e., `{ skeleton: "yMd" }`.
|
||||
|
||||
```javascript
|
||||
.dateToPartsFormatter()( new Date() )
|
||||
// > [
|
||||
// { "type": "month", "value": "3" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "day", "value": "17" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "year", "value": "2017" }
|
||||
// ]
|
||||
```
|
||||
|
||||
[Read more...](doc/api/date/date-to-parts-formatter.md)
|
||||
|
||||
#### `.dateParser( [options] )`
|
||||
|
||||
Return a function that parses a string representing a date into a JavaScript Date object according to the given `options`. The default parsing assumes numeric year, month, and day (i.e., `{ skeleton: "yMd" }`).
|
||||
|
||||
```javascript
|
||||
.dateParser()( "11/30/2010" )
|
||||
// > new Date( 2010, 10, 30, 0, 0, 0 )
|
||||
|
||||
.dateParser({ skeleton: "GyMMMd" })( "Nov 30, 2010 AD" )
|
||||
// > new Date( 2010, 10, 30, 0, 0, 0 )
|
||||
|
||||
.dateParser({ date: "medium" })( "Nov 1, 2010" )
|
||||
// > new Date( 2010, 10, 30, 0, 0, 0 )
|
||||
|
||||
.dateParser({ time: "medium" })( "5:55:00 PM" )
|
||||
// > new Date( 2015, 3, 22, 17, 55, 0 ) // i.e., today @ 5:55PM
|
||||
|
||||
.dateParser({ datetime: "medium" })( "Nov 1, 2010, 5:55:00 PM" )
|
||||
// > new Date( 2010, 10, 30, 17, 55, 0 )
|
||||
```
|
||||
|
||||
[Read more...](doc/api/date/date-parser.md)
|
||||
|
||||
#### `.formatDate( value [, options] )`
|
||||
|
||||
Alias for `.dateFormatter( [options] )( value )`.
|
||||
|
||||
#### `.formatDateToParts( value [, options] )`
|
||||
|
||||
Alias for `.dateToPartsFormatter( [options] )( value )`.
|
||||
|
||||
#### `.parseDate( value [, options] )`
|
||||
|
||||
Alias for `.dateParser( [options] )( value )`.
|
||||
|
||||
### Message module
|
||||
|
||||
#### `Globalize.loadMessages( json )`
|
||||
|
||||
Load messages data. [Read more...](doc/api/message/load-messages.md)
|
||||
|
||||
#### `.messageFormatter( path ) ➡ function( [variables] )`
|
||||
|
||||
Return a function that formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string. It supports pluralization and gender inflections.
|
||||
|
||||
```javascript
|
||||
.messageFormatter( "task" )( 1000 )
|
||||
// > "You have 1,000 tasks remaining"
|
||||
|
||||
.messageFormatter( "like" )( 3 )
|
||||
// > "You and 2 others liked this"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/message/message-formatter.md)
|
||||
|
||||
#### `.formatMessage( path [, variables ] )`
|
||||
|
||||
Alias for `.messageFormatter( path )([ variables ])`.
|
||||
|
||||
### Number module
|
||||
|
||||
#### `.numberFormatter( [options] )`
|
||||
|
||||
Return a function that formats a number according to the given options or locale's defaults.
|
||||
|
||||
```javascript
|
||||
.numberFormatter()( pi )
|
||||
// > "3.142"
|
||||
|
||||
.numberFormatter({ maximumFractionDigits: 5 })( pi )
|
||||
// > "3.14159"
|
||||
|
||||
.numberFormatter({ round: "floor" })( pi )
|
||||
// > "3.141"
|
||||
|
||||
.numberFormatter({ minimumFractionDigits: 2 })( 10000 )
|
||||
// > "10,000.00"
|
||||
|
||||
.numberFormatter({ style: "percent" })( 0.5 )
|
||||
// > "50%"
|
||||
|
||||
.numberFormatter({ compact: "short", maximumFractionDigits: 0 })( 14305 )
|
||||
// > "14K"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/number/number-formatter.md)
|
||||
|
||||
#### `.numberToPartsFormatter( [options] )`
|
||||
|
||||
Return a function that formats a number into parts tokens according to the given options or locale's defaults.
|
||||
|
||||
```javascript
|
||||
.numberToPartsFormatter()( new Date() )
|
||||
// > [
|
||||
// { "type": "integer", "value": "3" },
|
||||
// { "type": "decimal", "value": "." },
|
||||
// { "type": "fraction", "value": "142" }
|
||||
// ]
|
||||
```
|
||||
|
||||
[Read more...](doc/api/number/number-to-parts-formatter.md)
|
||||
|
||||
#### `.numberParser( [options] )`
|
||||
|
||||
Return a function that parses a string representing a number according to the given options or locale's defaults.
|
||||
|
||||
```javascript
|
||||
.numberParser()( "3.14159" )
|
||||
// > 3.14159
|
||||
|
||||
.numberParser()( "10,000.00" )
|
||||
// > 10000
|
||||
|
||||
.numberParser({ style: "percent" })( "50%" )
|
||||
// > 0.5
|
||||
```
|
||||
|
||||
[Read more...](doc/api/number/number-parser.md)
|
||||
|
||||
#### `.formatNumber( value [, options] )`
|
||||
|
||||
Alias for `.numberFormatter( [options] )( value )`.
|
||||
|
||||
#### `.formatNumberToParts( value [, options] )`
|
||||
|
||||
Alias for `.numberToPartsFormatter( [options] )( value )`.
|
||||
|
||||
#### `.parseNumber( value [, options] )`
|
||||
|
||||
Alias for `.numberParser( [options] )( value )`.
|
||||
|
||||
### Currency module
|
||||
|
||||
#### `.currencyFormatter( currency [, options] )`
|
||||
|
||||
Return a function that formats a currency according to the given options or locale's defaults.
|
||||
|
||||
```javascript
|
||||
.currencyFormatter( "USD" )( 1 )
|
||||
// > "$1.00"
|
||||
|
||||
.currencyFormatter( "USD", { style: "accounting" })( -1 )
|
||||
// > "($1.00)"
|
||||
|
||||
.currencyFormatter( "USD", { style: "name" })( 69900 )
|
||||
// > "69,900.00 US dollars"
|
||||
|
||||
.currencyFormatter( "USD", { style: "code" })( 69900 )
|
||||
// > "69,900.00 USD"
|
||||
|
||||
.currencyFormatter( "USD", { round: "ceil" })( 1.491 )
|
||||
// > "$1.50"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/currency/currency-formatter.md)
|
||||
|
||||
#### `.currencyToPartsFormatter( currency [, options] )`
|
||||
|
||||
Return a function that formats a currency into parts tokens according to the given options or locale's defaults.
|
||||
|
||||
```javascript
|
||||
.currencyToPartsFormatter()( new Date() )
|
||||
// > [
|
||||
// { "type": "currency", "value": "USD" },
|
||||
// { "type": "literal", "value": " " },
|
||||
// { "type": "integer", "value": "69" },
|
||||
// { "type": "group", "value": "," },
|
||||
// { "type": "integer", "value": "900" },
|
||||
// { "type": "decimal", "value": "." },
|
||||
// { "type": "fraction", "value": "00" }
|
||||
// ]
|
||||
```
|
||||
|
||||
[Read more...](doc/api/currency/currency-to-parts-formatter.md)
|
||||
|
||||
#### `.formatCurrency( value, currency [, options] )`
|
||||
|
||||
Alias for `.currencyFormatter( currency [, options] )( value )`.
|
||||
|
||||
#### `.formatCurrencyToParts( value, currency [, options] )`
|
||||
|
||||
Alias for `.currencyToPartsFormatter( currency [, options] )( value )`.
|
||||
|
||||
### Plural module
|
||||
|
||||
#### `.pluralGenerator( [options] )`
|
||||
|
||||
Return a function that returns the value's corresponding plural group: `zero`, `one`, `two`, `few`, `many`, or `other`.
|
||||
|
||||
The function may be used for cardinals or ordinals.
|
||||
|
||||
```javascript
|
||||
.pluralGenerator()( 0 )
|
||||
// > "other"
|
||||
|
||||
.pluralGenerator()( 1 )
|
||||
// > "one"
|
||||
|
||||
.pluralGenerator({ type: "ordinal" })( 1 )
|
||||
// > "one"
|
||||
|
||||
.pluralGenerator({ type: "ordinal" })( 2 )
|
||||
// > "two"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/plural/plural-generator.md)
|
||||
|
||||
#### `.plural( value[, options ] )`
|
||||
|
||||
Alias for `.pluralGenerator( [options] )( value )`.
|
||||
|
||||
### Relative time module
|
||||
|
||||
#### `.relativeTimeFormatter( unit [, options] )`
|
||||
|
||||
Returns a function that formats a relative time according to the given unit, options, and the default/instance locale.
|
||||
|
||||
```javascript
|
||||
.relativeTimeFormatter( "day" )( 1 )
|
||||
// > "tomorrow"
|
||||
|
||||
.relativeTimeFormatter( "month" )( -1 )
|
||||
// > "last month"
|
||||
|
||||
.relativeTimeFormatter( "month" )( 3 )
|
||||
// > "in 3 months"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/relative-time/relative-time-formatter.md)
|
||||
|
||||
#### `.formatRelativeTime( value, unit [, options] )`
|
||||
|
||||
Alias for `.relativeTimeFormatter( unit, options )( value )`.
|
||||
|
||||
### Unit module
|
||||
|
||||
#### `.unitFormatter( unit [, options] )`
|
||||
|
||||
Returns a function that formats a unit according to the given unit, options, and the default/instance locale.
|
||||
|
||||
```javascript
|
||||
.unitFormatter( "second" )( 10 )
|
||||
// > "10 seconds"
|
||||
|
||||
.unitFormatter( "second", { form: "short" } )( 10 )
|
||||
// > "10 secs"
|
||||
|
||||
.unitFormatter( "second", { form: "narrow" } )( 10 )
|
||||
// > "10s"
|
||||
```
|
||||
|
||||
[Read more...](doc/api/unit/unit-formatter.md)
|
||||
|
||||
#### `.formatUnit( value, unit [, options] )`
|
||||
|
||||
Alias for `.unitFormatter( unit, options )( value )`.
|
||||
|
||||
## Error reference
|
||||
|
||||
### CLDR Errors
|
||||
|
||||
- **`E_INVALID_CLDR`**
|
||||
|
||||
Thrown when a CLDR item has an invalid or unexpected value.
|
||||
|
||||
[Read more...](doc/error/e-invalid-cldr.md)
|
||||
|
||||
- **`E_MISSING_CLDR`**
|
||||
|
||||
Thrown when any required CLDR item is NOT found.
|
||||
|
||||
[Read more...](doc/error/e-missing-cldr.md)
|
||||
|
||||
### Parameter Errors
|
||||
|
||||
- **`E_INVALID_PAR_TYPE`**
|
||||
|
||||
Thrown when a parameter has an invalid type on any static or instance methods.
|
||||
|
||||
[Read more...](doc/error/e-invalid-par-type.md)
|
||||
|
||||
- **`E_INVALID_PAR_VALUE`**
|
||||
|
||||
Thrown for certain parameters when the type is correct, but the value is
|
||||
invalid.
|
||||
|
||||
[Read more...](doc/error/e-invalid-par-value.md)
|
||||
|
||||
- **`E_MISSING_PARAMETER`**
|
||||
|
||||
Thrown when a required parameter is missing on any static or instance methods.
|
||||
|
||||
[Read more...](doc/error/e-missing-parameter.md)
|
||||
|
||||
- **`E_PAR_OUT_OF_RANGE`**
|
||||
|
||||
Thrown when a parameter is not within a valid range of values.
|
||||
|
||||
[Read more...](doc/error/e-par-out-of-range.md)
|
||||
|
||||
### Other Errors
|
||||
|
||||
- **`E_DEFAULT_LOCALE_NOT_DEFINED`**
|
||||
|
||||
Thrown when any static method, eg. `Globalize.formatNumber()` is used prior to setting the Global locale with `Globalize.locale( <locale> )`.
|
||||
|
||||
[Read more...](doc/error/e-default-locale-not-defined.md)
|
||||
|
||||
- **`E_MISSING_PLURAL_MODULE`**
|
||||
|
||||
Thrown when plural module is needed, but not loaded, eg. to format currencies using the named form.
|
||||
|
||||
[Read more...](doc/error/e-missing-plural-module.md)
|
||||
|
||||
- **`E_UNSUPPORTED`**
|
||||
|
||||
Thrown for unsupported features, eg. to format unsupported date patterns.
|
||||
|
||||
[Read more...](doc/error/e-unsupported.md)
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
If you are having trouble using Globalize after reading the documentation carefully, please post a question to [StackOverflow with the "javascript-globalize" tag][]. Questions that include a minimal demo are more likely to receive responses.
|
||||
|
||||
In the spirit of open source software development, we always encourage community code contribution. To help you get started and before you jump into writing code, be sure to read [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
|
||||
[StackOverflow with the "javascript-globalize" tag]: http://stackoverflow.com/tags/javascript-globalize
|
||||
|
||||
For ideas where to start contributing, see the following queries to find what best suites your interest: [quick change][], [new features][], [bug fixes][], [documentation improvements][], [date module][], [currency module][], [message module][], [number module][], [plural module][], [relative time module][]. Last but not least, feel free to [get in touch](http://irc.jquery.org/).
|
||||
|
||||
[bug fixes]: https://github.com/globalizejs/globalize/labels/bug
|
||||
[documentation improvements]: https://github.com/globalizejs/globalize/labels/docs
|
||||
[new features]: https://github.com/globalizejs/globalize/labels/new%20feature
|
||||
[quick change]: https://github.com/globalizejs/globalize/labels/quick%20change
|
||||
|
||||
[currency module]: https://github.com/globalizejs/globalize/labels/currency%20module
|
||||
[date module]: https://github.com/globalizejs/globalize/labels/date%20module
|
||||
[message module]: https://github.com/globalizejs/globalize/labels/message%20module
|
||||
[number module]: https://github.com/globalizejs/globalize/labels/number%20module
|
||||
[plural module]: https://github.com/globalizejs/globalize/labels/plural%20module
|
||||
[relative time module]: https://github.com/globalizejs/globalize/labels/relative%20time%20module
|
||||
|
||||
### Roadmap
|
||||
|
||||
Our roadmap is the collection of all open issues and pull requests where you can find:
|
||||
|
||||
- [Ongoing work][] lists our current sprint. Here you find where we're actively working on at this very moment. Priority is determined by the community needs and volunteering. If there is anything you want to be done, share your thoughts with us on any existing or new issue and especially volunteer to do it.
|
||||
- [Everything else][] is potential next work that you could help us to accomplish now. Releases are published following semver rules as often as possible.
|
||||
|
||||
[Ongoing work]: https://github.com/globalizejs/globalize/labels/Current%20Sprint
|
||||
[Everything else]: https://github.com/globalizejs/globalize/issues?utf8=%E2%9C%93&q=is%3Aopen+-label%3A%22Current+Sprint%22+
|
||||
|
||||
## Development
|
||||
|
||||
### File structure
|
||||
```
|
||||
├── bower.json (metadata file)
|
||||
├── CONTRIBUTING.md (doc file)
|
||||
├── dist/ (consumable files, the built files)
|
||||
├── external/ (external dependencies, eg. cldr.js, QUnit, RequireJS)
|
||||
├── Gruntfile.js (Grunt tasks)
|
||||
├── LICENSE (license file)
|
||||
├── package.json (metadata file)
|
||||
├── README.md (doc file)
|
||||
├── src/ (source code)
|
||||
│ ├── build/ (build helpers, eg. intro, and outro)
|
||||
│ ├── common/ (common function helpers across modules)
|
||||
│ ├── core.js (core module)
|
||||
│ ├── date/ (date source code)
|
||||
│ ├── date.js (date module)
|
||||
│ ├── message.js (message module)
|
||||
│ ├── number.js (number module)
|
||||
│ ├── number/ (number source code)
|
||||
│ ├── plural.js (plural module)
|
||||
│ ├── plural/ (plural source code)
|
||||
│ ├── relative-time.js (relative time module)
|
||||
│ ├── relative-time/ (relative time source code)
|
||||
│ ├── unit.js (unit module)
|
||||
│ ├── unit/ (unit source code)
|
||||
│ └── util/ (basic JavaScript helpers polyfills, eg array.map)
|
||||
└── test/ (unit and functional test files)
|
||||
├── fixtures/ (CLDR fixture data)
|
||||
├── functional/ (functional tests)
|
||||
├── functional.html
|
||||
├── functional.js
|
||||
├── unit/ (unit tests)
|
||||
├── unit.html
|
||||
└── unit.js
|
||||
```
|
||||
|
||||
### Source files
|
||||
|
||||
The source files are as granular as possible. When combined to generate the build file, all the excessive/overhead wrappers are cut off. It's following the same build model of jQuery and Modernizr.
|
||||
|
||||
Core, and all modules' public APIs are located in the `src/` directory, ie. `core.js`, `date.js`, `message.js`, `number.js`, and `plural.js`.
|
||||
|
||||
### Install development external dependencies
|
||||
|
||||
Install Grunt and 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 installed globally (like this: `npm install -g grunt-cli bower`). Then:
|
||||
|
||||
```bash
|
||||
npm install && bower install
|
||||
```
|
||||
|
||||
### Tests
|
||||
|
||||
Tests can be run either in the browser or using Node.js (via Grunt) after having installed the external development dependencies (for more details, see above).
|
||||
|
||||
#### Unit tests
|
||||
|
||||
To run the unit tests, run `grunt test:unit`, or run `grunt connect:keepalive` and open `http://localhost:9001/test/unit.html` in a browser. It tests the very specific functionality of each function (sometimes internal/private).
|
||||
|
||||
The goal of the unit tests is to make it easy to spot bugs, easy to debug.
|
||||
|
||||
#### Functional tests
|
||||
|
||||
To run the functional tests, create the dist files by running `grunt`. Then, run `grunt test:functional`, or open `http://localhost:9001/test/functional.html` in a browser. Note that `grunt` will automatically run unit and functional tests for you to ensure the built files are safe.
|
||||
|
||||
The goal of the functional tests is to ensure that everything works as expected when it is combined.
|
||||
|
||||
### Build
|
||||
|
||||
Build the distribution files after having installed the external development dependencies (for more details, see above).
|
||||
|
||||
```bash
|
||||
grunt
|
||||
```
|
||||
326
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime.js
generated
vendored
Normal file
326
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime.js
generated
vendored
Normal file
@@ -0,0 +1,326 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define( factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory();
|
||||
} else {
|
||||
|
||||
// Globalize
|
||||
root.Globalize = factory();
|
||||
}
|
||||
}( this, function() {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A toString method that outputs meaningful values for objects or arrays and
|
||||
* still performs as fast as a plain string in case variable is string, or as
|
||||
* fast as `"" + number` in case variable is a number.
|
||||
* Ref: http://jsperf.com/my-stringify
|
||||
*/
|
||||
var toString = function( variable ) {
|
||||
return typeof variable === "string" ? variable : ( typeof variable === "number" ? "" +
|
||||
variable : JSON.stringify( variable ) );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* formatMessage( message, data )
|
||||
*
|
||||
* @message [String] A message with optional {vars} to be replaced.
|
||||
*
|
||||
* @data [Array or JSON] Object with replacing-variables content.
|
||||
*
|
||||
* Return the formatted message. For example:
|
||||
*
|
||||
* - formatMessage( "{0} second", [ 1 ] ); // 1 second
|
||||
*
|
||||
* - formatMessage( "{0}/{1}", ["m", "s"] ); // m/s
|
||||
*
|
||||
* - formatMessage( "{name} <{email}>", {
|
||||
* name: "Foo",
|
||||
* email: "bar@baz.qux"
|
||||
* }); // Foo <bar@baz.qux>
|
||||
*/
|
||||
var formatMessage = function( message, data ) {
|
||||
|
||||
// Replace {attribute}'s
|
||||
message = message.replace( /{[0-9a-zA-Z-_. ]+}/g, function( name ) {
|
||||
name = name.replace( /^{([^}]*)}$/, "$1" );
|
||||
return toString( data[ name ] );
|
||||
});
|
||||
|
||||
return message;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var objectExtend = function() {
|
||||
var destination = arguments[ 0 ],
|
||||
sources = [].slice.call( arguments, 1 );
|
||||
|
||||
sources.forEach(function( source ) {
|
||||
var prop;
|
||||
for ( prop in source ) {
|
||||
destination[ prop ] = source[ prop ];
|
||||
}
|
||||
});
|
||||
|
||||
return destination;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var createError = function( code, message, attributes ) {
|
||||
var error;
|
||||
|
||||
message = code + ( message ? ": " + formatMessage( message, attributes ) : "" );
|
||||
error = new Error( message );
|
||||
error.code = code;
|
||||
|
||||
objectExtend( error, attributes );
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Pushes part to parts array, concat two consecutive parts of the same type.
|
||||
*/
|
||||
var partsPush = function( parts, type, value ) {
|
||||
|
||||
// Concat two consecutive parts of same type
|
||||
if ( parts.length && parts[ parts.length - 1 ].type === type ) {
|
||||
parts[ parts.length - 1 ].value += value;
|
||||
return;
|
||||
}
|
||||
|
||||
parts.push( { type: type, value: value } );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* formatMessage( message, data )
|
||||
*
|
||||
* @message [String] A message with optional {vars} to be replaced.
|
||||
*
|
||||
* @data [Array or JSON] Object with replacing-variables content.
|
||||
*
|
||||
* Return the formatted message. For example:
|
||||
*
|
||||
* - formatMessage( "{0} second", [ 1 ] );
|
||||
* > [{type: "variable", value: "1", name: "0"}, {type: "literal", value: " second"}]
|
||||
*
|
||||
* - formatMessage( "{0}/{1}", ["m", "s"] );
|
||||
* > [
|
||||
* { type: "variable", value: "m", name: "0" },
|
||||
* { type: "literal", value: " /" },
|
||||
* { type: "variable", value: "s", name: "1" }
|
||||
* ]
|
||||
*/
|
||||
var formatMessageToParts = function( message, data ) {
|
||||
|
||||
var lastOffset = 0,
|
||||
parts = [];
|
||||
|
||||
// Create parts.
|
||||
message.replace( /{[0-9a-zA-Z-_. ]+}/g, function( nameIncludingBrackets, offset ) {
|
||||
var name = nameIncludingBrackets.slice( 1, -1 );
|
||||
partsPush( parts, "literal", message.slice( lastOffset, offset ));
|
||||
partsPush( parts, "variable", data[ name ] );
|
||||
parts[ parts.length - 1 ].name = name;
|
||||
lastOffset += offset + nameIncludingBrackets.length;
|
||||
});
|
||||
|
||||
// Skip empty ones such as `{ type: 'literal', value: '' }`.
|
||||
return parts.filter(function( part ) {
|
||||
return part.value !== "";
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns joined parts values.
|
||||
*/
|
||||
var partsJoin = function( parts ) {
|
||||
return parts.map( function( part ) {
|
||||
return part.value;
|
||||
}).join( "" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var runtimeStringify = function( args ) {
|
||||
return JSON.stringify( args, function( _key, value ) {
|
||||
if ( value && value.runtimeKey ) {
|
||||
return value.runtimeKey;
|
||||
}
|
||||
return value;
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Based on http://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery
|
||||
var stringHash = function( str ) {
|
||||
return [].reduce.call( str, function( hash, i ) {
|
||||
var chr = i.charCodeAt( 0 );
|
||||
hash = ( ( hash << 5 ) - hash ) + chr;
|
||||
return hash | 0;
|
||||
}, 0 );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var runtimeKey = function( fnName, locale, args, argsStr ) {
|
||||
var hash;
|
||||
argsStr = argsStr || runtimeStringify( args );
|
||||
hash = stringHash( fnName + locale + argsStr );
|
||||
return hash > 0 ? "a" + hash : "b" + Math.abs( hash );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validate = function( code, message, check, attributes ) {
|
||||
if ( !check ) {
|
||||
throw createError( code, message, attributes );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterPresence = function( value, name ) {
|
||||
validate( "E_MISSING_PARAMETER", "Missing required parameter `{name}`.",
|
||||
value !== undefined, { name: name });
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterType = function( value, name, check, expected ) {
|
||||
validate(
|
||||
"E_INVALID_PAR_TYPE",
|
||||
"Invalid `{name}` parameter ({value}). {expected} expected.",
|
||||
check,
|
||||
{
|
||||
expected: expected,
|
||||
name: name,
|
||||
value: value
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypeString = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || typeof value === "string",
|
||||
"a string"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions?redirectlocale=en-US&redirectslug=JavaScript%2FGuide%2FRegular_Expressions
|
||||
var regexpEscape = function( string ) {
|
||||
return string.replace( /([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var stringPad = function( str, count, right ) {
|
||||
var length;
|
||||
if ( typeof str !== "string" ) {
|
||||
str = String( str );
|
||||
}
|
||||
for ( length = str.length; length < count; length += 1 ) {
|
||||
str = ( right ? ( str + "0" ) : ( "0" + str ) );
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function Globalize( locale ) {
|
||||
if ( !( this instanceof Globalize ) ) {
|
||||
return new Globalize( locale );
|
||||
}
|
||||
|
||||
validateParameterPresence( locale, "locale" );
|
||||
validateParameterTypeString( locale, "locale" );
|
||||
|
||||
this._locale = locale;
|
||||
}
|
||||
|
||||
Globalize.locale = function( locale ) {
|
||||
validateParameterTypeString( locale, "locale" );
|
||||
|
||||
if ( arguments.length ) {
|
||||
this._locale = locale;
|
||||
}
|
||||
return this._locale;
|
||||
};
|
||||
|
||||
Globalize._createError = createError;
|
||||
Globalize._formatMessage = formatMessage;
|
||||
Globalize._formatMessageToParts = formatMessageToParts;
|
||||
Globalize._partsJoin = partsJoin;
|
||||
Globalize._partsPush = partsPush;
|
||||
Globalize._regexpEscape = regexpEscape;
|
||||
Globalize._runtimeKey = runtimeKey;
|
||||
Globalize._stringPad = stringPad;
|
||||
Globalize._validateParameterPresence = validateParameterPresence;
|
||||
Globalize._validateParameterTypeString = validateParameterTypeString;
|
||||
Globalize._validateParameterType = validateParameterType;
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
183
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/currency.js
generated
vendored
Normal file
183
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/currency.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"../globalize-runtime",
|
||||
"./number"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory(
|
||||
require( "../globalize-runtime" ),
|
||||
require( "./number" )
|
||||
);
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Globalize );
|
||||
}
|
||||
}(this, function( Globalize ) {
|
||||
|
||||
|
||||
|
||||
var formatMessageToParts = Globalize._formatMessageToParts,
|
||||
partsJoin = Globalize._partsJoin,
|
||||
partsPush = Globalize._partsPush,
|
||||
runtimeKey = Globalize._runtimeKey,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterTypeNumber = Globalize._validateParameterTypeNumber;
|
||||
|
||||
|
||||
var currencyFormatterFn = function( currencyToPartsFormatter ) {
|
||||
return function currencyFormatter( value ) {
|
||||
return partsJoin( currencyToPartsFormatter( value ));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* nameFormat( formattedNumber, pluralForm, properties )
|
||||
*
|
||||
* Return the appropriate name form currency format.
|
||||
*/
|
||||
var currencyNameFormat = function( formattedNumber, pluralForm, properties ) {
|
||||
var displayName, unitPattern,
|
||||
parts = [],
|
||||
displayNames = properties.displayNames || {},
|
||||
unitPatterns = properties.unitPatterns;
|
||||
|
||||
displayName = displayNames[ "displayName-count-" + pluralForm ] ||
|
||||
displayNames[ "displayName-count-other" ] ||
|
||||
displayNames.displayName ||
|
||||
properties.currency;
|
||||
unitPattern = unitPatterns[ "unitPattern-count-" + pluralForm ] ||
|
||||
unitPatterns[ "unitPattern-count-other" ];
|
||||
|
||||
formatMessageToParts( unitPattern, [ formattedNumber, displayName ]).forEach(function( part ) {
|
||||
if ( part.type === "variable" && part.name === "0" ) {
|
||||
part.value.forEach(function( part ) {
|
||||
partsPush( parts, part.type, part.value );
|
||||
});
|
||||
} else if ( part.type === "variable" && part.name === "1" ) {
|
||||
partsPush( parts, "currency", part.value );
|
||||
} else {
|
||||
partsPush( parts, "literal", part.value );
|
||||
}
|
||||
});
|
||||
|
||||
return parts;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* symbolFormat( parts, symbol )
|
||||
*
|
||||
* Return the appropriate symbol/account form format.
|
||||
*/
|
||||
var currencySymbolFormat = function( parts, symbol ) {
|
||||
parts.forEach(function( part ) {
|
||||
if ( part.type === "currency" ) {
|
||||
part.value = symbol;
|
||||
}
|
||||
});
|
||||
return parts;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var currencyToPartsFormatterFn = function( numberToPartsFormatter, pluralGenerator, properties ) {
|
||||
var fn;
|
||||
|
||||
// Return formatter when style is "name".
|
||||
if ( pluralGenerator && properties ) {
|
||||
fn = function currencyToPartsFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
return currencyNameFormat(
|
||||
numberToPartsFormatter( value ),
|
||||
pluralGenerator( value ),
|
||||
properties
|
||||
);
|
||||
};
|
||||
|
||||
// Return formatter when style is "symbol", "accounting", or "code".
|
||||
} else {
|
||||
fn = function currencyToPartsFormatter( value ) {
|
||||
|
||||
// 1: Reusing pluralGenerator argument, but in this case it is actually `symbol`
|
||||
return currencySymbolFormat( numberToPartsFormatter( value ), pluralGenerator /* 1 */ );
|
||||
};
|
||||
}
|
||||
|
||||
return fn;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Globalize._currencyFormatterFn = currencyFormatterFn;
|
||||
Globalize._currencyNameFormat = currencyNameFormat;
|
||||
Globalize._currencyToPartsFormatterFn = currencyToPartsFormatterFn;
|
||||
|
||||
Globalize.currencyFormatter =
|
||||
Globalize.prototype.currencyFormatter = function( currency, options ) {
|
||||
options = options || {};
|
||||
return Globalize[ runtimeKey( "currencyFormatter", this._locale, [ currency, options ] ) ];
|
||||
};
|
||||
|
||||
Globalize.currencyToPartsFormatter =
|
||||
Globalize.prototype.currencyToPartsFormatter = function( currency, options ) {
|
||||
options = options || {};
|
||||
return Globalize[
|
||||
runtimeKey( "currencyToPartsFormatter", this._locale, [ currency, options ] )
|
||||
];
|
||||
};
|
||||
|
||||
Globalize.formatCurrency =
|
||||
Globalize.prototype.formatCurrency = function( value, currency, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.currencyFormatter( currency, options )( value );
|
||||
};
|
||||
|
||||
Globalize.formatCurrencyToParts =
|
||||
Globalize.prototype.formatCurrencyToParts = function( value, currency, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.currencyToPartsFormatter( currency, options )( value );
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
1657
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/date.js
generated
vendored
Normal file
1657
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/date.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
120
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/message.js
generated
vendored
Normal file
120
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/message.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"../globalize-runtime"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "../globalize-runtime" ) );
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Globalize );
|
||||
}
|
||||
}(this, function( Globalize ) {
|
||||
|
||||
|
||||
|
||||
var runtimeKey = Globalize._runtimeKey,
|
||||
validateParameterType = Globalize._validateParameterType;
|
||||
|
||||
|
||||
/**
|
||||
* Function inspired by jQuery Core, but reduced to our use case.
|
||||
*/
|
||||
var isPlainObject = function( obj ) {
|
||||
return obj !== null && "" + obj === "[object Object]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypeMessageVariables = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || isPlainObject( value ) || Array.isArray( value ),
|
||||
"Array or Plain Object"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var messageFormatterFn = function( formatter ) {
|
||||
return function messageFormatter( variables ) {
|
||||
if ( typeof variables === "number" || typeof variables === "string" ) {
|
||||
variables = [].slice.call( arguments, 0 );
|
||||
}
|
||||
validateParameterTypeMessageVariables( variables, "variables" );
|
||||
return formatter( variables );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Globalize._messageFormatterFn = messageFormatterFn;
|
||||
/* eslint-disable */
|
||||
Globalize._messageFormat = (function() {
|
||||
var number = function(value, offset) {
|
||||
if (isNaN(value)) throw new Error("'" + value + "' isn't a number.");
|
||||
return value - (offset || 0);
|
||||
};
|
||||
var plural = function(value, offset, lcfunc, data, isOrdinal) {
|
||||
if ({}.hasOwnProperty.call(data, value)) return data[value]();
|
||||
if (offset) value -= offset;
|
||||
var key = lcfunc(value, isOrdinal);
|
||||
if (key in data) return data[key]();
|
||||
return data.other();
|
||||
};
|
||||
var select = function(value, data) {
|
||||
if ({}.hasOwnProperty.call(data, value)) return data[value]();
|
||||
return data.other()
|
||||
};
|
||||
|
||||
return {number: number, plural: plural, select: select};
|
||||
}());
|
||||
/* eslint-enable */
|
||||
Globalize._validateParameterTypeMessageVariables = validateParameterTypeMessageVariables;
|
||||
|
||||
Globalize.messageFormatter =
|
||||
Globalize.prototype.messageFormatter = function( /* path */ ) {
|
||||
return Globalize[
|
||||
runtimeKey( "messageFormatter", this._locale, [].slice.call( arguments, 0 ) )
|
||||
];
|
||||
};
|
||||
|
||||
Globalize.formatMessage =
|
||||
Globalize.prototype.formatMessage = function( path /* , variables */ ) {
|
||||
return this.messageFormatter( path ).apply( {}, [].slice.call( arguments, 1 ) );
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
919
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/number.js
generated
vendored
Normal file
919
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/number.js
generated
vendored
Normal file
@@ -0,0 +1,919 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"../globalize-runtime"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "../globalize-runtime" ) );
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Globalize );
|
||||
}
|
||||
}(this, function( Globalize ) {
|
||||
|
||||
|
||||
|
||||
var createError = Globalize._createError,
|
||||
partsJoin = Globalize._partsJoin,
|
||||
partsPush = Globalize._partsPush,
|
||||
regexpEscape = Globalize._regexpEscape,
|
||||
runtimeKey = Globalize._runtimeKey,
|
||||
stringPad = Globalize._stringPad,
|
||||
validateParameterType = Globalize._validateParameterType,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterTypeString = Globalize._validateParameterTypeString;
|
||||
|
||||
|
||||
var createErrorUnsupportedFeature = function( feature ) {
|
||||
return createError( "E_UNSUPPORTED", "Unsupported {feature}.", {
|
||||
feature: feature
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypeNumber = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || typeof value === "number",
|
||||
"Number"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* EBNF representation:
|
||||
*
|
||||
* compact_pattern_re = prefix?
|
||||
* number_pattern_re
|
||||
* suffix?
|
||||
*
|
||||
* number_pattern_re = 0+
|
||||
*
|
||||
* Regexp groups:
|
||||
*
|
||||
* 0: compact_pattern_re
|
||||
* 1: prefix
|
||||
* 2: number_pattern_re (the number pattern to use in compact mode)
|
||||
* 3: suffix
|
||||
*/
|
||||
var numberCompactPatternRe = ( /^([^0]*)(0+)([^0]*)$/ );
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* goupingSeparator( number, primaryGroupingSize, secondaryGroupingSize )
|
||||
*
|
||||
* @number [Number].
|
||||
*
|
||||
* @primaryGroupingSize [Number]
|
||||
*
|
||||
* @secondaryGroupingSize [Number]
|
||||
*
|
||||
* Return the formatted number with group separator.
|
||||
*/
|
||||
var numberFormatGroupingSeparator = function( number, primaryGroupingSize, secondaryGroupingSize ) {
|
||||
var index,
|
||||
currentGroupingSize = primaryGroupingSize,
|
||||
ret = "",
|
||||
sep = ",",
|
||||
switchToSecondary = secondaryGroupingSize ? true : false;
|
||||
|
||||
number = String( number ).split( "." );
|
||||
index = number[ 0 ].length;
|
||||
|
||||
while ( index > currentGroupingSize ) {
|
||||
ret = number[ 0 ].slice( index - currentGroupingSize, index ) +
|
||||
( ret.length ? sep : "" ) + ret;
|
||||
index -= currentGroupingSize;
|
||||
if ( switchToSecondary ) {
|
||||
currentGroupingSize = secondaryGroupingSize;
|
||||
switchToSecondary = false;
|
||||
}
|
||||
}
|
||||
|
||||
number[ 0 ] = number[ 0 ].slice( 0, index ) + ( ret.length ? sep : "" ) + ret;
|
||||
return number.join( "." );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* integerFractionDigits( number, minimumIntegerDigits, minimumFractionDigits,
|
||||
* maximumFractionDigits, round, roundIncrement )
|
||||
*
|
||||
* @number [Number]
|
||||
*
|
||||
* @minimumIntegerDigits [Number]
|
||||
*
|
||||
* @minimumFractionDigits [Number]
|
||||
*
|
||||
* @maximumFractionDigits [Number]
|
||||
*
|
||||
* @round [Function]
|
||||
*
|
||||
* @roundIncrement [Function]
|
||||
*
|
||||
* Return the formatted integer and fraction digits.
|
||||
*/
|
||||
var numberFormatIntegerFractionDigits = function( number, minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits, round,
|
||||
roundIncrement ) {
|
||||
|
||||
// Fraction
|
||||
if ( maximumFractionDigits ) {
|
||||
|
||||
// Rounding
|
||||
if ( roundIncrement ) {
|
||||
number = round( number, roundIncrement );
|
||||
|
||||
// Maximum fraction digits
|
||||
} else {
|
||||
number = round( number, { exponent: -maximumFractionDigits } );
|
||||
}
|
||||
|
||||
} else {
|
||||
number = round( number );
|
||||
}
|
||||
|
||||
number = String( number );
|
||||
|
||||
// Maximum integer digits (post string phase)
|
||||
if ( maximumFractionDigits && /e-/.test( number ) ) {
|
||||
|
||||
// Use toFixed( maximumFractionDigits ) to make sure small numbers like 1e-7 are
|
||||
// displayed using plain digits instead of scientific notation.
|
||||
// 1: Remove leading decimal zeros.
|
||||
// 2: Remove leading decimal separator.
|
||||
// Note: String() is still preferred so it doesn't mess up with a number precision
|
||||
// unnecessarily, e.g., (123456789.123).toFixed(10) === "123456789.1229999959",
|
||||
// String(123456789.123) === "123456789.123".
|
||||
number = ( +number ).toFixed( maximumFractionDigits )
|
||||
.replace( /0+$/, "" ) /* 1 */
|
||||
.replace( /\.$/, "" ); /* 2 */
|
||||
}
|
||||
|
||||
// Minimum fraction digits (post string phase)
|
||||
if ( minimumFractionDigits ) {
|
||||
number = number.split( "." );
|
||||
number[ 1 ] = stringPad( number[ 1 ] || "", minimumFractionDigits, true );
|
||||
number = number.join( "." );
|
||||
}
|
||||
|
||||
// Minimum integer digits
|
||||
if ( minimumIntegerDigits ) {
|
||||
number = number.split( "." );
|
||||
number[ 0 ] = stringPad( number[ 0 ], minimumIntegerDigits );
|
||||
number = number.join( "." );
|
||||
}
|
||||
|
||||
return number;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* toPrecision( number, precision, round )
|
||||
*
|
||||
* @number (Number)
|
||||
*
|
||||
* @precision (Number) significant figures precision (not decimal precision).
|
||||
*
|
||||
* @round (Function)
|
||||
*
|
||||
* Return number.toPrecision( precision ) using the given round function.
|
||||
*/
|
||||
var numberToPrecision = function( number, precision, round ) {
|
||||
var roundOrder;
|
||||
|
||||
if ( number === 0 ) { // Fix #706
|
||||
return number;
|
||||
}
|
||||
|
||||
roundOrder = Math.ceil( Math.log( Math.abs( number ) ) / Math.log( 10 ) );
|
||||
roundOrder -= precision;
|
||||
|
||||
return round( number, { exponent: roundOrder } );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* toPrecision( number, minimumSignificantDigits, maximumSignificantDigits, round )
|
||||
*
|
||||
* @number [Number]
|
||||
*
|
||||
* @minimumSignificantDigits [Number]
|
||||
*
|
||||
* @maximumSignificantDigits [Number]
|
||||
*
|
||||
* @round [Function]
|
||||
*
|
||||
* Return the formatted significant digits number.
|
||||
*/
|
||||
var numberFormatSignificantDigits = function( number, minimumSignificantDigits, maximumSignificantDigits, round ) {
|
||||
var atMinimum, atMaximum;
|
||||
|
||||
// Sanity check.
|
||||
if ( minimumSignificantDigits > maximumSignificantDigits ) {
|
||||
maximumSignificantDigits = minimumSignificantDigits;
|
||||
}
|
||||
|
||||
atMinimum = numberToPrecision( number, minimumSignificantDigits, round );
|
||||
atMaximum = numberToPrecision( number, maximumSignificantDigits, round );
|
||||
|
||||
// Use atMaximum only if it has more significant digits than atMinimum.
|
||||
number = +atMinimum === +atMaximum ? atMinimum : atMaximum;
|
||||
|
||||
// Expand integer numbers, eg. 123e5 to 12300.
|
||||
number = ( +number ).toString( 10 );
|
||||
|
||||
if ( ( /e/ ).test( number ) ) {
|
||||
throw createErrorUnsupportedFeature({
|
||||
feature: "integers out of (1e21, 1e-7)"
|
||||
});
|
||||
}
|
||||
|
||||
// Add trailing zeros if necessary.
|
||||
if ( minimumSignificantDigits - number.replace( /^0+|\./g, "" ).length > 0 ) {
|
||||
number = number.split( "." );
|
||||
number[ 1 ] = stringPad( number[ 1 ] || "", minimumSignificantDigits - number[ 0 ].replace( /^0+/, "" ).length, true );
|
||||
number = number.join( "." );
|
||||
}
|
||||
|
||||
return number;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var numberSymbolName = {
|
||||
".": "decimal",
|
||||
",": "group",
|
||||
"%": "percentSign",
|
||||
"+": "plusSign",
|
||||
"-": "minusSign",
|
||||
"E": "exponential",
|
||||
"\u2030": "perMille"
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* removeLiteralQuotes( string )
|
||||
*
|
||||
* Return:
|
||||
* - `'` if input string is `''`.
|
||||
* - `o'clock` if input string is `'o''clock'`.
|
||||
* - `foo` if input string is `foo`, i.e., return the same value in case it isn't a single-quoted
|
||||
* string.
|
||||
*/
|
||||
var removeLiteralQuotes = function( string ) {
|
||||
if ( string[ 0 ] + string[ string.length - 1 ] !== "''" ) {
|
||||
return string;
|
||||
}
|
||||
if ( string === "''" ) {
|
||||
return "'";
|
||||
}
|
||||
return string.replace( /''/g, "'" ).slice( 1, -1 );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* format( number, properties )
|
||||
*
|
||||
* @number [Number].
|
||||
*
|
||||
* @properties [Object] Output of number/format-properties.
|
||||
*
|
||||
* Return the formatted number.
|
||||
* ref: http://www.unicode.org/reports/tr35/tr35-numbers.html
|
||||
*/
|
||||
var numberFormat = function( number, properties, pluralGenerator ) {
|
||||
var aux, compactMap, infinitySymbol, maximumFractionDigits, maximumSignificantDigits,
|
||||
minimumFractionDigits, minimumIntegerDigits, minimumSignificantDigits, nanSymbol,
|
||||
nuDigitsMap, prefix, primaryGroupingSize, pattern, round, roundIncrement,
|
||||
secondaryGroupingSize, stringToParts, suffix, symbolMap;
|
||||
|
||||
minimumIntegerDigits = properties[ 2 ];
|
||||
minimumFractionDigits = properties[ 3 ];
|
||||
maximumFractionDigits = properties[ 4 ];
|
||||
minimumSignificantDigits = properties[ 5 ];
|
||||
maximumSignificantDigits = properties[ 6 ];
|
||||
roundIncrement = properties[ 7 ];
|
||||
primaryGroupingSize = properties[ 8 ];
|
||||
secondaryGroupingSize = properties[ 9 ];
|
||||
round = properties[ 15 ];
|
||||
infinitySymbol = properties[ 16 ];
|
||||
nanSymbol = properties[ 17 ];
|
||||
symbolMap = properties[ 18 ];
|
||||
nuDigitsMap = properties[ 19 ];
|
||||
compactMap = properties[ 20 ];
|
||||
|
||||
// NaN
|
||||
if ( isNaN( number ) ) {
|
||||
return [ { type: "nan", value: nanSymbol } ];
|
||||
}
|
||||
|
||||
if ( number < 0 ) {
|
||||
pattern = properties[ 12 ];
|
||||
prefix = properties[ 13 ];
|
||||
suffix = properties[ 14 ];
|
||||
} else {
|
||||
pattern = properties[ 11 ];
|
||||
prefix = properties[ 0 ];
|
||||
suffix = properties[ 10 ];
|
||||
}
|
||||
|
||||
// For prefix, suffix, and number parts.
|
||||
stringToParts = function( string ) {
|
||||
var numberType = "integer",
|
||||
parts = [];
|
||||
|
||||
// TODO Move the tokenization of all parts that don't depend on number into
|
||||
// format-properties.
|
||||
string.replace( /('([^']|'')+'|'')|./g, function( character, literal ) {
|
||||
|
||||
// Literals
|
||||
if ( literal ) {
|
||||
partsPush( parts, "literal", removeLiteralQuotes( literal ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Currency symbol
|
||||
if ( character === "\u00A4" ) {
|
||||
partsPush( parts, "currency", character );
|
||||
return;
|
||||
}
|
||||
|
||||
// Symbols
|
||||
character = character.replace( /[.,\-+E%\u2030]/, function( symbol ) {
|
||||
if ( symbol === "." ) {
|
||||
numberType = "fraction";
|
||||
}
|
||||
partsPush( parts, numberSymbolName[ symbol ], symbolMap[ symbol ] );
|
||||
|
||||
// "Erase" handled character.
|
||||
return "";
|
||||
});
|
||||
|
||||
// Number
|
||||
character = character.replace( /[0-9]/, function( digit ) {
|
||||
|
||||
// Numbering system
|
||||
if ( nuDigitsMap ) {
|
||||
digit = nuDigitsMap[ +digit ];
|
||||
}
|
||||
partsPush( parts, numberType, digit );
|
||||
|
||||
// "Erase" handled character.
|
||||
return "";
|
||||
});
|
||||
|
||||
// Etc
|
||||
character.replace( /./, function( etc ) {
|
||||
partsPush( parts, "literal", etc );
|
||||
});
|
||||
});
|
||||
return parts;
|
||||
};
|
||||
|
||||
prefix = stringToParts( prefix );
|
||||
suffix = stringToParts( suffix );
|
||||
|
||||
// Infinity
|
||||
if ( !isFinite( number ) ) {
|
||||
return prefix.concat(
|
||||
{ type: "infinity", value: infinitySymbol },
|
||||
suffix
|
||||
);
|
||||
}
|
||||
|
||||
// Percent
|
||||
if ( pattern.indexOf( "%" ) !== -1 ) {
|
||||
number *= 100;
|
||||
|
||||
// Per mille
|
||||
} else if ( pattern.indexOf( "\u2030" ) !== -1 ) {
|
||||
number *= 1000;
|
||||
}
|
||||
|
||||
var compactPattern, compactDigits, compactProperties, divisor, numberExponent, pluralForm;
|
||||
|
||||
// Compact mode: initial number digit processing
|
||||
if ( compactMap ) {
|
||||
numberExponent = Math.abs( Math.floor( number ) ).toString().length - 1;
|
||||
numberExponent = Math.min( numberExponent, compactMap.maxExponent );
|
||||
|
||||
// Use default plural form to perform initial decimal shift
|
||||
if ( numberExponent >= 3 ) {
|
||||
compactPattern = compactMap[ numberExponent ] && compactMap[ numberExponent ].other;
|
||||
}
|
||||
|
||||
if ( compactPattern === "0" ) {
|
||||
compactPattern = null;
|
||||
} else if ( compactPattern ) {
|
||||
compactDigits = compactPattern.split( "0" ).length - 1;
|
||||
divisor = numberExponent - ( compactDigits - 1 );
|
||||
number = number / Math.pow( 10, divisor );
|
||||
}
|
||||
}
|
||||
|
||||
// Significant digit format
|
||||
if ( !isNaN( minimumSignificantDigits * maximumSignificantDigits ) ) {
|
||||
number = numberFormatSignificantDigits( number, minimumSignificantDigits,
|
||||
maximumSignificantDigits, round );
|
||||
|
||||
// Integer and fractional format
|
||||
} else {
|
||||
number = numberFormatIntegerFractionDigits( number, minimumIntegerDigits,
|
||||
minimumFractionDigits, maximumFractionDigits, round, roundIncrement );
|
||||
}
|
||||
|
||||
// Compact mode: apply formatting
|
||||
if ( compactMap && compactPattern ) {
|
||||
|
||||
// Get plural form after possible roundings
|
||||
pluralForm = pluralGenerator ? pluralGenerator( +number ) : "other";
|
||||
|
||||
compactPattern = compactMap[ numberExponent ][ pluralForm ] || compactPattern;
|
||||
compactProperties = compactPattern.match( numberCompactPatternRe );
|
||||
|
||||
// TODO Move the tokenization of all parts that don't depend on number into
|
||||
// format-properties.
|
||||
aux = function( string ) {
|
||||
var parts = [];
|
||||
string.replace( /(\s+)|([^\s0]+)/g, function( _garbage, space, compact ) {
|
||||
|
||||
// Literals
|
||||
if ( space ) {
|
||||
partsPush( parts, "literal", space );
|
||||
return;
|
||||
}
|
||||
|
||||
// Compact value
|
||||
if ( compact ) {
|
||||
partsPush( parts, "compact", compact );
|
||||
return;
|
||||
}
|
||||
});
|
||||
return parts;
|
||||
};
|
||||
|
||||
// update prefix/suffix with compact prefix/suffix
|
||||
prefix = prefix.concat( aux( compactProperties[ 1 ] ) );
|
||||
suffix = aux( compactProperties[ 3 ] ).concat( suffix );
|
||||
}
|
||||
|
||||
// Remove the possible number minus sign
|
||||
number = number.replace( /^-/, "" );
|
||||
|
||||
// Grouping separators
|
||||
if ( primaryGroupingSize ) {
|
||||
number = numberFormatGroupingSeparator( number, primaryGroupingSize,
|
||||
secondaryGroupingSize );
|
||||
}
|
||||
|
||||
// Scientific notation
|
||||
// TODO implement here
|
||||
|
||||
// Padding/'([^']|'')+'|''|[.,\-+E%\u2030]/g
|
||||
// TODO implement here
|
||||
|
||||
return prefix.concat(
|
||||
stringToParts( number ),
|
||||
suffix
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var numberFormatterFn = function( numberToPartsFormatter ) {
|
||||
return function numberFormatter( value ) {
|
||||
return partsJoin( numberToPartsFormatter( value ));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by:
|
||||
*
|
||||
* var regenerate = require( "regenerate" );
|
||||
* var formatSymbols = require( "@unicode/unicode-13.0.0/General_Category/Format/symbols" );
|
||||
* regenerate().add( formatSymbols ).toString();
|
||||
*
|
||||
* https://github.com/mathiasbynens/regenerate
|
||||
* https://github.com/node-unicode/unicode-13.0.0
|
||||
*/
|
||||
var regexpCfG = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC38]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/g;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by:
|
||||
*
|
||||
* var regenerate = require( "regenerate" );
|
||||
* var dashSymbols = require( "https://github.com/node-unicode/unicode-13.0.0/General_Category/Dash_Punctuation/symbols" );
|
||||
* regenerate().add( dashSymbols ).toString();
|
||||
*
|
||||
* https://github.com/mathiasbynens/regenerate
|
||||
* https://github.com/node-unicode/unicode-13.0.0
|
||||
*
|
||||
* NOTE: In addition to [:dash:], the below includes MINUS SIGN U+2212.
|
||||
*/
|
||||
var regexpDashG = /[\x2D\u058A\u05BE\u1400\u1806\u2010-\u2015\u2E17\u2E1A\u2E3A\u2E3B\u2E40\u301C\u3030\u30A0\uFE31\uFE32\uFE58\uFE63\uFF0D\u2212]|\uD803\uDEAD/g;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by:
|
||||
*
|
||||
* var regenerate = require( "regenerate" );
|
||||
* var spaceSeparatorSymbols = require( "@unicode/unicode-13.0.0/General_Category/Space_Separator/symbols" );
|
||||
* regenerate().add( spaceSeparatorSymbols ).toString();
|
||||
*
|
||||
* https://github.com/mathiasbynens/regenerate
|
||||
* https://github.com/node-unicode/unicode-13.0.0
|
||||
*/
|
||||
var regexpZsG = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/g;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Loose Matching:
|
||||
* - Ignore all format characters, which includes RLM, LRM or ALM used to control BIDI
|
||||
* formatting.
|
||||
* - Map all characters in [:Zs:] to U+0020 SPACE;
|
||||
* - Map all characters in [:Dash:] to U+002D HYPHEN-MINUS;
|
||||
*/
|
||||
var looseMatching = function( value ) {
|
||||
return value
|
||||
.replace( regexpCfG, "" )
|
||||
.replace( regexpDashG, "-" )
|
||||
.replace( regexpZsG, " " );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* parse( value, properties )
|
||||
*
|
||||
* @value [String].
|
||||
*
|
||||
* @properties [Object] Parser properties is a reduced pre-processed cldr
|
||||
* data set returned by numberParserProperties().
|
||||
*
|
||||
* Return the parsed Number (including Infinity) or NaN when value is invalid.
|
||||
* ref: http://www.unicode.org/reports/tr35/tr35-numbers.html
|
||||
*/
|
||||
var numberParse = function( value, properties ) {
|
||||
var grammar, invertedNuDigitsMap, invertedSymbolMap, negative, number, prefix, prefixNSuffix,
|
||||
suffix, tokenizer, valid;
|
||||
|
||||
// Grammar:
|
||||
// - Value <= NaN | PositiveNumber | NegativeNumber
|
||||
// - PositiveNumber <= PositivePrefix NumberOrInf PositiveSufix
|
||||
// - NegativeNumber <= NegativePrefix NumberOrInf
|
||||
// - NumberOrInf <= Number | Inf
|
||||
grammar = [
|
||||
[ "nan" ],
|
||||
[ "prefix", "infinity", "suffix" ],
|
||||
[ "prefix", "number", "suffix" ],
|
||||
[ "negativePrefix", "infinity", "negativeSuffix" ],
|
||||
[ "negativePrefix", "number", "negativeSuffix" ]
|
||||
];
|
||||
|
||||
invertedSymbolMap = properties[ 0 ];
|
||||
invertedNuDigitsMap = properties[ 1 ] || {};
|
||||
tokenizer = properties[ 2 ];
|
||||
|
||||
value = looseMatching( value );
|
||||
|
||||
function parse( type ) {
|
||||
return function( lexeme ) {
|
||||
|
||||
// Reverse localized symbols and numbering system.
|
||||
lexeme = lexeme.split( "" ).map(function( character ) {
|
||||
return invertedSymbolMap[ character ] ||
|
||||
invertedNuDigitsMap[ character ] ||
|
||||
character;
|
||||
}).join( "" );
|
||||
|
||||
switch ( type ) {
|
||||
case "infinity":
|
||||
number = Infinity;
|
||||
break;
|
||||
|
||||
case "nan":
|
||||
number = NaN;
|
||||
break;
|
||||
|
||||
case "number":
|
||||
|
||||
// Remove grouping separators.
|
||||
lexeme = lexeme.replace( /,/g, "" );
|
||||
|
||||
number = +lexeme;
|
||||
break;
|
||||
|
||||
case "prefix":
|
||||
case "negativePrefix":
|
||||
prefix = lexeme;
|
||||
break;
|
||||
|
||||
case "suffix":
|
||||
suffix = lexeme;
|
||||
break;
|
||||
|
||||
case "negativeSuffix":
|
||||
suffix = lexeme;
|
||||
negative = true;
|
||||
break;
|
||||
|
||||
// This should never be reached.
|
||||
default:
|
||||
throw new Error( "Internal error" );
|
||||
}
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
function tokenizeNParse( _value, grammar ) {
|
||||
return grammar.some(function( statement ) {
|
||||
var value = _value;
|
||||
|
||||
// The whole grammar statement should be used (i.e., .every() return true) and value be
|
||||
// entirely consumed (i.e., !value.length).
|
||||
return statement.every(function( type ) {
|
||||
if ( value.match( tokenizer[ type ] ) === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Consume and parse it.
|
||||
value = value.replace( tokenizer[ type ], parse( type ) );
|
||||
return true;
|
||||
}) && !value.length;
|
||||
});
|
||||
}
|
||||
|
||||
valid = tokenizeNParse( value, grammar );
|
||||
|
||||
// NaN
|
||||
if ( !valid || isNaN( number ) ) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
prefixNSuffix = "" + prefix + suffix;
|
||||
|
||||
// Percent
|
||||
if ( prefixNSuffix.indexOf( "%" ) !== -1 ) {
|
||||
number /= 100;
|
||||
|
||||
// Per mille
|
||||
} else if ( prefixNSuffix.indexOf( "\u2030" ) !== -1 ) {
|
||||
number /= 1000;
|
||||
}
|
||||
|
||||
// Negative number
|
||||
if ( negative ) {
|
||||
number *= -1;
|
||||
}
|
||||
|
||||
return number;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var numberParserFn = function( properties ) {
|
||||
return function numberParser( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeString( value, "value" );
|
||||
|
||||
return numberParse( value, properties );
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var numberToPartsFormatterFn = function( properties, pluralGenerator ) {
|
||||
return function numberToPartsFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return numberFormat( value, properties, pluralGenerator );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var numberTruncate = function( value ) {
|
||||
if ( isNaN( value ) ) {
|
||||
return NaN;
|
||||
}
|
||||
return Math[ value < 0 ? "ceil" : "floor" ]( value );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* round( method )
|
||||
*
|
||||
* @method [String] with either "round", "ceil", "floor", or "truncate".
|
||||
*
|
||||
* Return function( value, incrementOrExp ):
|
||||
*
|
||||
* @value [Number] eg. 123.45.
|
||||
*
|
||||
* @incrementOrExp [Number] optional, eg. 0.1; or
|
||||
* [Object] Either { increment: <value> } or { exponent: <value> }
|
||||
*
|
||||
* Return the rounded number, eg:
|
||||
* - round( "round" )( 123.45 ): 123;
|
||||
* - round( "ceil" )( 123.45 ): 124;
|
||||
* - round( "floor" )( 123.45 ): 123;
|
||||
* - round( "truncate" )( 123.45 ): 123;
|
||||
* - round( "round" )( 123.45, 0.1 ): 123.5;
|
||||
* - round( "round" )( 123.45, 10 ): 120;
|
||||
*
|
||||
* Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
|
||||
* Ref: #376
|
||||
*/
|
||||
var numberRound = function( method ) {
|
||||
method = method || "round";
|
||||
method = method === "truncate" ? numberTruncate : Math[ method ];
|
||||
|
||||
return function( value, incrementOrExp ) {
|
||||
var exp, increment;
|
||||
|
||||
value = +value;
|
||||
|
||||
// If the value is not a number, return NaN.
|
||||
if ( isNaN( value ) ) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
// Exponent given.
|
||||
if ( typeof incrementOrExp === "object" && incrementOrExp.exponent ) {
|
||||
exp = +incrementOrExp.exponent;
|
||||
increment = 1;
|
||||
|
||||
if ( exp === 0 ) {
|
||||
return method( value );
|
||||
}
|
||||
|
||||
// If the exp is not an integer, return NaN.
|
||||
if ( !( typeof exp === "number" && exp % 1 === 0 ) ) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
// Increment given.
|
||||
} else {
|
||||
increment = +incrementOrExp || 1;
|
||||
|
||||
if ( increment === 1 ) {
|
||||
return method( value );
|
||||
}
|
||||
|
||||
// If the increment is not a number, return NaN.
|
||||
if ( isNaN( increment ) ) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
increment = increment.toExponential().split( "e" );
|
||||
exp = +increment[ 1 ];
|
||||
increment = +increment[ 0 ];
|
||||
}
|
||||
|
||||
// Shift & Round
|
||||
value = value.toString().split( "e" );
|
||||
value[ 0 ] = +value[ 0 ] / increment;
|
||||
value[ 1 ] = value[ 1 ] ? ( +value[ 1 ] - exp ) : -exp;
|
||||
value = method( +( value[ 0 ] + "e" + value[ 1 ] ) );
|
||||
|
||||
// Shift back
|
||||
value = value.toString().split( "e" );
|
||||
value[ 0 ] = +value[ 0 ] * increment;
|
||||
value[ 1 ] = value[ 1 ] ? ( +value[ 1 ] + exp ) : exp;
|
||||
return +( value[ 0 ] + "e" + value[ 1 ] );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Globalize._createErrorUnsupportedFeature = createErrorUnsupportedFeature;
|
||||
Globalize._looseMatching = looseMatching;
|
||||
Globalize._numberFormat = numberFormat;
|
||||
Globalize._numberFormatterFn = numberFormatterFn;
|
||||
Globalize._numberParse = numberParse;
|
||||
Globalize._numberParserFn = numberParserFn;
|
||||
Globalize._numberRound = numberRound;
|
||||
Globalize._numberToPartsFormatterFn = numberToPartsFormatterFn;
|
||||
Globalize._removeLiteralQuotes = removeLiteralQuotes;
|
||||
Globalize._validateParameterPresence = validateParameterPresence;
|
||||
Globalize._validateParameterTypeNumber = validateParameterTypeNumber;
|
||||
Globalize._validateParameterTypeString = validateParameterTypeString;
|
||||
|
||||
// Stamp runtimeKey and return cached fn.
|
||||
// Note, this function isn't made common to all formatters and parsers, because in practice this is
|
||||
// only used (at the moment) for numberFormatter used by unitFormatter.
|
||||
// TODO: Move this function into a common place when this is used by different formatters.
|
||||
function cached( runtimeKey ) {
|
||||
Globalize[ runtimeKey ].runtimeKey = runtimeKey;
|
||||
return Globalize[ runtimeKey ];
|
||||
}
|
||||
|
||||
Globalize.numberFormatter =
|
||||
Globalize.prototype.numberFormatter = function( options ) {
|
||||
options = options || {};
|
||||
return cached( runtimeKey( "numberFormatter", this._locale, [ options ] ) );
|
||||
};
|
||||
|
||||
Globalize.numberToPartsFormatter =
|
||||
Globalize.prototype.numberToPartsFormatter = function( options ) {
|
||||
options = options || {};
|
||||
return cached( runtimeKey( "numberToPartsFormatter", this._locale, [ options ] ) );
|
||||
};
|
||||
|
||||
Globalize.numberParser =
|
||||
Globalize.prototype.numberParser = function( options ) {
|
||||
options = options || {};
|
||||
return Globalize[ runtimeKey( "numberParser", this._locale, [ options ] ) ];
|
||||
};
|
||||
|
||||
Globalize.formatNumber =
|
||||
Globalize.prototype.formatNumber = function( value, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.numberFormatter( options )( value );
|
||||
};
|
||||
|
||||
Globalize.formatNumberToParts =
|
||||
Globalize.prototype.formatNumberToParts = function( value, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.numberFormatter( options )( value );
|
||||
};
|
||||
|
||||
Globalize.parseNumber =
|
||||
Globalize.prototype.parseNumber = function( value, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeString( value, "value" );
|
||||
|
||||
return this.numberParser( options )( value );
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
90
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/plural.js
generated
vendored
Normal file
90
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/plural.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"../globalize-runtime"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "../globalize-runtime" ) );
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Globalize );
|
||||
}
|
||||
}(this, function( Globalize ) {
|
||||
|
||||
|
||||
|
||||
var runtimeKey = Globalize._runtimeKey,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterType = Globalize._validateParameterType;
|
||||
|
||||
|
||||
var validateParameterTypeNumber = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || typeof value === "number",
|
||||
"Number"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var pluralGeneratorFn = function( plural ) {
|
||||
return function pluralGenerator( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return plural( value );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Globalize._pluralGeneratorFn = pluralGeneratorFn;
|
||||
Globalize._validateParameterTypeNumber = validateParameterTypeNumber;
|
||||
|
||||
Globalize.plural =
|
||||
Globalize.prototype.plural = function( value, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
return this.pluralGenerator( options )( value );
|
||||
};
|
||||
|
||||
Globalize.pluralGenerator =
|
||||
Globalize.prototype.pluralGenerator = function( options ) {
|
||||
options = options || {};
|
||||
return Globalize[ runtimeKey( "pluralGenerator", this._locale, [ options ] ) ];
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
120
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/relative-time.js
generated
vendored
Normal file
120
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/relative-time.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"../globalize-runtime",
|
||||
"./number",
|
||||
"./plural"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory(
|
||||
require( "../globalize-runtime" ),
|
||||
require( "./number" ),
|
||||
require( "./plural" )
|
||||
);
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Globalize );
|
||||
}
|
||||
}(this, function( Globalize ) {
|
||||
|
||||
|
||||
|
||||
var formatMessage = Globalize._formatMessage,
|
||||
runtimeKey = Globalize._runtimeKey,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterTypeNumber = Globalize._validateParameterTypeNumber;
|
||||
|
||||
|
||||
/**
|
||||
* format( value, numberFormatter, pluralGenerator, properties )
|
||||
*
|
||||
* @value [Number] The number to format
|
||||
*
|
||||
* @numberFormatter [String] A numberFormatter from Globalize.numberFormatter
|
||||
*
|
||||
* @pluralGenerator [String] A pluralGenerator from Globalize.pluralGenerator
|
||||
*
|
||||
* @properties [Object] containing relative time plural message.
|
||||
*
|
||||
* Format relative time.
|
||||
*/
|
||||
var relativeTimeFormat = function( value, numberFormatter, pluralGenerator, properties ) {
|
||||
|
||||
var relativeTime,
|
||||
message = properties[ "relative-type-" + value ];
|
||||
|
||||
if ( message ) {
|
||||
return message;
|
||||
}
|
||||
|
||||
relativeTime = value <= 0 ? properties[ "relativeTime-type-past" ] :
|
||||
properties[ "relativeTime-type-future" ];
|
||||
|
||||
value = Math.abs( value );
|
||||
|
||||
message = relativeTime[ "relativeTimePattern-count-" + pluralGenerator( value ) ];
|
||||
return formatMessage( message, [ numberFormatter( value ) ] );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var relativeTimeFormatterFn = function( numberFormatter, pluralGenerator, properties ) {
|
||||
return function relativeTimeFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return relativeTimeFormat( value, numberFormatter, pluralGenerator, properties );
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Globalize._relativeTimeFormatterFn = relativeTimeFormatterFn;
|
||||
|
||||
Globalize.formatRelativeTime =
|
||||
Globalize.prototype.formatRelativeTime = function( value, unit, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.relativeTimeFormatter( unit, options )( value );
|
||||
};
|
||||
|
||||
Globalize.relativeTimeFormatter =
|
||||
Globalize.prototype.relativeTimeFormatter = function( unit, options ) {
|
||||
options = options || {};
|
||||
return Globalize[ runtimeKey( "relativeTimeFormatter", this._locale, [ unit, options ] ) ];
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
132
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/unit.js
generated
vendored
Normal file
132
BeWoPlanerMobil/node_modules/globalize/dist/globalize-runtime/unit.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* Globalize Runtime v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"../globalize-runtime",
|
||||
"./number",
|
||||
"./plural"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory(
|
||||
require( "../globalize-runtime" ),
|
||||
require( "./number" ),
|
||||
require( "./plural" )
|
||||
);
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Globalize );
|
||||
}
|
||||
}(this, function( Globalize ) {
|
||||
|
||||
|
||||
|
||||
var formatMessage = Globalize._formatMessage,
|
||||
runtimeKey = Globalize._runtimeKey,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterTypeNumber = Globalize._validateParameterTypeNumber;
|
||||
|
||||
|
||||
/**
|
||||
* format( value, numberFormatter, pluralGenerator, unitProperies )
|
||||
*
|
||||
* @value [Number]
|
||||
*
|
||||
* @numberFormatter [Object]: A numberFormatter from Globalize.numberFormatter.
|
||||
*
|
||||
* @pluralGenerator [Object]: A pluralGenerator from Globalize.pluralGenerator.
|
||||
*
|
||||
* @unitProperies [Object]: localized unit data from cldr.
|
||||
*
|
||||
* Format units such as seconds, minutes, days, weeks, etc.
|
||||
*
|
||||
* OBS:
|
||||
*
|
||||
* Unit Sequences are not implemented.
|
||||
* http://www.unicode.org/reports/tr35/tr35-35/tr35-general.html#Unit_Sequences
|
||||
*
|
||||
* Duration Unit (for composed time unit durations) is not implemented.
|
||||
* http://www.unicode.org/reports/tr35/tr35-35/tr35-general.html#durationUnit
|
||||
*/
|
||||
var unitFormat = function( value, numberFormatter, pluralGenerator, unitProperties ) {
|
||||
var compoundUnitPattern = unitProperties.compoundUnitPattern, dividend, dividendProperties,
|
||||
formattedValue, divisor, divisorProperties, message, pluralValue, oneProperty;
|
||||
|
||||
unitProperties = unitProperties.unitProperties;
|
||||
formattedValue = numberFormatter( value );
|
||||
pluralValue = pluralGenerator( value );
|
||||
|
||||
// computed compound unit, eg. "megabyte-per-second".
|
||||
if ( unitProperties instanceof Array ) {
|
||||
dividendProperties = unitProperties[ 0 ];
|
||||
divisorProperties = unitProperties[ 1 ];
|
||||
oneProperty = divisorProperties.hasOwnProperty( "one" ) ? "one" : "other";
|
||||
|
||||
dividend = formatMessage( dividendProperties[ pluralValue ], [ formattedValue ] );
|
||||
divisor = formatMessage( divisorProperties[ oneProperty ], [ "" ] ).trim();
|
||||
|
||||
return formatMessage( compoundUnitPattern, [ dividend, divisor ] );
|
||||
}
|
||||
|
||||
message = unitProperties[ pluralValue ];
|
||||
|
||||
return formatMessage( message, [ formattedValue ] );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var unitFormatterFn = function( numberFormatter, pluralGenerator, unitProperties ) {
|
||||
return function unitFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return unitFormat( value, numberFormatter, pluralGenerator, unitProperties );
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Globalize._unitFormatterFn = unitFormatterFn;
|
||||
|
||||
Globalize.formatUnit =
|
||||
Globalize.prototype.formatUnit = function( value, unit, options ) {
|
||||
return this.unitFormatter( unit, options )( value );
|
||||
};
|
||||
|
||||
Globalize.unitFormatter =
|
||||
Globalize.prototype.unitFormatter = function( unit, options ) {
|
||||
options = options || {};
|
||||
return Globalize[ runtimeKey( "unitFormatter", this._locale, [ unit, options ] ) ];
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
507
BeWoPlanerMobil/node_modules/globalize/dist/globalize.js
generated
vendored
Normal file
507
BeWoPlanerMobil/node_modules/globalize/dist/globalize.js
generated
vendored
Normal file
@@ -0,0 +1,507 @@
|
||||
/**
|
||||
* Globalize v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"cldr",
|
||||
"cldr/event"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "cldrjs" ) );
|
||||
} else {
|
||||
|
||||
// Global
|
||||
root.Globalize = factory( root.Cldr );
|
||||
}
|
||||
}( this, function( Cldr ) {
|
||||
|
||||
|
||||
/**
|
||||
* A toString method that outputs meaningful values for objects or arrays and
|
||||
* still performs as fast as a plain string in case variable is string, or as
|
||||
* fast as `"" + number` in case variable is a number.
|
||||
* Ref: http://jsperf.com/my-stringify
|
||||
*/
|
||||
var toString = function( variable ) {
|
||||
return typeof variable === "string" ? variable : ( typeof variable === "number" ? "" +
|
||||
variable : JSON.stringify( variable ) );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* formatMessage( message, data )
|
||||
*
|
||||
* @message [String] A message with optional {vars} to be replaced.
|
||||
*
|
||||
* @data [Array or JSON] Object with replacing-variables content.
|
||||
*
|
||||
* Return the formatted message. For example:
|
||||
*
|
||||
* - formatMessage( "{0} second", [ 1 ] ); // 1 second
|
||||
*
|
||||
* - formatMessage( "{0}/{1}", ["m", "s"] ); // m/s
|
||||
*
|
||||
* - formatMessage( "{name} <{email}>", {
|
||||
* name: "Foo",
|
||||
* email: "bar@baz.qux"
|
||||
* }); // Foo <bar@baz.qux>
|
||||
*/
|
||||
var formatMessage = function( message, data ) {
|
||||
|
||||
// Replace {attribute}'s
|
||||
message = message.replace( /{[0-9a-zA-Z-_. ]+}/g, function( name ) {
|
||||
name = name.replace( /^{([^}]*)}$/, "$1" );
|
||||
return toString( data[ name ] );
|
||||
});
|
||||
|
||||
return message;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var objectExtend = function() {
|
||||
var destination = arguments[ 0 ],
|
||||
sources = [].slice.call( arguments, 1 );
|
||||
|
||||
sources.forEach(function( source ) {
|
||||
var prop;
|
||||
for ( prop in source ) {
|
||||
destination[ prop ] = source[ prop ];
|
||||
}
|
||||
});
|
||||
|
||||
return destination;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var createError = function( code, message, attributes ) {
|
||||
var error;
|
||||
|
||||
message = code + ( message ? ": " + formatMessage( message, attributes ) : "" );
|
||||
error = new Error( message );
|
||||
error.code = code;
|
||||
|
||||
objectExtend( error, attributes );
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Pushes part to parts array, concat two consecutive parts of the same type.
|
||||
*/
|
||||
var partsPush = function( parts, type, value ) {
|
||||
|
||||
// Concat two consecutive parts of same type
|
||||
if ( parts.length && parts[ parts.length - 1 ].type === type ) {
|
||||
parts[ parts.length - 1 ].value += value;
|
||||
return;
|
||||
}
|
||||
|
||||
parts.push( { type: type, value: value } );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* formatMessage( message, data )
|
||||
*
|
||||
* @message [String] A message with optional {vars} to be replaced.
|
||||
*
|
||||
* @data [Array or JSON] Object with replacing-variables content.
|
||||
*
|
||||
* Return the formatted message. For example:
|
||||
*
|
||||
* - formatMessage( "{0} second", [ 1 ] );
|
||||
* > [{type: "variable", value: "1", name: "0"}, {type: "literal", value: " second"}]
|
||||
*
|
||||
* - formatMessage( "{0}/{1}", ["m", "s"] );
|
||||
* > [
|
||||
* { type: "variable", value: "m", name: "0" },
|
||||
* { type: "literal", value: " /" },
|
||||
* { type: "variable", value: "s", name: "1" }
|
||||
* ]
|
||||
*/
|
||||
var formatMessageToParts = function( message, data ) {
|
||||
|
||||
var lastOffset = 0,
|
||||
parts = [];
|
||||
|
||||
// Create parts.
|
||||
message.replace( /{[0-9a-zA-Z-_. ]+}/g, function( nameIncludingBrackets, offset ) {
|
||||
var name = nameIncludingBrackets.slice( 1, -1 );
|
||||
partsPush( parts, "literal", message.slice( lastOffset, offset ));
|
||||
partsPush( parts, "variable", data[ name ] );
|
||||
parts[ parts.length - 1 ].name = name;
|
||||
lastOffset += offset + nameIncludingBrackets.length;
|
||||
});
|
||||
|
||||
// Skip empty ones such as `{ type: 'literal', value: '' }`.
|
||||
return parts.filter(function( part ) {
|
||||
return part.value !== "";
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns joined parts values.
|
||||
*/
|
||||
var partsJoin = function( parts ) {
|
||||
return parts.map( function( part ) {
|
||||
return part.value;
|
||||
}).join( "" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var runtimeStringify = function( args ) {
|
||||
return JSON.stringify( args, function( _key, value ) {
|
||||
if ( value && value.runtimeKey ) {
|
||||
return value.runtimeKey;
|
||||
}
|
||||
return value;
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Based on http://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery
|
||||
var stringHash = function( str ) {
|
||||
return [].reduce.call( str, function( hash, i ) {
|
||||
var chr = i.charCodeAt( 0 );
|
||||
hash = ( ( hash << 5 ) - hash ) + chr;
|
||||
return hash | 0;
|
||||
}, 0 );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var runtimeKey = function( fnName, locale, args, argsStr ) {
|
||||
var hash;
|
||||
argsStr = argsStr || runtimeStringify( args );
|
||||
hash = stringHash( fnName + locale + argsStr );
|
||||
return hash > 0 ? "a" + hash : "b" + Math.abs( hash );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var functionName = function( fn ) {
|
||||
if ( fn.name !== undefined ) {
|
||||
return fn.name;
|
||||
}
|
||||
|
||||
// fn.name is not supported by IE.
|
||||
var matches = /^function\s+([\w\$]+)\s*\(/.exec( fn.toString() );
|
||||
|
||||
if ( matches && matches.length > 0 ) {
|
||||
return matches[ 1 ];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var runtimeBind = function( args, cldr, fn, runtimeArgs ) {
|
||||
|
||||
var argsStr = runtimeStringify( args ),
|
||||
fnName = functionName( fn ),
|
||||
locale = cldr.locale;
|
||||
|
||||
// If name of the function is not available, this is most likely due to uglification,
|
||||
// which most likely means we are in production, and runtimeBind here is not necessary.
|
||||
if ( !fnName ) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
fn.runtimeKey = runtimeKey( fnName, locale, null, argsStr );
|
||||
|
||||
fn.generatorString = function() {
|
||||
return "Globalize(\"" + locale + "\")." + fnName + "(" + argsStr.slice( 1, -1 ) + ")";
|
||||
};
|
||||
|
||||
fn.runtimeArgs = runtimeArgs;
|
||||
|
||||
return fn;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validate = function( code, message, check, attributes ) {
|
||||
if ( !check ) {
|
||||
throw createError( code, message, attributes );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var alwaysArray = function( stringOrArray ) {
|
||||
return Array.isArray( stringOrArray ) ? stringOrArray : stringOrArray ? [ stringOrArray ] : [];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateCldr = function( path, value, options ) {
|
||||
var skipBoolean;
|
||||
options = options || {};
|
||||
|
||||
skipBoolean = alwaysArray( options.skip ).some(function( pathRe ) {
|
||||
return pathRe.test( path );
|
||||
});
|
||||
|
||||
validate( "E_MISSING_CLDR", "Missing required CLDR content `{path}`.", value || skipBoolean, {
|
||||
path: path
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateDefaultLocale = function( value ) {
|
||||
validate( "E_DEFAULT_LOCALE_NOT_DEFINED", "Default locale has not been defined.",
|
||||
value !== undefined, {} );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterPresence = function( value, name ) {
|
||||
validate( "E_MISSING_PARAMETER", "Missing required parameter `{name}`.",
|
||||
value !== undefined, { name: name });
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* range( value, name, minimum, maximum )
|
||||
*
|
||||
* @value [Number].
|
||||
*
|
||||
* @name [String] name of variable.
|
||||
*
|
||||
* @minimum [Number]. The lowest valid value, inclusive.
|
||||
*
|
||||
* @maximum [Number]. The greatest valid value, inclusive.
|
||||
*/
|
||||
var validateParameterRange = function( value, name, minimum, maximum ) {
|
||||
validate(
|
||||
"E_PAR_OUT_OF_RANGE",
|
||||
"Parameter `{name}` has value `{value}` out of range [{minimum}, {maximum}].",
|
||||
value === undefined || value >= minimum && value <= maximum,
|
||||
{
|
||||
maximum: maximum,
|
||||
minimum: minimum,
|
||||
name: name,
|
||||
value: value
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterType = function( value, name, check, expected ) {
|
||||
validate(
|
||||
"E_INVALID_PAR_TYPE",
|
||||
"Invalid `{name}` parameter ({value}). {expected} expected.",
|
||||
check,
|
||||
{
|
||||
expected: expected,
|
||||
name: name,
|
||||
value: value
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypeLocale = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || typeof value === "string" || value instanceof Cldr,
|
||||
"String or Cldr instance"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function inspired by jQuery Core, but reduced to our use case.
|
||||
*/
|
||||
var isPlainObject = function( obj ) {
|
||||
return obj !== null && "" + obj === "[object Object]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypePlainObject = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || isPlainObject( value ),
|
||||
"Plain Object"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var alwaysCldr = function( localeOrCldr ) {
|
||||
return localeOrCldr instanceof Cldr ? localeOrCldr : new Cldr( localeOrCldr );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions?redirectlocale=en-US&redirectslug=JavaScript%2FGuide%2FRegular_Expressions
|
||||
var regexpEscape = function( string ) {
|
||||
return string.replace( /([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var stringPad = function( str, count, right ) {
|
||||
var length;
|
||||
if ( typeof str !== "string" ) {
|
||||
str = String( str );
|
||||
}
|
||||
for ( length = str.length; length < count; length += 1 ) {
|
||||
str = ( right ? ( str + "0" ) : ( "0" + str ) );
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function validateLikelySubtags( cldr ) {
|
||||
cldr.once( "get", validateCldr );
|
||||
cldr.get( "supplemental/likelySubtags" );
|
||||
}
|
||||
|
||||
/**
|
||||
* [new] Globalize( locale|cldr )
|
||||
*
|
||||
* @locale [String]
|
||||
*
|
||||
* @cldr [Cldr instance]
|
||||
*
|
||||
* Create a Globalize instance.
|
||||
*/
|
||||
function Globalize( locale ) {
|
||||
if ( !( this instanceof Globalize ) ) {
|
||||
return new Globalize( locale );
|
||||
}
|
||||
|
||||
validateParameterPresence( locale, "locale" );
|
||||
validateParameterTypeLocale( locale, "locale" );
|
||||
|
||||
this.cldr = alwaysCldr( locale );
|
||||
|
||||
validateLikelySubtags( this.cldr );
|
||||
}
|
||||
|
||||
/**
|
||||
* Globalize.load( json, ... )
|
||||
*
|
||||
* @json [JSON]
|
||||
*
|
||||
* Load resolved or unresolved cldr data.
|
||||
* Somewhat equivalent to previous Globalize.addCultureInfo(...).
|
||||
*/
|
||||
Globalize.load = function() {
|
||||
|
||||
// validations are delegated to Cldr.load().
|
||||
Cldr.load.apply( Cldr, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* Globalize.locale( [locale|cldr] )
|
||||
*
|
||||
* @locale [String]
|
||||
*
|
||||
* @cldr [Cldr instance]
|
||||
*
|
||||
* Set default Cldr instance if locale or cldr argument is passed.
|
||||
*
|
||||
* Return the default Cldr instance.
|
||||
*/
|
||||
Globalize.locale = function( locale ) {
|
||||
validateParameterTypeLocale( locale, "locale" );
|
||||
|
||||
if ( arguments.length ) {
|
||||
this.cldr = alwaysCldr( locale );
|
||||
validateLikelySubtags( this.cldr );
|
||||
}
|
||||
return this.cldr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimization to avoid duplicating some internal functions across modules.
|
||||
*/
|
||||
Globalize._alwaysArray = alwaysArray;
|
||||
Globalize._createError = createError;
|
||||
Globalize._formatMessage = formatMessage;
|
||||
Globalize._formatMessageToParts = formatMessageToParts;
|
||||
Globalize._isPlainObject = isPlainObject;
|
||||
Globalize._objectExtend = objectExtend;
|
||||
Globalize._partsJoin = partsJoin;
|
||||
Globalize._partsPush = partsPush;
|
||||
Globalize._regexpEscape = regexpEscape;
|
||||
Globalize._runtimeBind = runtimeBind;
|
||||
Globalize._stringPad = stringPad;
|
||||
Globalize._validate = validate;
|
||||
Globalize._validateCldr = validateCldr;
|
||||
Globalize._validateDefaultLocale = validateDefaultLocale;
|
||||
Globalize._validateParameterPresence = validateParameterPresence;
|
||||
Globalize._validateParameterRange = validateParameterRange;
|
||||
Globalize._validateParameterTypePlainObject = validateParameterTypePlainObject;
|
||||
Globalize._validateParameterType = validateParameterType;
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
590
BeWoPlanerMobil/node_modules/globalize/dist/globalize/currency.js
generated
vendored
Normal file
590
BeWoPlanerMobil/node_modules/globalize/dist/globalize/currency.js
generated
vendored
Normal file
@@ -0,0 +1,590 @@
|
||||
/*!
|
||||
* Globalize v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"cldr",
|
||||
"../globalize",
|
||||
"./number",
|
||||
"cldr/event",
|
||||
"cldr/supplemental"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "cldrjs" ), require( "../globalize" ) );
|
||||
} else {
|
||||
|
||||
// Global
|
||||
factory( root.Cldr, root.Globalize );
|
||||
}
|
||||
}(this, function( Cldr, Globalize ) {
|
||||
|
||||
var alwaysArray = Globalize._alwaysArray,
|
||||
createError = Globalize._createError,
|
||||
formatMessageToParts = Globalize._formatMessageToParts,
|
||||
numberNumberingSystem = Globalize._numberNumberingSystem,
|
||||
numberPattern = Globalize._numberPattern,
|
||||
partsJoin = Globalize._partsJoin,
|
||||
partsPush = Globalize._partsPush,
|
||||
runtimeBind = Globalize._runtimeBind,
|
||||
stringPad = Globalize._stringPad,
|
||||
validateCldr = Globalize._validateCldr,
|
||||
validateDefaultLocale = Globalize._validateDefaultLocale,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterType = Globalize._validateParameterType,
|
||||
validateParameterTypeNumber = Globalize._validateParameterTypeNumber,
|
||||
validateParameterTypePlainObject = Globalize._validateParameterTypePlainObject;
|
||||
|
||||
|
||||
var createErrorPluralModulePresence = function() {
|
||||
return createError( "E_MISSING_PLURAL_MODULE", "Plural module not loaded." );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypeCurrency = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || typeof value === "string" && ( /^[A-Za-z]{3}$/ ).test( value ),
|
||||
"3-letter currency code string as defined by ISO 4217"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var currencyFormatterFn = function( currencyToPartsFormatter ) {
|
||||
return function currencyFormatter( value ) {
|
||||
return partsJoin( currencyToPartsFormatter( value ));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* supplementalOverride( currency, pattern, cldr )
|
||||
*
|
||||
* Return pattern with fraction digits overriden by supplemental currency data.
|
||||
*/
|
||||
var currencySupplementalOverride = function( currency, pattern, cldr ) {
|
||||
var digits,
|
||||
fraction = "",
|
||||
fractionData = cldr.supplemental([ "currencyData/fractions", currency ]) ||
|
||||
cldr.supplemental( "currencyData/fractions/DEFAULT" );
|
||||
|
||||
digits = +fractionData._digits;
|
||||
|
||||
if ( digits ) {
|
||||
fraction = "." + stringPad( "0", digits ).slice( 0, -1 ) + fractionData._rounding;
|
||||
}
|
||||
|
||||
return pattern.replace( /\.(#+|0*[0-9]|0+[0-9]?)/g, fraction );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var objectFilter = function( object, testRe ) {
|
||||
var key,
|
||||
copy = {};
|
||||
|
||||
for ( key in object ) {
|
||||
if ( testRe.test( key ) ) {
|
||||
copy[ key ] = object[ key ];
|
||||
}
|
||||
}
|
||||
|
||||
return copy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var currencyUnitPatterns = function( cldr ) {
|
||||
return objectFilter( cldr.main([
|
||||
"numbers",
|
||||
"currencyFormats-numberSystem-" + numberNumberingSystem( cldr )
|
||||
]), /^unitPattern/ );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* nameProperties( currency, cldr )
|
||||
*
|
||||
* Return number pattern with the appropriate currency code in as literal.
|
||||
*/
|
||||
var currencyNameProperties = function( currency, cldr ) {
|
||||
var pattern = numberPattern( "decimal", cldr );
|
||||
|
||||
// The number of decimal places and the rounding for each currency is not locale-specific. Those
|
||||
// values overridden by Supplemental Currency Data.
|
||||
pattern = currencySupplementalOverride( currency, pattern, cldr );
|
||||
|
||||
return {
|
||||
displayNames: objectFilter( cldr.main([
|
||||
"numbers/currencies",
|
||||
currency
|
||||
]), /^displayName/ ),
|
||||
pattern: pattern,
|
||||
unitPatterns: currencyUnitPatterns( cldr )
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Unicode regular expression for: everything except symbols from the category S
|
||||
*
|
||||
* Generated by:
|
||||
*
|
||||
* var s = regenerate()
|
||||
* .addRange( 0x0, 0x10FFFF )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Math_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Currency_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Modifier_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Other_Symbol/symbols" ) )
|
||||
*
|
||||
* https://github.com/mathiasbynens/regenerate
|
||||
* https://github.com/node-unicode/unicode-13.0.0
|
||||
* http://www.unicode.org/reports/tr44/#General_Category_Values
|
||||
*/
|
||||
var regexpNotS = /[\0-#%-\*,-;\?-\]_a-\{\}\x7F-\xA1\xA7\xAA\xAB\xAD\xB2\xB3\xB5-\xB7\xB9-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376-\u0383\u0386-\u03F5\u03F7-\u0481\u0483-\u058C\u0590-\u0605\u0609\u060A\u060C\u060D\u0610-\u06DD\u06DF-\u06E8\u06EA-\u06FC\u06FF-\u07F5\u07F7-\u07FD\u0800-\u09F1\u09F4-\u09F9\u09FC-\u0AF0\u0AF2-\u0B6F\u0B71-\u0BF2\u0BFB-\u0C7E\u0C80-\u0D4E\u0D50-\u0D78\u0D7A-\u0E3E\u0E40-\u0F00\u0F04-\u0F12\u0F14\u0F18\u0F19\u0F20-\u0F33\u0F35\u0F37\u0F39-\u0FBD\u0FC6\u0FCD\u0FD0-\u0FD4\u0FD9-\u109D\u10A0-\u138F\u139A-\u166C\u166E-\u17DA\u17DC-\u193F\u1941-\u19DD\u1A00-\u1B60\u1B6B-\u1B73\u1B7D-\u1FBC\u1FBE\u1FC2-\u1FCC\u1FD0-\u1FDC\u1FE0-\u1FEC\u1FF0-\u1FFC\u1FFF-\u2043\u2045-\u2051\u2053-\u2079\u207D-\u2089\u208D-\u209F\u20C0-\u20FF\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u218C-\u218F\u2308-\u230B\u2329\u232A\u2427-\u243F\u244B-\u249B\u24EA-\u24FF\u2768-\u2793\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2B74\u2B75\u2B96\u2C00-\u2CE4\u2CEB-\u2E4F\u2E52-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u3003\u3005-\u3011\u3014-\u301F\u3021-\u3035\u3038-\u303D\u3040-\u309A\u309D-\u318F\u3192-\u3195\u31A0-\u31BF\u31E4-\u31FF\u321F-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48F\uA4C7-\uA6FF\uA717-\uA71F\uA722-\uA788\uA78B-\uA827\uA82C-\uA835\uA83A-\uAA76\uAA7A-\uAB5A\uAB5C-\uAB69\uAB6C-\uD7FF\uE000-\uFB28\uFB2A-\uFBB1\uFBC2-\uFDFB\uFDFE-\uFE61\uFE63\uFE67\uFE68\uFE6A-\uFF03\uFF05-\uFF0A\uFF0C-\uFF1B\uFF1F-\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5F-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]|\uD800[\uDC00-\uDD36\uDD40-\uDD78\uDD8A\uDD8B\uDD8F\uDD9D-\uDD9F\uDDA1-\uDDCF\uDDFD-\uDFFF]|[\uD801\uD803\uD804\uD806\uD808-\uD819\uD81B-\uD82E\uD830-\uD833\uD837\uD839\uD83A\uD83F-\uDBFF][\uDC00-\uDFFF]|\uD802[\uDC00-\uDC76\uDC79-\uDEC7\uDEC9-\uDFFF]|\uD805[\uDC00-\uDF3E\uDF40-\uDFFF]|\uD807[\uDC00-\uDFD4\uDFF2-\uDFFF]|\uD81A[\uDC00-\uDF3B\uDF40-\uDF44\uDF46-\uDFFF]|\uD82F[\uDC00-\uDC9B\uDC9D-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDD65-\uDD69\uDD6D-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDDE9-\uDDFF\uDE42-\uDE44\uDE46-\uDEFF\uDF57-\uDFFF]|\uD835[\uDC00-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE87-\uDFFF]|\uD838[\uDC00-\uDD4E\uDD50-\uDEFE\uDF00-\uDFFF]|\uD83B[\uDC00-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDD2D\uDD2F-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDD0C\uDDAE-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDE5F\uDE66-\uDEFF]|\uD83D[\uDED8-\uDEDF\uDEED-\uDEEF\uDEFD-\uDEFF\uDF74-\uDF7F\uDFD9-\uDFDF\uDFEC-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCB2-\uDCFF\uDD79\uDDCC\uDE54-\uDE5F\uDE6E\uDE6F\uDE75-\uDE77\uDE7B-\uDE7F\uDE87-\uDE8F\uDEA9-\uDEAF\uDEB7-\uDEBF\uDEC3-\uDECF\uDED7-\uDEFF\uDF93\uDFCB-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Unicode regular expression for: everything except symbols from categories S and Z
|
||||
*
|
||||
* Generated by:
|
||||
*
|
||||
* var s = regenerate()
|
||||
* .addRange( 0x0, 0x10FFFF )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Math_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Currency_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Modifier_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Other_Symbol/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Space_Separator/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Line_Separator/symbols" ) )
|
||||
* .remove( require( "@unicode/unicode-13.0.0/General_Category/Paragraph_Separator/symbols" ) );
|
||||
*
|
||||
* https://github.com/mathiasbynens/regenerate
|
||||
* https://github.com/node-unicode/unicode-13.0.0
|
||||
* http://www.unicode.org/reports/tr44/#General_Category_Values
|
||||
*/
|
||||
var regexpNotSAndZ = /[\0-\x1F!-#%-\*,-;\?-\]_a-\{\}\x7F-\x9F\xA1\xA7\xAA\xAB\xAD\xB2\xB3\xB5-\xB7\xB9-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376-\u0383\u0386-\u03F5\u03F7-\u0481\u0483-\u058C\u0590-\u0605\u0609\u060A\u060C\u060D\u0610-\u06DD\u06DF-\u06E8\u06EA-\u06FC\u06FF-\u07F5\u07F7-\u07FD\u0800-\u09F1\u09F4-\u09F9\u09FC-\u0AF0\u0AF2-\u0B6F\u0B71-\u0BF2\u0BFB-\u0C7E\u0C80-\u0D4E\u0D50-\u0D78\u0D7A-\u0E3E\u0E40-\u0F00\u0F04-\u0F12\u0F14\u0F18\u0F19\u0F20-\u0F33\u0F35\u0F37\u0F39-\u0FBD\u0FC6\u0FCD\u0FD0-\u0FD4\u0FD9-\u109D\u10A0-\u138F\u139A-\u166C\u166E-\u167F\u1681-\u17DA\u17DC-\u193F\u1941-\u19DD\u1A00-\u1B60\u1B6B-\u1B73\u1B7D-\u1FBC\u1FBE\u1FC2-\u1FCC\u1FD0-\u1FDC\u1FE0-\u1FEC\u1FF0-\u1FFC\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u2043\u2045-\u2051\u2053-\u205E\u2060-\u2079\u207D-\u2089\u208D-\u209F\u20C0-\u20FF\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u218C-\u218F\u2308-\u230B\u2329\u232A\u2427-\u243F\u244B-\u249B\u24EA-\u24FF\u2768-\u2793\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2B74\u2B75\u2B96\u2C00-\u2CE4\u2CEB-\u2E4F\u2E52-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3001-\u3003\u3005-\u3011\u3014-\u301F\u3021-\u3035\u3038-\u303D\u3040-\u309A\u309D-\u318F\u3192-\u3195\u31A0-\u31BF\u31E4-\u31FF\u321F-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48F\uA4C7-\uA6FF\uA717-\uA71F\uA722-\uA788\uA78B-\uA827\uA82C-\uA835\uA83A-\uAA76\uAA7A-\uAB5A\uAB5C-\uAB69\uAB6C-\uD7FF\uE000-\uFB28\uFB2A-\uFBB1\uFBC2-\uFDFB\uFDFE-\uFE61\uFE63\uFE67\uFE68\uFE6A-\uFF03\uFF05-\uFF0A\uFF0C-\uFF1B\uFF1F-\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5F-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]|\uD800[\uDC00-\uDD36\uDD40-\uDD78\uDD8A\uDD8B\uDD8F\uDD9D-\uDD9F\uDDA1-\uDDCF\uDDFD-\uDFFF]|[\uD801\uD803\uD804\uD806\uD808-\uD819\uD81B-\uD82E\uD830-\uD833\uD837\uD839\uD83A\uD83F-\uDBFF][\uDC00-\uDFFF]|\uD802[\uDC00-\uDC76\uDC79-\uDEC7\uDEC9-\uDFFF]|\uD805[\uDC00-\uDF3E\uDF40-\uDFFF]|\uD807[\uDC00-\uDFD4\uDFF2-\uDFFF]|\uD81A[\uDC00-\uDF3B\uDF40-\uDF44\uDF46-\uDFFF]|\uD82F[\uDC00-\uDC9B\uDC9D-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDD65-\uDD69\uDD6D-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDDE9-\uDDFF\uDE42-\uDE44\uDE46-\uDEFF\uDF57-\uDFFF]|\uD835[\uDC00-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE87-\uDFFF]|\uD838[\uDC00-\uDD4E\uDD50-\uDEFE\uDF00-\uDFFF]|\uD83B[\uDC00-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDD2D\uDD2F-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDD0C\uDDAE-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDE5F\uDE66-\uDEFF]|\uD83D[\uDED8-\uDEDF\uDEED-\uDEEF\uDEFD-\uDEFF\uDF74-\uDF7F\uDFD9-\uDFDF\uDFEC-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCB2-\uDCFF\uDD79\uDDCC\uDE54-\uDE5F\uDE6E\uDE6F\uDE75-\uDE77\uDE7B-\uDE7F\uDE87-\uDE8F\uDEA9-\uDEAF\uDEB7-\uDEBF\uDEC3-\uDECF\uDED7-\uDEFF\uDF93\uDFCB-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* symbolProperties( currency, cldr )
|
||||
*
|
||||
* Return pattern replacing `¤` with the appropriate currency symbol literal.
|
||||
*/
|
||||
var currencySymbolProperties = function( currency, cldr, options ) {
|
||||
var currencySpacing, pattern, symbol, symbolEntries,
|
||||
regexp = {
|
||||
"[:digit:]": /\d/,
|
||||
"[:^S:]": regexpNotS,
|
||||
"[[:^S:]&[:^Z:]]": regexpNotSAndZ
|
||||
};
|
||||
|
||||
if ( options.style === "code" ) {
|
||||
symbol = currency;
|
||||
} else {
|
||||
symbolEntries = [ "symbol" ];
|
||||
|
||||
// If options.symbolForm === "narrow" was passed, prepend it.
|
||||
if ( options.symbolForm === "narrow" ) {
|
||||
symbolEntries.unshift( "symbol-alt-narrow" );
|
||||
}
|
||||
|
||||
symbolEntries.some(function( symbolEntry ) {
|
||||
return symbol = cldr.main([
|
||||
"numbers/currencies",
|
||||
currency,
|
||||
symbolEntry
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
currencySpacing = [ "beforeCurrency", "afterCurrency" ].map(function( position ) {
|
||||
return cldr.main([
|
||||
"numbers",
|
||||
"currencyFormats-numberSystem-" + numberNumberingSystem( cldr ),
|
||||
"currencySpacing",
|
||||
position
|
||||
]);
|
||||
});
|
||||
|
||||
pattern = cldr.main([
|
||||
"numbers",
|
||||
"currencyFormats-numberSystem-" + numberNumberingSystem( cldr ),
|
||||
options.style === "accounting" ? "accounting" : "standard"
|
||||
]);
|
||||
|
||||
pattern =
|
||||
|
||||
// The number of decimal places and the rounding for each currency is not locale-specific.
|
||||
// Those values are overridden by Supplemental Currency Data.
|
||||
currencySupplementalOverride( currency, pattern, cldr )
|
||||
|
||||
// Replace "¤" (\u00A4) with the appropriate symbol literal.
|
||||
.split( ";" ).map(function( pattern ) {
|
||||
|
||||
return pattern.split( "\u00A4" ).map(function( part, i ) {
|
||||
var currencyMatch = regexp[ currencySpacing[ i ].currencyMatch ],
|
||||
surroundingMatch = regexp[ currencySpacing[ i ].surroundingMatch ],
|
||||
insertBetween = "";
|
||||
|
||||
// For currencyMatch and surroundingMatch definitions, read [1].
|
||||
// When i === 0, beforeCurrency is being handled. Otherwise, afterCurrency.
|
||||
// 1: http://www.unicode.org/reports/tr35/tr35-numbers.html#Currencies
|
||||
currencyMatch = currencyMatch.test( symbol.charAt( i ? symbol.length - 1 : 0 ) );
|
||||
surroundingMatch = surroundingMatch.test(
|
||||
part.charAt( i ? 0 : part.length - 1 ).replace( /[#@,.]/g, "0" )
|
||||
);
|
||||
|
||||
if ( currencyMatch && part && surroundingMatch ) {
|
||||
insertBetween = currencySpacing[ i ].insertBetween;
|
||||
}
|
||||
|
||||
return ( i ? insertBetween : "" ) + part + ( i ? "" : insertBetween );
|
||||
}).join( "\u00A4" );
|
||||
}).join( ";" );
|
||||
|
||||
return {
|
||||
pattern: pattern,
|
||||
symbol: symbol
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* nameFormat( formattedNumber, pluralForm, properties )
|
||||
*
|
||||
* Return the appropriate name form currency format.
|
||||
*/
|
||||
var currencyNameFormat = function( formattedNumber, pluralForm, properties ) {
|
||||
var displayName, unitPattern,
|
||||
parts = [],
|
||||
displayNames = properties.displayNames || {},
|
||||
unitPatterns = properties.unitPatterns;
|
||||
|
||||
displayName = displayNames[ "displayName-count-" + pluralForm ] ||
|
||||
displayNames[ "displayName-count-other" ] ||
|
||||
displayNames.displayName ||
|
||||
properties.currency;
|
||||
unitPattern = unitPatterns[ "unitPattern-count-" + pluralForm ] ||
|
||||
unitPatterns[ "unitPattern-count-other" ];
|
||||
|
||||
formatMessageToParts( unitPattern, [ formattedNumber, displayName ]).forEach(function( part ) {
|
||||
if ( part.type === "variable" && part.name === "0" ) {
|
||||
part.value.forEach(function( part ) {
|
||||
partsPush( parts, part.type, part.value );
|
||||
});
|
||||
} else if ( part.type === "variable" && part.name === "1" ) {
|
||||
partsPush( parts, "currency", part.value );
|
||||
} else {
|
||||
partsPush( parts, "literal", part.value );
|
||||
}
|
||||
});
|
||||
|
||||
return parts;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* symbolFormat( parts, symbol )
|
||||
*
|
||||
* Return the appropriate symbol/account form format.
|
||||
*/
|
||||
var currencySymbolFormat = function( parts, symbol ) {
|
||||
parts.forEach(function( part ) {
|
||||
if ( part.type === "currency" ) {
|
||||
part.value = symbol;
|
||||
}
|
||||
});
|
||||
return parts;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var currencyToPartsFormatterFn = function( numberToPartsFormatter, pluralGenerator, properties ) {
|
||||
var fn;
|
||||
|
||||
// Return formatter when style is "name".
|
||||
if ( pluralGenerator && properties ) {
|
||||
fn = function currencyToPartsFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
return currencyNameFormat(
|
||||
numberToPartsFormatter( value ),
|
||||
pluralGenerator( value ),
|
||||
properties
|
||||
);
|
||||
};
|
||||
|
||||
// Return formatter when style is "symbol", "accounting", or "code".
|
||||
} else {
|
||||
fn = function currencyToPartsFormatter( value ) {
|
||||
|
||||
// 1: Reusing pluralGenerator argument, but in this case it is actually `symbol`
|
||||
return currencySymbolFormat( numberToPartsFormatter( value ), pluralGenerator /* 1 */ );
|
||||
};
|
||||
}
|
||||
|
||||
return fn;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* objectOmit( object, keys )
|
||||
*
|
||||
* Return a copy of the object, filtered to omit the blacklisted key or array of keys.
|
||||
*/
|
||||
var objectOmit = function( object, keys ) {
|
||||
var key,
|
||||
copy = {};
|
||||
|
||||
keys = alwaysArray( keys );
|
||||
|
||||
for ( key in object ) {
|
||||
if ( keys.indexOf( key ) === -1 ) {
|
||||
copy[ key ] = object[ key ];
|
||||
}
|
||||
}
|
||||
|
||||
return copy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function validateRequiredCldr( path, value ) {
|
||||
validateCldr( path, value, {
|
||||
skip: [
|
||||
/numbers\/currencies\/[^/]+\/symbol-alt-/,
|
||||
/supplemental\/currencyData\/fractions\/[A-Za-z]{3}$/
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* .currencyFormatter( currency [, options] )
|
||||
*
|
||||
* @currency [String] 3-letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @options [Object]:
|
||||
* - style: [String] "symbol" (default), "accounting", "code" or "name".
|
||||
* - see also number/format options.
|
||||
*
|
||||
* Return a function that formats a currency according to the given options and default/instance
|
||||
* locale.
|
||||
*/
|
||||
Globalize.currencyFormatter =
|
||||
Globalize.prototype.currencyFormatter = function( currency, options ) {
|
||||
var args, currencyToPartsFormatter, returnFn;
|
||||
|
||||
validateParameterPresence( currency, "currency" );
|
||||
validateParameterTypeCurrency( currency, "currency" );
|
||||
|
||||
validateParameterTypePlainObject( options, "options" );
|
||||
|
||||
options = options || {};
|
||||
args = [ currency, options ];
|
||||
|
||||
currencyToPartsFormatter = this.currencyToPartsFormatter( currency, options );
|
||||
returnFn = currencyFormatterFn( currencyToPartsFormatter );
|
||||
runtimeBind( args, this.cldr, returnFn, [ currencyToPartsFormatter ] );
|
||||
|
||||
return returnFn;
|
||||
};
|
||||
|
||||
/**
|
||||
* .currencyToPartsFormatter( currency [, options] )
|
||||
*
|
||||
* @currency [String] 3-letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @options [Object]:
|
||||
* - style: [String] "symbol" (default), "accounting", "code" or "name".
|
||||
* - see also number/format options.
|
||||
*
|
||||
* Return a currency formatter function (of the form below) according to the given options and the
|
||||
* default/instance locale.
|
||||
*
|
||||
* fn( value )
|
||||
*
|
||||
* @value [Number]
|
||||
*
|
||||
* Return a function that formats a currency to parts according to the given options
|
||||
* and the default/instance locale.
|
||||
*/
|
||||
Globalize.currencyToPartsFormatter =
|
||||
Globalize.prototype.currencyToPartsFormatter = function( currency, options ) {
|
||||
var args, cldr, numberToPartsFormatter, pluralGenerator, properties, returnFn, style;
|
||||
|
||||
validateParameterPresence( currency, "currency" );
|
||||
validateParameterTypeCurrency( currency, "currency" );
|
||||
|
||||
validateParameterTypePlainObject( options, "options" );
|
||||
|
||||
cldr = this.cldr;
|
||||
options = options || {};
|
||||
|
||||
args = [ currency, options ];
|
||||
style = options.style || "symbol";
|
||||
|
||||
validateDefaultLocale( cldr );
|
||||
|
||||
// Get properties given style ("symbol" default, "code" or "name").
|
||||
cldr.on( "get", validateRequiredCldr );
|
||||
try {
|
||||
properties = ({
|
||||
accounting: currencySymbolProperties,
|
||||
code: currencySymbolProperties,
|
||||
name: currencyNameProperties,
|
||||
symbol: currencySymbolProperties
|
||||
}[ style ] )( currency, cldr, options );
|
||||
} finally {
|
||||
cldr.off( "get", validateRequiredCldr );
|
||||
}
|
||||
|
||||
// options = options minus style, plus raw pattern.
|
||||
options = objectOmit( options, "style" );
|
||||
options.raw = properties.pattern;
|
||||
|
||||
// Return formatter when style is "symbol", "accounting", or "code".
|
||||
if ( style === "symbol" || style === "accounting" || style === "code" ) {
|
||||
numberToPartsFormatter = this.numberToPartsFormatter( options );
|
||||
|
||||
returnFn = currencyToPartsFormatterFn( numberToPartsFormatter, properties.symbol );
|
||||
|
||||
runtimeBind( args, cldr, returnFn, [ numberToPartsFormatter, properties.symbol ] );
|
||||
|
||||
// Return formatter when style is "name".
|
||||
} else {
|
||||
numberToPartsFormatter = this.numberToPartsFormatter( options );
|
||||
|
||||
// Is plural module present? Yes, use its generator. Nope, use an error generator.
|
||||
pluralGenerator = this.plural !== undefined ?
|
||||
this.pluralGenerator() :
|
||||
createErrorPluralModulePresence;
|
||||
|
||||
returnFn = currencyToPartsFormatterFn(
|
||||
numberToPartsFormatter,
|
||||
pluralGenerator,
|
||||
properties
|
||||
);
|
||||
|
||||
runtimeBind( args, cldr, returnFn, [
|
||||
numberToPartsFormatter,
|
||||
pluralGenerator,
|
||||
properties
|
||||
]);
|
||||
}
|
||||
|
||||
return returnFn;
|
||||
};
|
||||
|
||||
/**
|
||||
* .currencyParser( currency [, options] )
|
||||
*
|
||||
* @currency [String] 3-letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @options [Object] see currencyFormatter.
|
||||
*
|
||||
* Return the currency parser according to the given options and the default/instance locale.
|
||||
*/
|
||||
Globalize.currencyParser =
|
||||
Globalize.prototype.currencyParser = function( /* currency, options */ ) {
|
||||
|
||||
// TODO implement parser.
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* .formatCurrency( value, currency [, options] )
|
||||
*
|
||||
* @value [Number] number to be formatted.
|
||||
*
|
||||
* @currency [String] 3-letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @options [Object] see currencyFormatter.
|
||||
*
|
||||
* Format a currency according to the given options and the default/instance locale.
|
||||
*/
|
||||
Globalize.formatCurrency =
|
||||
Globalize.prototype.formatCurrency = function( value, currency, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
return this.currencyFormatter( currency, options )( value );
|
||||
};
|
||||
|
||||
/**
|
||||
* .formatCurrencyToParts( value, currency [, options] )
|
||||
*
|
||||
* @value [Number] number to be formatted.
|
||||
*
|
||||
* @currency [String] 3-letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @options [Object] see currencyFormatter.
|
||||
*
|
||||
* Format a currency to parts according to the given options and the default/instance locale.
|
||||
*/
|
||||
Globalize.formatCurrencyToParts =
|
||||
Globalize.prototype.formatCurrencyToParts = function( value, currency, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
return this.currencyToPartsFormatter( currency, options )( value );
|
||||
};
|
||||
|
||||
/**
|
||||
* .parseCurrency( value, currency [, options] )
|
||||
*
|
||||
* @value [String]
|
||||
*
|
||||
* @currency [String] 3-letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @options [Object]: See currencyFormatter.
|
||||
*
|
||||
* Return the parsed currency or NaN when value is invalid.
|
||||
*/
|
||||
Globalize.parseCurrency =
|
||||
Globalize.prototype.parseCurrency = function( /* value, currency, options */ ) {
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
3139
BeWoPlanerMobil/node_modules/globalize/dist/globalize/date.js
generated
vendored
Normal file
3139
BeWoPlanerMobil/node_modules/globalize/dist/globalize/date.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2076
BeWoPlanerMobil/node_modules/globalize/dist/globalize/message.js
generated
vendored
Normal file
2076
BeWoPlanerMobil/node_modules/globalize/dist/globalize/message.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1727
BeWoPlanerMobil/node_modules/globalize/dist/globalize/number.js
generated
vendored
Normal file
1727
BeWoPlanerMobil/node_modules/globalize/dist/globalize/number.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
376
BeWoPlanerMobil/node_modules/globalize/dist/globalize/plural.js
generated
vendored
Normal file
376
BeWoPlanerMobil/node_modules/globalize/dist/globalize/plural.js
generated
vendored
Normal file
@@ -0,0 +1,376 @@
|
||||
/**
|
||||
* Globalize v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"cldr",
|
||||
"../globalize",
|
||||
"cldr/event",
|
||||
"cldr/supplemental"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "cldrjs" ), require( "../globalize" ) );
|
||||
} else {
|
||||
|
||||
// Global
|
||||
factory( root.Cldr, root.Globalize );
|
||||
}
|
||||
}(this, function( Cldr, Globalize ) {
|
||||
|
||||
var runtimeBind = Globalize._runtimeBind,
|
||||
validateCldr = Globalize._validateCldr,
|
||||
validateDefaultLocale = Globalize._validateDefaultLocale,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterType = Globalize._validateParameterType,
|
||||
validateParameterTypePlainObject = Globalize._validateParameterTypePlainObject;
|
||||
var MakePlural;
|
||||
/* eslint-disable */
|
||||
MakePlural = (function() {
|
||||
'use strict';
|
||||
|
||||
var _toArray = function (arr) { return Array.isArray(arr) ? arr : Array.from(arr); };
|
||||
|
||||
var _toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } };
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
|
||||
/**
|
||||
* make-plural.js -- https://github.com/eemeli/make-plural.js/
|
||||
* Copyright (c) 2014-2015 by Eemeli Aro <eemeli@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* The software is provided "as is" and the author disclaims all warranties
|
||||
* with regard to this software including all implied warranties of
|
||||
* merchantability and fitness. In no event shall the author be liable for
|
||||
* any special, direct, indirect, or consequential damages or any damages
|
||||
* whatsoever resulting from loss of use, data or profits, whether in an
|
||||
* action of contract, negligence or other tortious action, arising out of
|
||||
* or in connection with the use or performance of this software.
|
||||
*/
|
||||
|
||||
var Parser = (function () {
|
||||
function Parser() {
|
||||
_classCallCheck(this, Parser);
|
||||
}
|
||||
|
||||
_createClass(Parser, [{
|
||||
key: 'parse',
|
||||
value: function parse(cond) {
|
||||
var _this = this;
|
||||
|
||||
if (cond === 'i = 0 or n = 1') {
|
||||
return 'n >= 0 && n <= 1';
|
||||
}if (cond === 'i = 0,1') {
|
||||
return 'n >= 0 && n < 2';
|
||||
}if (cond === 'i = 1 and v = 0') {
|
||||
this.v0 = 1;
|
||||
return 'n == 1 && v0';
|
||||
}
|
||||
return cond.replace(/([tv]) (!?)= 0/g, function (m, sym, noteq) {
|
||||
var sn = sym + '0';
|
||||
_this[sn] = 1;
|
||||
return noteq ? '!' + sn : sn;
|
||||
}).replace(/\b[fintv]\b/g, function (m) {
|
||||
_this[m] = 1;
|
||||
return m;
|
||||
}).replace(/([fin]) % (10+)/g, function (m, sym, num) {
|
||||
var sn = sym + num;
|
||||
_this[sn] = 1;
|
||||
return sn;
|
||||
}).replace(/n10+ = 0/g, 't0 && $&').replace(/(\w+ (!?)= )([0-9.]+,[0-9.,]+)/g, function (m, se, noteq, x) {
|
||||
if (m === 'n = 0,1') return '(n == 0 || n == 1)';
|
||||
if (noteq) return se + x.split(',').join(' && ' + se);
|
||||
return '(' + se + x.split(',').join(' || ' + se) + ')';
|
||||
}).replace(/(\w+) (!?)= ([0-9]+)\.\.([0-9]+)/g, function (m, sym, noteq, x0, x1) {
|
||||
if (Number(x0) + 1 === Number(x1)) {
|
||||
if (noteq) return '' + sym + ' != ' + x0 + ' && ' + sym + ' != ' + x1;
|
||||
return '(' + sym + ' == ' + x0 + ' || ' + sym + ' == ' + x1 + ')';
|
||||
}
|
||||
if (noteq) return '(' + sym + ' < ' + x0 + ' || ' + sym + ' > ' + x1 + ')';
|
||||
if (sym === 'n') {
|
||||
_this.t0 = 1;return '(t0 && n >= ' + x0 + ' && n <= ' + x1 + ')';
|
||||
}
|
||||
return '(' + sym + ' >= ' + x0 + ' && ' + sym + ' <= ' + x1 + ')';
|
||||
}).replace(/ and /g, ' && ').replace(/ or /g, ' || ').replace(/ = /g, ' == ');
|
||||
}
|
||||
}, {
|
||||
key: 'vars',
|
||||
value: (function (_vars) {
|
||||
function vars() {
|
||||
return _vars.apply(this, arguments);
|
||||
}
|
||||
|
||||
vars.toString = function () {
|
||||
return _vars.toString();
|
||||
};
|
||||
|
||||
return vars;
|
||||
})(function () {
|
||||
var vars = [];
|
||||
if (this.i) vars.push('i = s[0]');
|
||||
if (this.f || this.v) vars.push('f = s[1] || \'\'');
|
||||
if (this.t) vars.push('t = (s[1] || \'\').replace(/0+$/, \'\')');
|
||||
if (this.v) vars.push('v = f.length');
|
||||
if (this.v0) vars.push('v0 = !s[1]');
|
||||
if (this.t0 || this.n10 || this.n100) vars.push('t0 = Number(s[0]) == n');
|
||||
for (var k in this) {
|
||||
if (/^.10+$/.test(k)) {
|
||||
var k0 = k[0] === 'n' ? 't0 && s[0]' : k[0];
|
||||
vars.push('' + k + ' = ' + k0 + '.slice(-' + k.substr(2).length + ')');
|
||||
}
|
||||
}if (!vars.length) return '';
|
||||
return 'var ' + ['s = String(n).split(\'.\')'].concat(vars).join(', ');
|
||||
})
|
||||
}]);
|
||||
|
||||
return Parser;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
var MakePlural = (function () {
|
||||
function MakePlural(lc) {
|
||||
var _ref = arguments[1] === undefined ? MakePlural : arguments[1];
|
||||
|
||||
var cardinals = _ref.cardinals;
|
||||
var ordinals = _ref.ordinals;
|
||||
|
||||
_classCallCheck(this, MakePlural);
|
||||
|
||||
if (!cardinals && !ordinals) throw new Error('At least one type of plural is required');
|
||||
this.lc = lc;
|
||||
this.categories = { cardinal: [], ordinal: [] };
|
||||
this.parser = new Parser();
|
||||
|
||||
this.fn = this.buildFunction(cardinals, ordinals);
|
||||
this.fn._obj = this;
|
||||
this.fn.categories = this.categories;
|
||||
|
||||
this.fn.toString = this.fnToString.bind(this);
|
||||
return this.fn;
|
||||
}
|
||||
|
||||
_createClass(MakePlural, [{
|
||||
key: 'compile',
|
||||
value: function compile(type, req) {
|
||||
var cases = [];
|
||||
var rules = MakePlural.rules[type][this.lc];
|
||||
if (!rules) {
|
||||
if (req) throw new Error('Locale "' + this.lc + '" ' + type + ' rules not found');
|
||||
this.categories[type] = ['other'];
|
||||
return '\'other\'';
|
||||
}
|
||||
for (var r in rules) {
|
||||
var _rules$r$trim$split = rules[r].trim().split(/\s*@\w*/);
|
||||
|
||||
var _rules$r$trim$split2 = _toArray(_rules$r$trim$split);
|
||||
|
||||
var cond = _rules$r$trim$split2[0];
|
||||
var examples = _rules$r$trim$split2.slice(1);
|
||||
var cat = r.replace('pluralRule-count-', '');
|
||||
if (cond) cases.push([this.parser.parse(cond), cat]);
|
||||
|
||||
}
|
||||
this.categories[type] = cases.map(function (c) {
|
||||
return c[1];
|
||||
}).concat('other');
|
||||
if (cases.length === 1) {
|
||||
return '(' + cases[0][0] + ') ? \'' + cases[0][1] + '\' : \'other\'';
|
||||
} else {
|
||||
return [].concat(_toConsumableArray(cases.map(function (c) {
|
||||
return '(' + c[0] + ') ? \'' + c[1] + '\'';
|
||||
})), ['\'other\'']).join('\n : ');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'buildFunction',
|
||||
value: function buildFunction(cardinals, ordinals) {
|
||||
var _this3 = this;
|
||||
|
||||
var compile = function compile(c) {
|
||||
return c ? (c[1] ? 'return ' : 'if (ord) return ') + _this3.compile.apply(_this3, _toConsumableArray(c)) : '';
|
||||
},
|
||||
fold = { vars: function vars(str) {
|
||||
return (' ' + str + ';').replace(/(.{1,78})(,|$) ?/g, '$1$2\n ');
|
||||
},
|
||||
cond: function cond(str) {
|
||||
return (' ' + str + ';').replace(/(.{1,78}) (\|\| |$) ?/gm, '$1\n $2');
|
||||
} },
|
||||
cond = [ordinals && ['ordinal', !cardinals], cardinals && ['cardinal', true]].map(compile).map(fold.cond),
|
||||
body = [fold.vars(this.parser.vars())].concat(_toConsumableArray(cond)).join('\n').replace(/\s+$/gm, '').replace(/^[\s;]*[\r\n]+/gm, ''),
|
||||
args = ordinals && cardinals ? 'n, ord' : 'n';
|
||||
return new Function(args, body);
|
||||
}
|
||||
}, {
|
||||
key: 'fnToString',
|
||||
value: function fnToString(name) {
|
||||
return Function.prototype.toString.call(this.fn).replace(/^function( \w+)?/, name ? 'function ' + name : 'function').replace('\n/**/', '');
|
||||
}
|
||||
}], [{
|
||||
key: 'load',
|
||||
value: function load() {
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
args.forEach(function (cldr) {
|
||||
var data = cldr && cldr.supplemental || null;
|
||||
if (!data) throw new Error('Data does not appear to be CLDR data');
|
||||
MakePlural.rules = {
|
||||
cardinal: data['plurals-type-cardinal'] || MakePlural.rules.cardinal,
|
||||
ordinal: data['plurals-type-ordinal'] || MakePlural.rules.ordinal
|
||||
};
|
||||
});
|
||||
return MakePlural;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MakePlural;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
MakePlural.cardinals = true;
|
||||
MakePlural.ordinals = false;
|
||||
MakePlural.rules = { cardinal: {}, ordinal: {} };
|
||||
|
||||
|
||||
return MakePlural;
|
||||
}());
|
||||
/* eslint-enable */
|
||||
|
||||
|
||||
var validateParameterTypeNumber = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || typeof value === "number",
|
||||
"Number"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var validateParameterTypePluralType = function( value, name ) {
|
||||
validateParameterType(
|
||||
value,
|
||||
name,
|
||||
value === undefined || value === "cardinal" || value === "ordinal",
|
||||
"String \"cardinal\" or \"ordinal\""
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var pluralGeneratorFn = function( plural ) {
|
||||
return function pluralGenerator( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return plural( value );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* .plural( value )
|
||||
*
|
||||
* @value [Number]
|
||||
*
|
||||
* Return the corresponding form (zero | one | two | few | many | other) of a
|
||||
* value given locale.
|
||||
*/
|
||||
Globalize.plural =
|
||||
Globalize.prototype.plural = function( value, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
return this.pluralGenerator( options )( value );
|
||||
};
|
||||
|
||||
/**
|
||||
* .pluralGenerator( [options] )
|
||||
*
|
||||
* Return a plural function (of the form below).
|
||||
*
|
||||
* fn( value )
|
||||
*
|
||||
* @value [Number]
|
||||
*
|
||||
* Return the corresponding form (zero | one | two | few | many | other) of a value given the
|
||||
* default/instance locale.
|
||||
*/
|
||||
Globalize.pluralGenerator =
|
||||
Globalize.prototype.pluralGenerator = function( options ) {
|
||||
var args, cldr, isOrdinal, plural, returnFn, type;
|
||||
|
||||
validateParameterTypePlainObject( options, "options" );
|
||||
|
||||
options = options || {};
|
||||
cldr = this.cldr;
|
||||
|
||||
args = [ options ];
|
||||
type = options.type || "cardinal";
|
||||
|
||||
validateParameterTypePluralType( options.type, "options.type" );
|
||||
|
||||
validateDefaultLocale( cldr );
|
||||
|
||||
isOrdinal = type === "ordinal";
|
||||
|
||||
cldr.on( "get", validateCldr );
|
||||
try {
|
||||
cldr.supplemental([ "plurals-type-" + type, "{language}" ]);
|
||||
} finally {
|
||||
cldr.off( "get", validateCldr );
|
||||
}
|
||||
|
||||
MakePlural.rules = {};
|
||||
MakePlural.rules[ type ] = cldr.supplemental( "plurals-type-" + type );
|
||||
|
||||
plural = new MakePlural( cldr.attributes.language, {
|
||||
"ordinals": isOrdinal,
|
||||
"cardinals": !isOrdinal
|
||||
});
|
||||
|
||||
returnFn = pluralGeneratorFn( plural );
|
||||
|
||||
runtimeBind( args, cldr, returnFn, [ plural ] );
|
||||
|
||||
return returnFn;
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
203
BeWoPlanerMobil/node_modules/globalize/dist/globalize/relative-time.js
generated
vendored
Normal file
203
BeWoPlanerMobil/node_modules/globalize/dist/globalize/relative-time.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
/**
|
||||
* Globalize v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"cldr",
|
||||
"../globalize",
|
||||
"./number",
|
||||
"./plural",
|
||||
"cldr/event",
|
||||
"cldr/supplemental"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "cldrjs" ), require( "../globalize" ) );
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Cldr, root.Globalize );
|
||||
}
|
||||
}(this, function( Cldr, Globalize ) {
|
||||
|
||||
var formatMessage = Globalize._formatMessage,
|
||||
runtimeBind = Globalize._runtimeBind,
|
||||
validateCldr = Globalize._validateCldr,
|
||||
validateDefaultLocale = Globalize._validateDefaultLocale,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterTypeString = Globalize._validateParameterTypeString,
|
||||
validateParameterTypeNumber = Globalize._validateParameterTypeNumber;
|
||||
|
||||
|
||||
/**
|
||||
* format( value, numberFormatter, pluralGenerator, properties )
|
||||
*
|
||||
* @value [Number] The number to format
|
||||
*
|
||||
* @numberFormatter [String] A numberFormatter from Globalize.numberFormatter
|
||||
*
|
||||
* @pluralGenerator [String] A pluralGenerator from Globalize.pluralGenerator
|
||||
*
|
||||
* @properties [Object] containing relative time plural message.
|
||||
*
|
||||
* Format relative time.
|
||||
*/
|
||||
var relativeTimeFormat = function( value, numberFormatter, pluralGenerator, properties ) {
|
||||
|
||||
var relativeTime,
|
||||
message = properties[ "relative-type-" + value ];
|
||||
|
||||
if ( message ) {
|
||||
return message;
|
||||
}
|
||||
|
||||
relativeTime = value <= 0 ? properties[ "relativeTime-type-past" ] :
|
||||
properties[ "relativeTime-type-future" ];
|
||||
|
||||
value = Math.abs( value );
|
||||
|
||||
message = relativeTime[ "relativeTimePattern-count-" + pluralGenerator( value ) ];
|
||||
return formatMessage( message, [ numberFormatter( value ) ] );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var relativeTimeFormatterFn = function( numberFormatter, pluralGenerator, properties ) {
|
||||
return function relativeTimeFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return relativeTimeFormat( value, numberFormatter, pluralGenerator, properties );
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* properties( unit, cldr, options )
|
||||
*
|
||||
* @unit [String] eg. "day", "week", "month", etc.
|
||||
*
|
||||
* @cldr [Cldr instance].
|
||||
*
|
||||
* @options [Object]
|
||||
* - form: [String] eg. "short" or "narrow". Or falsy for default long form.
|
||||
*
|
||||
* Return relative time properties.
|
||||
*/
|
||||
var relativeTimeProperties = function( unit, cldr, options ) {
|
||||
|
||||
var form = options.form,
|
||||
raw, properties, key, match;
|
||||
|
||||
if ( form ) {
|
||||
unit = unit + "-" + form;
|
||||
}
|
||||
|
||||
raw = cldr.main( [ "dates", "fields", unit ] );
|
||||
properties = {
|
||||
"relativeTime-type-future": raw[ "relativeTime-type-future" ],
|
||||
"relativeTime-type-past": raw[ "relativeTime-type-past" ]
|
||||
};
|
||||
for ( key in raw ) {
|
||||
if ( raw.hasOwnProperty( key ) ) {
|
||||
match = /relative-type-(-?[0-9]+)/.exec( key );
|
||||
if ( match ) {
|
||||
properties[ key ] = raw[ key ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return properties;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* .formatRelativeTime( value, unit [, options] )
|
||||
*
|
||||
* @value [Number] The number of unit to format.
|
||||
*
|
||||
* @unit [String] see .relativeTimeFormatter() for details.
|
||||
*
|
||||
* @options [Object] see .relativeTimeFormatter() for details.
|
||||
*
|
||||
* Formats a relative time according to the given unit, options, and the default/instance locale.
|
||||
*/
|
||||
Globalize.formatRelativeTime =
|
||||
Globalize.prototype.formatRelativeTime = function( value, unit, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.relativeTimeFormatter( unit, options )( value );
|
||||
};
|
||||
|
||||
/**
|
||||
* .relativeTimeFormatter( unit [, options ])
|
||||
*
|
||||
* @unit [String] String value indicating the unit to be formatted. eg. "day", "week", "month", etc.
|
||||
*
|
||||
* @options [Object]
|
||||
* - form: [String] eg. "short" or "narrow". Or falsy for default long form.
|
||||
*
|
||||
* Returns a function that formats a relative time according to the given unit, options, and the
|
||||
* default/instance locale.
|
||||
*/
|
||||
Globalize.relativeTimeFormatter =
|
||||
Globalize.prototype.relativeTimeFormatter = function( unit, options ) {
|
||||
var args, cldr, numberFormatter, pluralGenerator, properties, returnFn;
|
||||
|
||||
validateParameterPresence( unit, "unit" );
|
||||
validateParameterTypeString( unit, "unit" );
|
||||
|
||||
cldr = this.cldr;
|
||||
options = options || {};
|
||||
|
||||
args = [ unit, options ];
|
||||
|
||||
validateDefaultLocale( cldr );
|
||||
|
||||
cldr.on( "get", validateCldr );
|
||||
try {
|
||||
properties = relativeTimeProperties( unit, cldr, options );
|
||||
} finally {
|
||||
cldr.off( "get", validateCldr );
|
||||
}
|
||||
numberFormatter = this.numberFormatter( options );
|
||||
pluralGenerator = this.pluralGenerator();
|
||||
|
||||
returnFn = relativeTimeFormatterFn( numberFormatter, pluralGenerator, properties );
|
||||
|
||||
runtimeBind( args, cldr, returnFn, [ numberFormatter, pluralGenerator, properties ] );
|
||||
|
||||
return returnFn;
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
301
BeWoPlanerMobil/node_modules/globalize/dist/globalize/unit.js
generated
vendored
Normal file
301
BeWoPlanerMobil/node_modules/globalize/dist/globalize/unit.js
generated
vendored
Normal file
@@ -0,0 +1,301 @@
|
||||
/**
|
||||
* Globalize v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
/*!
|
||||
* Globalize v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
||||
* http://git.io/TrdQbw
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"cldr",
|
||||
"../globalize",
|
||||
"./number",
|
||||
"./plural"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "cldrjs" ), require( "../globalize" ) );
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Cldr, root.Globalize );
|
||||
}
|
||||
}(this, function( Cldr, Globalize ) {
|
||||
|
||||
var formatMessage = Globalize._formatMessage,
|
||||
runtimeBind = Globalize._runtimeBind,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterTypePlainObject = Globalize._validateParameterTypePlainObject,
|
||||
validateParameterTypeNumber = Globalize._validateParameterTypeNumber,
|
||||
validateParameterTypeString = Globalize._validateParameterTypeString;
|
||||
|
||||
|
||||
/**
|
||||
* format( value, numberFormatter, pluralGenerator, unitProperies )
|
||||
*
|
||||
* @value [Number]
|
||||
*
|
||||
* @numberFormatter [Object]: A numberFormatter from Globalize.numberFormatter.
|
||||
*
|
||||
* @pluralGenerator [Object]: A pluralGenerator from Globalize.pluralGenerator.
|
||||
*
|
||||
* @unitProperies [Object]: localized unit data from cldr.
|
||||
*
|
||||
* Format units such as seconds, minutes, days, weeks, etc.
|
||||
*
|
||||
* OBS:
|
||||
*
|
||||
* Unit Sequences are not implemented.
|
||||
* http://www.unicode.org/reports/tr35/tr35-35/tr35-general.html#Unit_Sequences
|
||||
*
|
||||
* Duration Unit (for composed time unit durations) is not implemented.
|
||||
* http://www.unicode.org/reports/tr35/tr35-35/tr35-general.html#durationUnit
|
||||
*/
|
||||
var unitFormat = function( value, numberFormatter, pluralGenerator, unitProperties ) {
|
||||
var compoundUnitPattern = unitProperties.compoundUnitPattern, dividend, dividendProperties,
|
||||
formattedValue, divisor, divisorProperties, message, pluralValue, oneProperty;
|
||||
|
||||
unitProperties = unitProperties.unitProperties;
|
||||
formattedValue = numberFormatter( value );
|
||||
pluralValue = pluralGenerator( value );
|
||||
|
||||
// computed compound unit, eg. "megabyte-per-second".
|
||||
if ( unitProperties instanceof Array ) {
|
||||
dividendProperties = unitProperties[ 0 ];
|
||||
divisorProperties = unitProperties[ 1 ];
|
||||
oneProperty = divisorProperties.hasOwnProperty( "one" ) ? "one" : "other";
|
||||
|
||||
dividend = formatMessage( dividendProperties[ pluralValue ], [ formattedValue ] );
|
||||
divisor = formatMessage( divisorProperties[ oneProperty ], [ "" ] ).trim();
|
||||
|
||||
return formatMessage( compoundUnitPattern, [ dividend, divisor ] );
|
||||
}
|
||||
|
||||
message = unitProperties[ pluralValue ];
|
||||
|
||||
return formatMessage( message, [ formattedValue ] );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var unitFormatterFn = function( numberFormatter, pluralGenerator, unitProperties ) {
|
||||
return function unitFormatter( value ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return unitFormat( value, numberFormatter, pluralGenerator, unitProperties );
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* categories()
|
||||
*
|
||||
* Return all unit categories.
|
||||
*/
|
||||
var unitCategories = [ "acceleration", "angle", "area", "digital", "duration", "length", "mass", "power",
|
||||
"pressure", "speed", "temperature", "volume" ];
|
||||
|
||||
|
||||
|
||||
|
||||
function stripPluralGarbage( data ) {
|
||||
var aux, pluralCount;
|
||||
|
||||
if ( data ) {
|
||||
aux = {};
|
||||
for ( pluralCount in data ) {
|
||||
aux[ pluralCount.replace( /unitPattern-count-/, "" ) ] = data[ pluralCount ];
|
||||
}
|
||||
}
|
||||
|
||||
return aux;
|
||||
}
|
||||
|
||||
/**
|
||||
* get( unit, form, cldr )
|
||||
*
|
||||
* @unit [String] The full type-unit name (eg. duration-second), or the short unit name
|
||||
* (eg. second).
|
||||
*
|
||||
* @form [String] A string describing the form of the unit representation (eg. long,
|
||||
* short, narrow).
|
||||
*
|
||||
* @cldr [Cldr instance].
|
||||
*
|
||||
* Return the plural map of a unit, eg: "second"
|
||||
* { "one": "{0} second",
|
||||
* "other": "{0} seconds" }
|
||||
* }
|
||||
*
|
||||
* Or the Array of plural maps of a compound-unit, eg: "foot-per-second"
|
||||
* [ { "one": "{0} foot",
|
||||
* "other": "{0} feet" },
|
||||
* { "one": "{0} second",
|
||||
* "other": "{0} seconds" } ]
|
||||
*
|
||||
* Uses the precomputed form of a compound-unit if available, eg: "mile-per-hour"
|
||||
* { "displayName": "miles per hour",
|
||||
* "unitPattern-count-one": "{0} mile per hour",
|
||||
* "unitPattern-count-other": "{0} miles per hour"
|
||||
* },
|
||||
*
|
||||
* Also supports "/" instead of "-per-", eg. "foot/second", using the precomputed form if
|
||||
* available.
|
||||
*
|
||||
* Or the Array of plural maps of a compound-unit, eg: "foot-per-second"
|
||||
* [ { "one": "{0} foot",
|
||||
* "other": "{0} feet" },
|
||||
* { "one": "{0} second",
|
||||
* "other": "{0} seconds" } ]
|
||||
*
|
||||
* Or undefined in case the unit (or a unit of the compound-unit) doesn't exist.
|
||||
*/
|
||||
var get = function( unit, form, cldr ) {
|
||||
var ret;
|
||||
|
||||
// Ensure that we get the 'precomputed' form, if present.
|
||||
unit = unit.replace( /\//, "-per-" );
|
||||
|
||||
// Get unit or <category>-unit (eg. "duration-second").
|
||||
[ "" ].concat( unitCategories ).some(function( category ) {
|
||||
return ret = cldr.main([
|
||||
"units",
|
||||
form,
|
||||
category.length ? category + "-" + unit : unit
|
||||
]);
|
||||
});
|
||||
|
||||
// Rename keys s/unitPattern-count-//g.
|
||||
ret = stripPluralGarbage( ret );
|
||||
|
||||
// Compound Unit, eg. "foot-per-second" or "foot/second".
|
||||
if ( !ret && ( /-per-/ ).test( unit ) ) {
|
||||
|
||||
// "Some units already have 'precomputed' forms, such as kilometer-per-hour;
|
||||
// where such units exist, they should be used in preference" UTS#35.
|
||||
// Note that precomputed form has already been handled above (!ret).
|
||||
|
||||
// Get both recursively.
|
||||
unit = unit.split( "-per-" );
|
||||
ret = unit.map(function( unit ) {
|
||||
return get( unit, form, cldr );
|
||||
});
|
||||
if ( !ret[ 0 ] || !ret[ 1 ] ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
var unitGet = get;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* properties( unit, form, cldr )
|
||||
*
|
||||
* @unit [String] The full type-unit name (eg. duration-second), or the short unit name
|
||||
* (eg. second).
|
||||
*
|
||||
* @form [String] A string describing the form of the unit representation (eg. long,
|
||||
* short, narrow).
|
||||
*
|
||||
* @cldr [Cldr instance].
|
||||
*/
|
||||
var unitProperties = function( unit, form, cldr ) {
|
||||
var compoundUnitPattern, unitProperties;
|
||||
|
||||
compoundUnitPattern = cldr.main( [ "units", form, "per/compoundUnitPattern" ] );
|
||||
unitProperties = unitGet( unit, form, cldr );
|
||||
|
||||
return {
|
||||
compoundUnitPattern: compoundUnitPattern,
|
||||
unitProperties: unitProperties
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Globalize.formatUnit( value, unit, options )
|
||||
*
|
||||
* @value [Number]
|
||||
*
|
||||
* @unit [String]: The unit (e.g "second", "day", "year")
|
||||
*
|
||||
* @options [Object]
|
||||
* - form: [String] "long", "short" (default), or "narrow".
|
||||
*
|
||||
* Format units such as seconds, minutes, days, weeks, etc.
|
||||
*/
|
||||
Globalize.formatUnit =
|
||||
Globalize.prototype.formatUnit = function( value, unit, options ) {
|
||||
validateParameterPresence( value, "value" );
|
||||
validateParameterTypeNumber( value, "value" );
|
||||
|
||||
return this.unitFormatter( unit, options )( value );
|
||||
};
|
||||
|
||||
/**
|
||||
* Globalize.unitFormatter( unit, options )
|
||||
*
|
||||
* @unit [String]: The unit (e.g "second", "day", "year")
|
||||
*
|
||||
* @options [Object]
|
||||
* - form: [String] "long", "short" (default), or "narrow".
|
||||
*
|
||||
* - numberFormatter: [Function] a number formatter function. Defaults to Globalize
|
||||
* `.numberFormatter()` for the current locale using the default options.
|
||||
*/
|
||||
Globalize.unitFormatter =
|
||||
Globalize.prototype.unitFormatter = function( unit, options ) {
|
||||
var args, form, numberFormatter, pluralGenerator, returnFn, properties;
|
||||
|
||||
validateParameterPresence( unit, "unit" );
|
||||
validateParameterTypeString( unit, "unit" );
|
||||
|
||||
validateParameterTypePlainObject( options, "options" );
|
||||
|
||||
options = options || {};
|
||||
|
||||
args = [ unit, options ];
|
||||
form = options.form || "long";
|
||||
properties = unitProperties( unit, form, this.cldr );
|
||||
|
||||
numberFormatter = options.numberFormatter || this.numberFormatter();
|
||||
pluralGenerator = this.pluralGenerator();
|
||||
returnFn = unitFormatterFn( numberFormatter, pluralGenerator, properties );
|
||||
|
||||
runtimeBind( args, this.cldr, returnFn, [ numberFormatter, pluralGenerator, properties ] );
|
||||
|
||||
return returnFn;
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
27
BeWoPlanerMobil/node_modules/globalize/dist/node-main.js
generated
vendored
Normal file
27
BeWoPlanerMobil/node_modules/globalize/dist/node-main.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* Globalize v1.7.0
|
||||
*
|
||||
* https://github.com/globalizejs/globalize
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-08-02T11:53Z
|
||||
*/
|
||||
|
||||
// Core
|
||||
module.exports = require( "./globalize" );
|
||||
|
||||
// Extent core with the following modules
|
||||
require( "./globalize/message" );
|
||||
require( "./globalize/number" );
|
||||
require( "./globalize/plural" );
|
||||
|
||||
// Load after globalize/number
|
||||
require( "./globalize/currency" );
|
||||
require( "./globalize/date" );
|
||||
|
||||
// Load after globalize/number and globalize/plural
|
||||
require( "./globalize/relative-time" );
|
||||
require( "./globalize/unit" );
|
||||
28
BeWoPlanerMobil/node_modules/globalize/doc/api/core/constructor.md
generated
vendored
Normal file
28
BeWoPlanerMobil/node_modules/globalize/doc/api/core/constructor.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
## [new] Globalize( locale|cldr )
|
||||
|
||||
Create a Globalize instance.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### locale|cldr
|
||||
|
||||
Locale string or [Cldr instance](https://github.com/rxaviers/cldrjs) of the instance.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to creating any Globalize instance, you must load `cldr/supplemental/likelySubtags.json`. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
```javascript
|
||||
var en = new Globalize( "en" );
|
||||
|
||||
// You can optionally omit the `new` operator.
|
||||
var pt = Globalize( "pt" );
|
||||
|
||||
en.formatNumber( 3.1415 );
|
||||
// > 3.142
|
||||
|
||||
pt.formatNumber( 3.1415 );
|
||||
// > 3,142
|
||||
```
|
||||
96
BeWoPlanerMobil/node_modules/globalize/doc/api/core/load.md
generated
vendored
Normal file
96
BeWoPlanerMobil/node_modules/globalize/doc/api/core/load.md
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
## Globalize.load( cldrJSONData, ... )
|
||||
|
||||
This method allows you to load CLDR JSON locale data. `Globalize.load()` is a proxy to `Cldr.load()`.
|
||||
|
||||
This method can be called as many times as needed. All passed JSON objects are deeply merged internally.
|
||||
|
||||
For more information, see https://github.com/rxaviers/cldrjs#readme.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### cldrJSONData
|
||||
|
||||
A JSON object with CLDR data. See [Getting Started](#../../../README.md#2-cldr-content) for more information.
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
Globalize.load({
|
||||
"main": {
|
||||
"en": {
|
||||
"identity": {
|
||||
"version": {
|
||||
"_cldrVersion": "25",
|
||||
"_number": "$Revision: 91 $"
|
||||
},
|
||||
"generation": {
|
||||
"_date": "$Date: 2014-03-13 22:27:12 -0500 (Thu, 13 Mar 2014) $"
|
||||
},
|
||||
"language": "en"
|
||||
},
|
||||
"dates": {
|
||||
"calendars": {
|
||||
"gregorian": {
|
||||
"months": {
|
||||
"format": {
|
||||
"abbreviated": {
|
||||
"1": "Jan",
|
||||
"2": "Feb",
|
||||
"3": "Mar",
|
||||
"4": "Apr",
|
||||
"5": "May",
|
||||
"6": "Jun",
|
||||
"7": "Jul",
|
||||
"8": "Aug",
|
||||
"9": "Sep",
|
||||
"10": "Oct",
|
||||
"11": "Nov",
|
||||
"12": "Dec"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dayPeriods": {
|
||||
"format": {
|
||||
"wide": {
|
||||
"am": "AM",
|
||||
"am-alt-variant": "am",
|
||||
"noon": "noon",
|
||||
"pm": "PM",
|
||||
"pm-alt-variant": "pm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dateFormats": {
|
||||
"medium": "MMM d, y"
|
||||
},
|
||||
"timeFormats": {
|
||||
"medium": "h:mm:ss a",
|
||||
},
|
||||
"dateTimeFormats": {
|
||||
"medium": "{1}, {0}"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"numbers": {
|
||||
"defaultNumberingSystem": "latn",
|
||||
"symbols-numberSystem-latn": {
|
||||
"group": ","
|
||||
},
|
||||
"decimalFormats-numberSystem-latn": {
|
||||
"standard": "#,##0.###"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"supplemental": {
|
||||
"version": {
|
||||
"_cldrVersion": "25",
|
||||
"_number": "$Revision: 91 $"
|
||||
},
|
||||
"likelySubtags": {
|
||||
"en": "en-Latn-US",
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user