prvi
This commit is contained in:
5
EveryThing/wwwroot/vendor/libs/globalize/CONTRIBUTING.md
vendored
Normal file
5
EveryThing/wwwroot/vendor/libs/globalize/CONTRIBUTING.md
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
EveryThing/wwwroot/vendor/libs/globalize/LICENSE
vendored
Normal file
20
EveryThing/wwwroot/vendor/libs/globalize/LICENSE
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
EveryThing/wwwroot/vendor/libs/globalize/README.md
vendored
Normal file
818
EveryThing/wwwroot/vendor/libs/globalize/README.md
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime.js
vendored
Normal file
326
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/currency.js
vendored
Normal file
183
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/currency.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/date.js
vendored
Normal file
1657
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/date.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
120
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/message.js
vendored
Normal file
120
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/message.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/number.js
vendored
Normal file
919
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/number.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/plural.js
vendored
Normal file
90
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/plural.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/relative-time.js
vendored
Normal file
120
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/relative-time.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/unit.js
vendored
Normal file
132
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize-runtime/unit.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize.js
vendored
Normal file
507
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/currency.js
vendored
Normal file
590
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/currency.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/date.js
vendored
Normal file
3139
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/date.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2076
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/message.js
vendored
Normal file
2076
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/message.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1727
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/number.js
vendored
Normal file
1727
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/number.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
376
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/plural.js
vendored
Normal file
376
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/plural.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/relative-time.js
vendored
Normal file
203
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/relative-time.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/unit.js
vendored
Normal file
301
EveryThing/wwwroot/vendor/libs/globalize/dist/globalize/unit.js
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
EveryThing/wwwroot/vendor/libs/globalize/dist/node-main.js
vendored
Normal file
27
EveryThing/wwwroot/vendor/libs/globalize/dist/node-main.js
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
EveryThing/wwwroot/vendor/libs/globalize/doc/api/core/constructor.md
vendored
Normal file
28
EveryThing/wwwroot/vendor/libs/globalize/doc/api/core/constructor.md
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
EveryThing/wwwroot/vendor/libs/globalize/doc/api/core/load.md
vendored
Normal file
96
EveryThing/wwwroot/vendor/libs/globalize/doc/api/core/load.md
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",
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
43
EveryThing/wwwroot/vendor/libs/globalize/doc/api/core/locale.md
vendored
Normal file
43
EveryThing/wwwroot/vendor/libs/globalize/doc/api/core/locale.md
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
## Globalize.locale( [locale|cldr] )
|
||||
|
||||
Set default locale, or get it if locale argument is omitted.
|
||||
|
||||
Return the default [Cldr instance](https://github.com/rxaviers/cldrjs).
|
||||
|
||||
An application that supports globalization and/or localization will need to have a way to determine the user's preference. Attempting to automatically determine the appropriate locale is useful, but it is good practice to always offer the user a choice, by whatever means.
|
||||
|
||||
Whatever your mechanism, it is likely that you will have to correlate the user's preferences with the list of locale data supported in the app. This method allows you to select the best match given the locale data that you have included and to set the Globalize locale to the one which the user prefers.
|
||||
|
||||
LanguageMatching TBD (CLDR's spec http://www.unicode.org/reports/tr35/#LanguageMatching).
|
||||
|
||||
### Parameters
|
||||
|
||||
#### locale|cldr
|
||||
|
||||
- The locale string, e.g., `"en"`, `"pt-BR"`, or `"zh-Hant-TW"`. Or,
|
||||
- The [Cldr instance](https://github.com/rxaviers/cldrjs), e.g., new `Cldr( "en" )`.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using this function, you must load `cldr/supplemental/likelySubtags.json`. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
```javascript
|
||||
// Set "pt" as our default locale.
|
||||
Globalize.locale( "pt" );
|
||||
|
||||
// Get default locale.
|
||||
Globalize.locale();
|
||||
// > {
|
||||
// attributes: {
|
||||
// "languageId": "pt",
|
||||
// "maxLanguageId": "pt_Latn_BR",
|
||||
// "language": "pt",
|
||||
// "script": "Latn",
|
||||
// "territory": "BR",
|
||||
// "region": "BR"
|
||||
// },
|
||||
// some more stuff...
|
||||
// }
|
||||
```
|
||||
196
EveryThing/wwwroot/vendor/libs/globalize/doc/api/currency/currency-formatter.md
vendored
Normal file
196
EveryThing/wwwroot/vendor/libs/globalize/doc/api/currency/currency-formatter.md
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
## .currencyFormatter( currency [, options] ) ➜ function( value )
|
||||
|
||||
Return a function that formats a `currency` according to the given `options` or locale's defaults.
|
||||
|
||||
The returned function is invoked with one argument: the Number `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### currency
|
||||
|
||||
3-letter currency code as defined by ISO 4217, eg. `"USD"`.
|
||||
|
||||
#### options.style
|
||||
|
||||
Optional. String `"symbol"` (default), `"accounting"`, `"code"` or `"name"`. See [`.numberFormatter( [options] )`](../number/number-formatter.md) for more options.
|
||||
|
||||
#### value
|
||||
|
||||
Number to be formatted, eg. `9.99`.
|
||||
|
||||
### Example
|
||||
|
||||
#### Static Formatter
|
||||
|
||||
Prior to using any currency methods, you must load `cldr/main/{locale}/currencies.json`, `cldr/supplemental/currencyData.json`, and the CLDR content required by the number module. If using plural messages, you also must load the CLDR content required by the plural module. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
#### Using the default options
|
||||
|
||||
You can use the static method `Globalize.currencyFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.currencyFormatter( "USD" );
|
||||
|
||||
formatter( 9.99 );
|
||||
// > "$9.99"
|
||||
```
|
||||
|
||||
#### Instance Formatter
|
||||
|
||||
You can use the instance method `.currencyFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var deFormatter = Globalize( "de" ).currencyFormatter( "EUR" ),
|
||||
zhFormatter = Globalize( "zh" ).currencyFormatter( "EUR" );
|
||||
|
||||
deFormatter( 9.99 );
|
||||
// > "9,99 €"
|
||||
|
||||
zhFormatter( 9.99 );
|
||||
// > "€ 9.99"
|
||||
|
||||
```
|
||||
|
||||
For comparison, follow the formatting output of different symbols in different locales.
|
||||
|
||||
| 3-letter currency code | en (English) | de (German) | zh (Chinese) |
|
||||
| ---------------------------------- | ------------ | ----------- | ------------ |
|
||||
| `.currencyFormatter( "USD" )( 1 )` | `$1.00` | `1,00 $` | `US$ 1.00` |
|
||||
| `.currencyFormatter( "EUR" )( 1 )` | `€1.00` | `1,00 €` | `€ 1.00` |
|
||||
| `.currencyFormatter( "CNY" )( 1 )` | `CN¥1.00` | `1,00 CN¥` | `¥ 1.00` |
|
||||
| `.currencyFormatter( "JPY" )( 1 )` | `¥1` | `1 ¥` | `JP¥ 1` |
|
||||
| `.currencyFormatter( "GBP" )( 1 )` | `£1.00` | `1,00 £` | `£ 1.00` |
|
||||
| `.currencyFormatter( "BRL" )( 1 )` | `R$1.00` | `1,00 R$` | `R$ 1.00` |
|
||||
|
||||
#### Using alternative `options.symbolForm`
|
||||
|
||||
Using the narrow symbol form, the same symbols may be used for multiple currencies. Thus the symbol may be ambiguous, and should only be used where the context is clear.
|
||||
|
||||
```js
|
||||
Globalize( "en" ).currencyFormatter( "HKD" )( 1 );
|
||||
// > "HK$1.00"
|
||||
|
||||
Globalize( "en" ).currencyFormatter( "HKD", { symbolForm: "narrow" } )( 1 );
|
||||
// > "$1.00"
|
||||
```
|
||||
|
||||
#### Configuring style
|
||||
|
||||
For the accounting variation of the symbol format, use `style: "accounting"`.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize( "en" ).currencyFormatter( "USD", {
|
||||
style: "accounting"
|
||||
});
|
||||
|
||||
formatter( -1 );
|
||||
// > "($1.00)"
|
||||
```
|
||||
|
||||
For plural messages, use `style: "name"`.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize( "en" ).currencyFormatter( "USD", {
|
||||
style: "name"
|
||||
});
|
||||
|
||||
formatter( 0 );
|
||||
// > "0.00 US dollars"
|
||||
|
||||
formatter( 1 );
|
||||
// > "1.00 US dollar"
|
||||
```
|
||||
|
||||
For comparison, follow the formatting output of different symbols in different locales using the plural messages `Globalize( locale ).currencyFormatter( currency, { style: "name" } )( 1 )`.
|
||||
|
||||
| 3-letter currency code | en (English) | de (German) | zh (Chinese) |
|
||||
| ---------------------- | ----------------------------- | -------------------------------- | ------------ |
|
||||
| `USD` | `1.00 US dollar` | `1,00 US-Dollar` | `1.00美元` |
|
||||
| `EUR` | `1.00 euro` | `1,00 Euro` | `1.00欧元` |
|
||||
| `CNY` | `1.00 Chinese yuan` | `1,00 Chinesischer Yuan` | `1.00人民币` |
|
||||
| `JPY` | `1 Japanese yen` | `1 Japanischer Yen` | `1日元` |
|
||||
| `GBP` | `1.00 British pound sterling` | `1,00 Britisches Pfund Sterling` | `1.00英镑` |
|
||||
| `BRL` | `1.00 Brazilian real` | `1,00 Brasilianischer Real` | `1.00巴西雷亚尔` |
|
||||
|
||||
For the international currency code, use `style: "code"`.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize( "en" ).currencyFormatter( "USD", {
|
||||
style: "code"
|
||||
});
|
||||
|
||||
formatter( 9.99 );
|
||||
// > "9.99 USD"
|
||||
```
|
||||
|
||||
#### Configuring inherited number options
|
||||
|
||||
Override the number of digits, grouping separators, rounding function or any other [`.numberFormatter()` options](../number/number-formatter.md).
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.currencyFormatter( "USD", {
|
||||
minimumFractionDigits: 0,
|
||||
style: "name"
|
||||
});
|
||||
|
||||
formatter( 1 );
|
||||
// > "1 US dollar"
|
||||
|
||||
formatter = Globalize.currencyFormatter( "USD", {
|
||||
round: "ceil"
|
||||
});
|
||||
|
||||
formatter( 1.491 );
|
||||
// > "$1.50"
|
||||
```
|
||||
|
||||
#### Formatting Compact Currencies
|
||||
|
||||
```js
|
||||
var shortFormatter = Globalize( "en" ).currencyFormatter( "USD", {
|
||||
compact: "short"
|
||||
});
|
||||
|
||||
var longFormatter = Globalize( "en" ).currencyFormatter( "USD", {
|
||||
compact: "long"
|
||||
});
|
||||
|
||||
shortFormatter( 12830000000 );
|
||||
// > "$13B"
|
||||
|
||||
longFormatter( 12830000000 );
|
||||
// > "$13 billion"
|
||||
```
|
||||
|
||||
The minimumSignificantDigits and maximumSignificantDigits options are specially useful to control the number of digits to display.
|
||||
|
||||
```js
|
||||
Globalize( "en" ).formatCurrency( 12830000000, "USD", {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 3,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
// > "$12.8B"
|
||||
```
|
||||
|
||||
#### Performance Suggestion
|
||||
|
||||
For improved performance on iterations, first create the formatter. Then, reuse it on each loop.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize( "en" ).currencyFormatter( "USD" );
|
||||
|
||||
renderInvoice({
|
||||
prices: prices.map(function( price ) {
|
||||
return formatter( price );
|
||||
})
|
||||
});
|
||||
```
|
||||
117
EveryThing/wwwroot/vendor/libs/globalize/doc/api/currency/currency-to-parts-formatter.md
vendored
Normal file
117
EveryThing/wwwroot/vendor/libs/globalize/doc/api/currency/currency-to-parts-formatter.md
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
## .currencyToPartsFormatter( currency [, options] ) ➜ function( value )
|
||||
|
||||
Return a function that formats a `currency` into parts tokens according to the given `options` or locale's defaults.
|
||||
|
||||
The returned function is invoked with one argument: the Number `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### currency
|
||||
|
||||
3-letter currency code as defined by ISO 4217, eg. `"USD"`.
|
||||
|
||||
#### options
|
||||
|
||||
Please, see [.currencyFormatter() options](./currency-formatter.md#parameters).
|
||||
|
||||
#### value
|
||||
|
||||
Number to be formatted, eg. `9.99`.
|
||||
|
||||
### Returns
|
||||
|
||||
An Array of objects containing the formatted currency in parts. The returned structure looks like this:
|
||||
|
||||
```js
|
||||
[
|
||||
{ type: "day", value: "17" },
|
||||
{ type: "weekday", value: "Monday" }
|
||||
]
|
||||
```
|
||||
|
||||
Possible types are the following:
|
||||
|
||||
- `currency`
|
||||
|
||||
The currency string, such as the symbols `"$"` and `"€"` or the name `"Dollar"`, `"Euro"` depending on which style is used.
|
||||
|
||||
Please, see [.numberToPartsFormatter()](../number/number-to-parts-formatter.md#returns) for details about the inherited number parts such as `decimal`, `fraction`, `group`, `infinity`, `integer`, `literal`, `minusSign`, `nan`, `plusSign`, `percentSign`, and `compact`.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any currency methods, you must load `cldr/main/{locale}/currencies.json`, `cldr/supplemental/currencyData.json`, and the CLDR content required by the number module. If using plural messages, you also must load the CLDR content required by the plural module. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
#### Static Formatter
|
||||
|
||||
#### Using the default options
|
||||
|
||||
You can use the static method `Globalize.currencyToPartsFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.currencyToPartsFormatter( "USD" );
|
||||
|
||||
formatter( 9.99 );
|
||||
// > [
|
||||
// { "type": "currency", "value": "$" },
|
||||
// { "type": "integer", "value": "9" },
|
||||
// { "type": "decimal", "value": "." },
|
||||
// { "type": "fraction", "value": "99" }
|
||||
// ]
|
||||
```
|
||||
|
||||
#### Instance Formatter
|
||||
|
||||
You can use the instance method `.currencyFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var deFormatter = Globalize( "de" ).currencyToPartsFormatter( "EUR" ),
|
||||
zhFormatter = Globalize( "zh" ).currencyToPartsFormatter( "EUR" );
|
||||
|
||||
deFormatter( 9.99 );
|
||||
// > [
|
||||
// { "type": "integer", "value": "9" },
|
||||
// { "type": "decimal", "value": "," },
|
||||
// { "type": "fraction", "value": "99" },
|
||||
// { "type": "literal", "value": " " },
|
||||
// { "type": "currency", "value": "€" }
|
||||
// ]
|
||||
|
||||
zhFormatter( 9.99 );
|
||||
// > [
|
||||
// { "type": "currency", "value": "€" },
|
||||
// { "type": "integer", "value": "9" },
|
||||
// { "type": "decimal", "value": "." },
|
||||
// { "type": "fraction", "value": "99" }
|
||||
// ]
|
||||
```
|
||||
|
||||
The information is available separately and it can be formatted and concatenated again in a customized way. For example by using [`Array.prototype.map()`][], [arrow functions][], a [switch statement][], [template literals][], and [`Array.prototype.reduce()`][].
|
||||
|
||||
[`Array.prototype.map()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
|
||||
[arrow functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
|
||||
[switch statement]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
|
||||
[template literals]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
|
||||
[`Array.prototype.reduce()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
|
||||
|
||||
#### More Examples
|
||||
|
||||
Please, see [.currencyFormatter() example](./currency-formatter.md#example) for additional examples such as using alternative `symbolForm`, configuring `style` (symbol, accounting, and name styles), and the inherited number options (e.g., compact numbers).
|
||||
|
||||
#### Performance Suggestion
|
||||
|
||||
For improved performance on iterations, first create the formatter. Then, reuse it on each loop.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize( "en" ).currencyToPartsFormatter( "USD" );
|
||||
|
||||
renderInvoice({
|
||||
prices: prices.map(function( price ) {
|
||||
return formatter( price );
|
||||
})
|
||||
});
|
||||
```
|
||||
203
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/date-formatter.md
vendored
Normal file
203
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/date-formatter.md
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
## .dateFormatter( [options] ) ➜ function( value )
|
||||
|
||||
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" }`.
|
||||
|
||||
The returned function is invoked with one argument: the Date instance `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options.skeleton
|
||||
|
||||
String value indicating a skeleton (see description above), eg. `{ skeleton: "GyMMMd" }`.
|
||||
|
||||
Skeleton provides a more flexible formatting mechanism than the predefined list `full`, `long`, `medium`, or `short` represented by date, time, or datetime. Instead, they are an open-ended list of patterns containing only date field information, and in a canonical order. For a complete list of skeleton patterns [check the unicode CLDR documentation](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
|
||||
|
||||
For example:
|
||||
|
||||
| locale | `"GyMMMd"` skeleton |
|
||||
| ------ | ------------------------- |
|
||||
| *en* | `"Apr 9, 2014 AD"` |
|
||||
| *zh* | `"公元2014年4月9日"` |
|
||||
| *es* | `"9 abr. de 2014 d. C."` |
|
||||
| *ar* | `"٩ أبريل، ٢٠١٤ م"` |
|
||||
| *pt* | `"9 de abr de 2014 d.C."` |
|
||||
|
||||
#### options.date
|
||||
|
||||
One of the following String values: `full`, `long`, `medium`, or `short`, eg., `{ date: "full" }`.
|
||||
|
||||
#### options.time
|
||||
|
||||
One of the following String values: `full`, `long`, `medium`, or `short`, eg., `{ time: "full" }`.
|
||||
|
||||
#### options.datetime
|
||||
|
||||
One of the following String values: `full`, `long`, `medium`, or `short`, eg., `{ datetime: "full" }`.
|
||||
|
||||
#### options.raw
|
||||
|
||||
String value indicating a machine [raw pattern (anything in the "Sym." column)](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) eg. `{ raw: "dd/mm" }`. Note this is NOT recommended for i18n in general. Use `skeleton` instead.
|
||||
|
||||
#### options.timeZone
|
||||
|
||||
String based on the time zone names of the [IANA time zone database](https://www.iana.org/time-zones), such as `"Asia/Shanghai"`, `"Asia/Kolkata"`, `"America/New_York"`.
|
||||
|
||||
#### value
|
||||
|
||||
Date instance to be formatted, eg. `new Date()`;
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any date methods, you must load `cldr/main/{locale}/ca-gregorian.json`, `cldr/main/{locale}/timeZoneNames.json`, `cldr/supplemental/metaZones.json`, `cldr/supplemental/timeData.json`, `cldr/supplemental/weekData.json`, and the CLDR content required by the number module. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.dateFormatter();
|
||||
|
||||
formatter( new Date( 2010, 10, 30, 17, 55 ) );
|
||||
// > "11/30/2010"
|
||||
```
|
||||
|
||||
You can use the instance method `.dateFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var enFormatter = Globalize( "en" ).dateFormatter(),
|
||||
deFormatter = Globalize( "de" ).dateFormatter();
|
||||
|
||||
enFormatter( new Date( 2010, 10, 30, 17, 55 ) );
|
||||
// > "11/30/2010"
|
||||
|
||||
deFormatter( new Date( 2010, 10, 30, 17, 55 ) );
|
||||
// > "30.11.2010"
|
||||
```
|
||||
|
||||
#### Using short, medium, long, and full presets
|
||||
|
||||
Use convenient presets for `date`, `time`, or `datetime`. Their possible values are: `short`, `medium`, `long`, and `full`.
|
||||
|
||||
| `presetValue` | `Globalize( "en" ).dateFormatter( presetValue )( new Date( 2010, 10, 1, 17, 55 ) )` |
|
||||
| ------------------------ | ---------------------------------------- |
|
||||
| `{ date: "short" }` | `"11/1/10"` |
|
||||
| `{ date: "medium" }` | `"Nov 1, 2010"` |
|
||||
| `{ date: "long" }` | `"November 1, 2010"` |
|
||||
| `{ date: "full" }` | `"Monday, November 1, 2010"` |
|
||||
| `{ time: "short" }` | `"5:55 PM"` |
|
||||
| `{ time: "medium" }` | `"5:55:00 PM"` |
|
||||
| `{ time: "long" }` | `"5:55:00 PM PST"` |
|
||||
| `{ time: "full" }` | `"5:55:00 PM Pacific Standard Time"` |
|
||||
| `{ datetime: "short" }` | `"11/1/10, 5:55 PM"` |
|
||||
| `{ datetime: "medium" }` | `"Nov 1, 2010, 5:55:00 PM"` |
|
||||
| `{ datetime: "long" }` | `"November 1, 2010 at 5:55:00 PM PST"` |
|
||||
| `{ datetime: "full" }` | `"Monday, November 1, 2010 at 5:55:00 PM Pacific Standard Time"` |
|
||||
|
||||
For comparison, follow the same formatter `{ datetime: "short" }` on different locales.
|
||||
|
||||
| locale | `Globalize( locale ).dateFormatter({ datetime: "short" })( new Date( 2010, 10, 1, 17, 55 ) )` |
|
||||
| ---------------- | ---------------------------------------- |
|
||||
| *en* | `"11/1/10, 5:55 PM"` |
|
||||
| *en_GB* | `"01/11/2010 17:55"` |
|
||||
| *zh* | `"10/11/1 下午5:55"` |
|
||||
| *zh-u-nu-native* | `"一〇/一一/一 下午五:五五"` |
|
||||
| *es* | `"1/11/10 17:55"` |
|
||||
| *de* | `"01.11.10 17:55"` |
|
||||
| *pt* | `"01/11/10 17:55"` |
|
||||
| *ar* | `"١/١١/٢٠١٠ ٥،٥٥ م"` |
|
||||
|
||||
#### Using open-ended skeletons
|
||||
|
||||
Use open-ended skeletons for more flexibility (see its description [above](#parameters)). See some examples below.
|
||||
|
||||
| `skeleton` | `Globalize( "en" ).dateFormatter( skeleton )( new Date( 2010, 10, 1, 17, 55 ) )` |
|
||||
| ---------------------------- | ---------------------------------------- |
|
||||
| `{ skeleton: "E" }` | `"Tue"` |
|
||||
| `{ skeleton: "EHm" }` | `"Tue 17:55"` |
|
||||
| `{ skeleton: "EHms" }` | `"Tue 17:55:00"` |
|
||||
| `{ skeleton: "Ed" }` | `"30 Tue"` |
|
||||
| `{ skeleton: "Ehm" }` | `"Tue 5:55 PM"` |
|
||||
| `{ skeleton: "Ehms" }` | `"Tue 5:55:00 PM"` |
|
||||
| `{ skeleton: "Gy" }` | `"2010 AD"` |
|
||||
| `{ skeleton: "GyMMM" }` | `"Nov 2010 AD"` |
|
||||
| `{ skeleton: "GyMMMEd" }` | `"Tue, Nov 30, 2010 AD"` |
|
||||
| `{ skeleton: "GyMMMd" }` | `"Nov 30, 2010 AD"` |
|
||||
| `{ skeleton: "H" }` | `"17"` |
|
||||
| `{ skeleton: "Hm" }` | `"17:55"` |
|
||||
| `{ skeleton: "Hms" }` | `"17:55:00"` |
|
||||
| `{ skeleton: "M" }` | `"11"` |
|
||||
| `{ skeleton: "MEd" }` | `"Tue, 11/30"` |
|
||||
| `{ skeleton: "MMM" }` | `"Nov"` |
|
||||
| `{ skeleton: "MMMEd" }` | `"Tue, Nov 30"` |
|
||||
| `{ skeleton: "MMMd" }` | `"Nov 30"` |
|
||||
| `{ skeleton: "Md" }` | `"11/30"` |
|
||||
| `{ skeleton: "d" }` | `"30"` |
|
||||
| `{ skeleton: "h" }` | `"5 PM"` |
|
||||
| `{ skeleton: "hm" }` | `"5:55 PM"` |
|
||||
| `{ skeleton: "hms" }` | `"5:55:00 PM"` |
|
||||
| `{ skeleton: "ms" }` | `"55:00"` |
|
||||
| `{ skeleton: "y" }` | `"2010"` |
|
||||
| `{ skeleton: "yM" }` | `"11/2010"` |
|
||||
| `{ skeleton: "yMEd" }` | `"Tue, 11/30/2010"` |
|
||||
| `{ skeleton: "yMMM" }` | `"Nov 2010"` |
|
||||
| `{ skeleton: "yMMMEd" }` | `"Tue, Nov 30, 2010"` |
|
||||
| `{ skeleton: "yMMMd" }` | `"Nov 30, 2010"` |
|
||||
| `{ skeleton: "yMd" }` | `"11/30/2010"` |
|
||||
| `{ skeleton: "yQQQ" }` | `"Q4 2010"` |
|
||||
| `{ skeleton: "yQQQQ" }` | `"4th quarter 2010"` |
|
||||
| `{ skeleton: "GyMMMEdhms" }` | `"Tue, Nov 30, 2010 AD, 5:55:00 PM"` |
|
||||
| `{ skeleton: "Ehms" }` | `"Tue 5:55:00 PM"` |
|
||||
| `{ skeleton: "yQQQHm" }` | `"Q4 2010, 17:55"` |
|
||||
| `{ skeleton: "MMMEdhm" }` | `"Tue, Nov 30, 5:55 PM"` |
|
||||
| `{ skeleton: "yMMMdhm" }` | `"Nov 30, 2010, 5:55 PM"` |
|
||||
|
||||
|
||||
```javascript
|
||||
var globalize = Globalize( "en" ),
|
||||
date = new Date( 2010, 10, 30, 17, 55 ),
|
||||
monthDayFormatter = globalize.dateFormatter({ skeleton: "MMMd" }),
|
||||
hourMinuteSecondFormatter = globalize.dateFormatter({ skeleton: "Hms" });
|
||||
|
||||
monthDayFormatter( date );
|
||||
// > "Nov 30"
|
||||
|
||||
hourMinuteSecondFormatter( date );
|
||||
// > "17:55:00"
|
||||
```
|
||||
|
||||
#### Using time zones
|
||||
|
||||
Using specific timeZones, i.e., using `options.timezone`. Note that prior to using it, you must load IANA time zone data.
|
||||
|
||||
```js
|
||||
Globalize.loadTimeZone( require( "iana-tz-data" ) );
|
||||
```
|
||||
|
||||
```js
|
||||
Globalize.locale( "en" );
|
||||
|
||||
Globalize.dateFormatter({ datetime: "medium", timeZone: "America/Los_Angeles" })( new Date() );
|
||||
// > "Nov 1, 2010, 12:55:00 PM"
|
||||
|
||||
Globalize.dateFormatter({ datetime: "medium", timeZone: "America/Sao_Paulo" })( new Date() )
|
||||
// > "Nov 1, 2010, 5:55:00 PM"
|
||||
|
||||
Globalize.dateFormatter({ datetime: "full", timeZone: "Europe/Berlin" })( new Date() )
|
||||
// > "Monday, November 1, 2010 at 8:55:00 PM Central European Standard Time"
|
||||
```
|
||||
|
||||
#### Note on performance
|
||||
|
||||
For improved performance on iterations, first create the formatter. Then, reuse it on each loop.
|
||||
|
||||
```javascript
|
||||
// In an application, this array could have a few hundred entries
|
||||
var dates = [ new Date( 2010, 10, 30, 17, 55 ), new Date( 2015, 3, 18, 4, 25 ) ];
|
||||
var formatter = Globalize( "en" ).dateFormatter({ time: "short" });
|
||||
|
||||
var formattedDates = dates.map(function( date ) {
|
||||
return formatter( date );
|
||||
});
|
||||
// > Array [ "5:55 PM", "4:25 AM" ]
|
||||
```
|
||||
60
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/date-parser.md
vendored
Normal file
60
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/date-parser.md
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
## .dateParser( [options] ) ➜ function( value )
|
||||
|
||||
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" }`).
|
||||
|
||||
The returned function is invoked with one argument: the String `value` to be parsed.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
See [.dateFormatter() options](./date-formatter.md#parameters).
|
||||
|
||||
#### value
|
||||
|
||||
String with date to be parsed, eg. `"11/1/10, 5:55 PM"`.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any date methods, you must load `cldr/main/{locale}/ca-gregorian.json`, `cldr/main/{locale}/timeZoneNames.json`, `cldr/supplemental/timeData.json`, `cldr/supplemental/weekData.json`, and the CLDR content required by the number module. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.dateParser()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var parser;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
parser = Globalize.dateParser();
|
||||
|
||||
parser( "1/2/2013" );
|
||||
// > Wed Jan 02 2013 00:00:00
|
||||
|
||||
Globalize.locale( "es" );
|
||||
parser = Globalize.dateParser();
|
||||
|
||||
parser( "1/2/2013" );
|
||||
// > Fri Feb 01 2013 00:00:00
|
||||
```
|
||||
|
||||
You can use the instance method `.dateParser()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var esParser = Globalize( "es" ).dateParser({ date: short });
|
||||
|
||||
esParser( "1/2/13" );
|
||||
// > Fri Feb 01 2013 00:00:00
|
||||
```
|
||||
|
||||
For improved performance on iterations, first create the parser. Then, reuse it
|
||||
on each loop.
|
||||
|
||||
```javascript
|
||||
var formattedDates = [ new Date( a ), new Date( b ), ... ];
|
||||
var parser = Globalize( "en" ).dateParser({ time: "short" });
|
||||
|
||||
dates = formattedDates.map(function( formattedDate ) {
|
||||
return parser( formattedDate );
|
||||
});
|
||||
```
|
||||
176
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/date-to-parts-formatter.md
vendored
Normal file
176
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/date-to-parts-formatter.md
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
## .dateToPartsFormatter( [options] ) ➜ function( value )
|
||||
|
||||
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" }`.
|
||||
|
||||
The returned function is invoked with one argument: the Date instance `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
Please, see [.dateFormatter() options](./date-formatter.md#parameters).
|
||||
|
||||
#### value
|
||||
|
||||
Date instance to be formatted, eg. `new Date()`;
|
||||
|
||||
### Returns
|
||||
|
||||
An Array of objects containing the formatted date in parts. The returned structure looks like this:
|
||||
|
||||
```js
|
||||
[
|
||||
{ type: "day", value: "17" },
|
||||
{ type: "weekday", value: "Monday" }
|
||||
]
|
||||
```
|
||||
|
||||
Possible types are the following:
|
||||
|
||||
- `day`
|
||||
|
||||
The string used for the day, e.g., `"17"`, `"١٦"`.
|
||||
|
||||
- `dayperiod`
|
||||
|
||||
The string used for the day period, e.g., `"AM"`, `"PM"`.
|
||||
|
||||
- `era`
|
||||
|
||||
The string used for the era, e.g., `"AD"`, `"d. C."`.
|
||||
|
||||
- `hour`
|
||||
|
||||
The string used for the hour, e.g., `"3"`, `"03"`.
|
||||
|
||||
- `literal`
|
||||
|
||||
The string used for separating date and time values, e.g., `"/"`, `", "`,
|
||||
`"o'clock"`, `" de "`.
|
||||
|
||||
- `minute`
|
||||
|
||||
The string used for the minute, e.g., `"00"`.
|
||||
|
||||
- `month`
|
||||
|
||||
The string used for the month, e.g., `"12"`.
|
||||
|
||||
- `second`
|
||||
|
||||
The string used for the second, e.g., `"07"` or `"42"`.
|
||||
|
||||
- `zone`
|
||||
|
||||
The string used for the name of the time zone, e.g., `"EST".`
|
||||
|
||||
- `weekday`
|
||||
|
||||
The string used for the weekday, e.g., `"M"`, `"Monday"`, `"Montag".`
|
||||
|
||||
- `year`
|
||||
|
||||
The string used for the year, e.g., `"2012"`, `"96".`
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any date methods, you must load `cldr/main/{locale}/ca-gregorian.json`, `cldr/main/{locale}/timeZoneNames.json`, `cldr/supplemental/timeData.json`, `cldr/supplemental/weekData.json`, and the CLDR content required by the number module. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.dateToPartsFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.dateToPartsFormatter();
|
||||
|
||||
formatter( new Date( 2010, 10, 30 ) );
|
||||
// > [
|
||||
// { "type": "month", "value": "11" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "day", "value": "30" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "year", "value": "2010" }
|
||||
// ]
|
||||
```
|
||||
|
||||
You can use the instance method `.dateToPartsFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var enFormatter = Globalize( "en" ).dateToPartsFormatter(),
|
||||
deFormatter = Globalize( "de" ).dateToPartsFormatter();
|
||||
|
||||
enFormatter( new Date( 2010, 10, 30 ) );
|
||||
// > [
|
||||
// { "type": "month", "value": "11" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "day", "value": "30" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "year", "value": "2010" }
|
||||
// ]
|
||||
|
||||
deFormatter( new Date( 2010, 10, 30 ) );
|
||||
// > [
|
||||
// { type: 'day', value: '30' },
|
||||
// { type: 'literal', value: '.' },
|
||||
// { type: 'month', value: '11' },
|
||||
// { type: 'literal', value: '.' },
|
||||
// { type: 'year', value: '2010' }
|
||||
// ]
|
||||
```
|
||||
|
||||
The information is available separately and it can be formatted and concatenated again in a customized way. For example by using [`Array.prototype.map()`][], [arrow functions][], a [switch statement][], [template literals][], and [`Array.prototype.reduce()`][].
|
||||
|
||||
[`Array.prototype.map()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
|
||||
[arrow functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
|
||||
[switch statement]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
|
||||
[template literals]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
|
||||
[`Array.prototype.reduce()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.dateToPartsFormatter({datetime: "short"});
|
||||
|
||||
formatter( new Date( 2010, 10, 30, 17, 55 ) ).map(({type, value}) => {
|
||||
switch ( type ) {
|
||||
case "year": return `<strong>${value}</strong>`;
|
||||
default: return value;
|
||||
}
|
||||
}).join( "" );
|
||||
// > "11/30/<strong>10</strong>, 5:55 PM"
|
||||
```
|
||||
|
||||
Please, see [.dateFormatter() example](./date-formatter.md#example) for additional examples such as using `date`, `time`, `datetime`, and `skeleton` options.
|
||||
|
||||
For improved performance on iterations, first create the formatter. Then, reuse it on each loop.
|
||||
|
||||
```javascript
|
||||
// In an application, this array could have a few hundred entries
|
||||
var dates = [ new Date( 2010, 10, 30, 17, 55 ), new Date( 2015, 3, 18, 4, 25 ) ];
|
||||
var formatter = Globalize( "en" ).dateToPartsFormatter({ time: "short" });
|
||||
|
||||
var formattedDates = dates.map(function( date ) {
|
||||
return formatter( date );
|
||||
});
|
||||
// > [
|
||||
// [
|
||||
// { "type": "hour", "value": "5" },
|
||||
// { "type": "literal", "value": ":" },
|
||||
// { "type": "minute", "value": "55" },
|
||||
// { "type": "literal", "value": " " },
|
||||
// { "type": "dayperiod", "value": "PM" }
|
||||
// ],
|
||||
// [
|
||||
// { "type": "hour", "value": "4" },
|
||||
// { "type": "literal", "value": ":" },
|
||||
// { "type": "minute", "value": "25" },
|
||||
// { "type": "literal", "value": " " },
|
||||
// { "type": "dayperiod", "value": "AM" }
|
||||
// ]
|
||||
// ]
|
||||
```
|
||||
29
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/load-iana-time-zone.md
vendored
Normal file
29
EveryThing/wwwroot/vendor/libs/globalize/doc/api/date/load-iana-time-zone.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
## Globalize.loadTimeZone( ianaTzData )
|
||||
|
||||
This method allows you to load IANA time zone data to enable `options.timeZone` feature on date formatters and parsers.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### ianaTzData
|
||||
|
||||
A JSON object with zdumped IANA timezone data. Get the data via [`iana-tz-data`](https://github.com/rxaviers/iana-tz-data).
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
Globalize.loadTimeZone({
|
||||
"zoneData": {
|
||||
...
|
||||
"America": {
|
||||
...
|
||||
"New_York": {
|
||||
abbrs: [],
|
||||
untils: [],
|
||||
offsets: [],
|
||||
isdsts: []
|
||||
}
|
||||
...
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
105
EveryThing/wwwroot/vendor/libs/globalize/doc/api/message/load-messages.md
vendored
Normal file
105
EveryThing/wwwroot/vendor/libs/globalize/doc/api/message/load-messages.md
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
## .loadMessages( json )
|
||||
|
||||
Load messages data.
|
||||
|
||||
The first level of keys must be locales. For example:
|
||||
|
||||
```
|
||||
{
|
||||
en: {
|
||||
hello: "Hello"
|
||||
},
|
||||
pt: {
|
||||
hello: "Olá"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
ICU MessageFormat pattern is supported: variable replacement, gender and plural inflections. For more information see [`.messageFormatter( path ) ➡ function([ variables ])`](./message-formatter.md).
|
||||
|
||||
The provided messages are stored along side other cldr data, under the "globalize-messages" key. This allows Globalize to reuse the traversal methods provided by cldrjs. You can inspect this data using `cldrjs.get("globalize-messages")`.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### json
|
||||
|
||||
JSON object of messages data. Keys can use any character, except `/`, `{` and `}`. Values (i.e., the message content itself) can contain any character.
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
Globalize.loadMessages({
|
||||
pt: {
|
||||
greetings: {
|
||||
hello: "Olá",
|
||||
bye: "Tchau"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Globalize( "pt" ).formatMessage( "greetings/hello" );
|
||||
// > Olá
|
||||
```
|
||||
|
||||
#### Multiline strings
|
||||
|
||||
Use Arrays as a convenience for multiline strings. The lines will be joined by a space.
|
||||
|
||||
```javascript
|
||||
Globalize.loadMessages({
|
||||
en: {
|
||||
longText: [
|
||||
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eligendi non",
|
||||
"quis exercitationem culpa nesciunt nihil aut nostrum explicabo",
|
||||
"reprehenderit optio amet ab temporibus asperiores quasi cupiditate.",
|
||||
"Voluptatum ducimus voluptates voluptas?"
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
Globalize( "en" ).formatMessage( "longText" );
|
||||
// > "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eligendi non quis exercitationem culpa nesciunt nihil aut nostrum explicabo reprehenderit optio amet ab temporibus asperiores quasi cupiditate. Voluptatum ducimus voluptates voluptas?"
|
||||
```
|
||||
|
||||
#### Messages inheritance
|
||||
|
||||
It's possible to inherit messages, for example:
|
||||
|
||||
```javascript
|
||||
Globalize.loadMessages({
|
||||
root: {
|
||||
amen: "Amen"
|
||||
},
|
||||
de: {},
|
||||
en: {},
|
||||
"en-GB": {},
|
||||
fr: {},
|
||||
pt: {
|
||||
amen: "Amém"
|
||||
},
|
||||
"pt-PT": {}
|
||||
});
|
||||
|
||||
Globalize( "de" ).formatMessage( "amen" );
|
||||
// > "Amen"
|
||||
|
||||
Globalize( "en" ).formatMessage( "amen" );
|
||||
// > "Amen"
|
||||
|
||||
Globalize( "en-GB" ).formatMessage( "amen" );
|
||||
// > "Amen"
|
||||
|
||||
Globalize( "fr" ).formatMessage( "amen" );
|
||||
// > "Amen"
|
||||
|
||||
Globalize( "pt-PT" ).formatMessage( "amen" );
|
||||
// > "Amém"
|
||||
```
|
||||
|
||||
Note that `de`, `en`, `en-GB`, `fr`, and `pt-PT` are empty. `.formatMessage()` inherits `pt-PT` messages from `pt` (`pt-PT` ➡ `pt`), and it inherits the other messages from root, eg. `en-GB` ➡ `en-001` ➡ `en` ➡ `root`. Yes, `root` is the last bundle of the parent lookup.
|
||||
|
||||
Attention: On browsers, message inheritance only works if the optional dependency `cldr/unresolved` is loaded.
|
||||
|
||||
```html
|
||||
<script src="cldr/unresolved.js"></script>
|
||||
```
|
||||
208
EveryThing/wwwroot/vendor/libs/globalize/doc/api/message/message-formatter.md
vendored
Normal file
208
EveryThing/wwwroot/vendor/libs/globalize/doc/api/message/message-formatter.md
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
## .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.
|
||||
|
||||
Use [`Globalize.loadMessages( json )`](./load-messages.md) to load
|
||||
messages data.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### path
|
||||
|
||||
String or Array containing the path of the message content, eg., `"greetings/bye"`, or `[ "greetings", "bye" ]`.
|
||||
|
||||
#### variables
|
||||
|
||||
Optional. Variables can be Objects, where each property can be referenced by name inside a message; or Arrays, where each entry of the Array can be used inside a message, using numeric indices. When passing one or more arguments of other types, they're converted to an Array and used as such.
|
||||
|
||||
### Example
|
||||
|
||||
You can use the static method `Globalize.messageFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.loadMessages({
|
||||
pt: {
|
||||
greetings: {
|
||||
bye: "Tchau"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Globalize.locale( "pt" );
|
||||
formatter = Globalize.messageFormatter( "greetings/bye" );
|
||||
|
||||
formatter();
|
||||
// > "Tchau"
|
||||
```
|
||||
|
||||
You can use the instance method `.messageFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var pt = new Globalize( "pt" ),
|
||||
formatter = pt.messageFormatter( "greetings/bye" );
|
||||
|
||||
formatter();
|
||||
// > "Tchau"
|
||||
```
|
||||
|
||||
#### Simple Variable Replacement
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.loadMessages({
|
||||
en: {
|
||||
hello: "Hello, {0} {1} {2}",
|
||||
hey: "Hey, {first} {middle} {last}"
|
||||
}
|
||||
});
|
||||
|
||||
formatter = Globalize( "en" ).messageFormatter( "hello" );
|
||||
|
||||
// Numbered variables using Array.
|
||||
formatter([ "Wolfgang", "Amadeus", "Mozart" ]);
|
||||
// > "Hello, Wolfgang Amadeus Mozart"
|
||||
|
||||
// Numbered variables using function arguments.
|
||||
formatter( "Wolfgang", "Amadeus", "Mozart" );
|
||||
// > "Hello, Wolfgang Amadeus Mozart"
|
||||
|
||||
// Named variables using Object key-value pairs.
|
||||
formatter = Globalize( "en" ).messageFormatter( "hey" );
|
||||
formatter({
|
||||
first: "Wolfgang",
|
||||
middle: "Amadeus",
|
||||
last: "Mozart"
|
||||
});
|
||||
// > "Hey, Wolfgang Amadeus Mozart"
|
||||
```
|
||||
|
||||
#### Gender inflections
|
||||
|
||||
`select` can be used to format any message variations that works like a switch.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
// Note you can define multiple lines message using an Array of Strings.
|
||||
Globalize.loadMessages({
|
||||
en: {
|
||||
party: [
|
||||
"{hostGender, select,",
|
||||
" female {{host} invites {guest} to her party}",
|
||||
" male {{host} invites {guest} to his party}",
|
||||
" other {{host} invites {guest} to their party}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
formatter = Globalize( "en" ).messageFormatter( "party" );
|
||||
|
||||
formatter({
|
||||
guest: "Mozart",
|
||||
host: "Beethoven",
|
||||
hostGender: "male"
|
||||
});
|
||||
// > "Beethoven invites Mozart to his party"
|
||||
```
|
||||
|
||||
#### Plural inflections
|
||||
|
||||
It uses the plural forms `zero`, `one`, `two`, `few`, `many`, or `other` (required). Note English only uses `one` and `other`. So, including `zero` will never get called, even when the number is 0. For more information see [`.pluralGenerator()`](../plural/plural-generator.md).
|
||||
|
||||
```javascript
|
||||
var numberFormatter, taskFormatter,
|
||||
en = new Globalize( "en" );
|
||||
|
||||
// Note you can define multiple lines message using an Array of Strings.
|
||||
Globalize.loadMessages({
|
||||
en: {
|
||||
task: [
|
||||
"You have {count, plural,",
|
||||
" one {one task}",
|
||||
" other {{formattedCount} tasks}",
|
||||
"} remaining"
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
numberFormatter = en.numberFormatter();
|
||||
taskFormatter = en.messageFormatter( "task" );
|
||||
|
||||
taskFormatter({
|
||||
count: 1000,
|
||||
formattedCount: numberFormatter( 1000 )
|
||||
});
|
||||
// > "You have 1,000 tasks remaining"
|
||||
```
|
||||
|
||||
Literal numeric keys can be used in `plural` to match single, specific numbers.
|
||||
|
||||
```javascript
|
||||
var taskFormatter,
|
||||
en = new Globalize( "en" );
|
||||
|
||||
// Note you can define multiple lines message using an Array of Strings.
|
||||
Globalize.loadMessages({
|
||||
en: {
|
||||
task: [
|
||||
"You have {count, plural,",
|
||||
" =0 {no tasks}",
|
||||
" one {one task}",
|
||||
" other {{formattedCount} tasks}",
|
||||
"} remaining"
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
taskFormatter = Globalize( "en" ).messageFormatter( "task" );
|
||||
|
||||
taskFormatter({
|
||||
count: 0,
|
||||
formattedCount: en.numberFormatter( 0 )
|
||||
});
|
||||
// > "You have no tasks remaining"
|
||||
```
|
||||
|
||||
You may find useful having the plural forms calculated with an offset applied.
|
||||
Use `#` to output the resulting number. Note literal numeric keys do NOT use the
|
||||
offset value.
|
||||
|
||||
```javascript
|
||||
var likeFormatter,
|
||||
en = new Globalize( "en" );
|
||||
|
||||
Globalize.loadMessages({
|
||||
en: {
|
||||
likeIncludingMe: [
|
||||
"{0, plural, offset:1",
|
||||
" =0 {Be the first to like this}",
|
||||
" =1 {You liked this}",
|
||||
" one {You and someone else liked this}",
|
||||
" other {You and # others liked this}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
likeFormatter = Globalize( "en" ).messageFormatter( "likeIncludingMe" );
|
||||
|
||||
likeFormatter( 0 );
|
||||
// > "Be the first to like this"
|
||||
|
||||
likeFormatter( 1 );
|
||||
// > "You liked this"
|
||||
|
||||
likeFormatter( 2 );
|
||||
// > "You and someone else liked this"
|
||||
|
||||
likeFormatter( 3 );
|
||||
// > "You and 2 others liked this"
|
||||
```
|
||||
|
||||
Read on [SlexAxton/messageFormatter.js][] for more information on regard of ICU MessageFormat.
|
||||
|
||||
[SlexAxton/messageFormatter.js]: https://github.com/SlexAxton/messageformat.js/#no-frills
|
||||
202
EveryThing/wwwroot/vendor/libs/globalize/doc/api/number/number-formatter.md
vendored
Normal file
202
EveryThing/wwwroot/vendor/libs/globalize/doc/api/number/number-formatter.md
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
## .numberFormatter( [options] ) ➜ function( value )
|
||||
|
||||
Return a function that formats a number according to the given options.
|
||||
|
||||
The returned function is invoked with one argument: the Number `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options.style
|
||||
|
||||
Optional. String `decimal` (default), or `percent`.
|
||||
|
||||
#### options.minimumIntegerDigits
|
||||
|
||||
Optional. Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary.
|
||||
|
||||
#### options.minimumFractionDigits, options.maximumFractionDigits
|
||||
|
||||
Optional. Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. Numbers will be rounded or padded with trailing zeroes if necessary. Either one or both of these properties must be present. If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns.
|
||||
|
||||
#### options.minimumSignificantDigits, options.maximumSignificantDigits
|
||||
|
||||
Optional. Positive integer Number values indicating the minimum and maximum fraction digits to be shown. Either none or both of these properties are present. If they are, they override minimum and maximum integer and fraction digits. The formatter uses however many integer and fraction digits are required to display the specified number of significant digits.
|
||||
|
||||
#### options.round
|
||||
|
||||
Optional. String with rounding method `ceil`, `floor`, `round` (default), or `truncate`.
|
||||
|
||||
#### options.useGrouping
|
||||
|
||||
Optional. Boolean (default is true) value indicating whether a grouping separator should be used.
|
||||
|
||||
#### options.compact
|
||||
|
||||
Optional. String `short` or `long` indicating which compact number format should be used to represent the number.
|
||||
|
||||
### Examples
|
||||
|
||||
#### Static Formatter
|
||||
|
||||
Prior to using any number methods, you must load `cldr/main/{locale}/numbers.json` and `cldr/supplemental/numberingSystems.json`. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.numberFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.numberFormatter();
|
||||
|
||||
formatter( 3.141592 );
|
||||
// > "3.142"
|
||||
```
|
||||
|
||||
#### Instance Formatter
|
||||
|
||||
You can use the instance method `.numberFormatter()`, which uses the instance
|
||||
locale.
|
||||
|
||||
```javascript
|
||||
var arFormatter = Globalize( "ar" ).numberFormatter(),
|
||||
esFormatter = Globalize( "es" ).numberFormatter(),
|
||||
zhFormatter = Globalize( "zh-u-nu-native" ).numberFormatter();
|
||||
|
||||
arFormatter( 3.141592 );
|
||||
// > "٣٫١٤٢"
|
||||
|
||||
esFormatter( 3.141592 );
|
||||
// > "3,142"
|
||||
|
||||
zhFormatter( 3.141592 );
|
||||
// > "三.一四二"
|
||||
```
|
||||
|
||||
#### Configuring decimal places
|
||||
|
||||
The number of decimal places can be decreased or increased using `minimumFractionDigits` and `maximumFractionDigits`.
|
||||
|
||||
```javascript
|
||||
Globalize.numberFormatter({ maximumFractionDigits: 2 })( 3.141592 );
|
||||
// > "3.14"
|
||||
|
||||
Globalize.numberFormatter({ minimumFractionDigits: 2 })( 1.5 );
|
||||
// > "1.50"
|
||||
```
|
||||
|
||||
#### Configuring significant digits
|
||||
|
||||
The number of significant (non-zero) digits can be decreased or increased using `minimumSignificantDigits` and `maximumSignificantDigits`.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize.numberFormatter({
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
formatter( 3.141592 );
|
||||
// > "3.14"
|
||||
|
||||
formatter = Globalize.numberFormatter({
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
formatter( 12345 );
|
||||
// > "12,300"
|
||||
|
||||
formatter = Globalize.numberFormatter({
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
formatter( 0.00012345 );
|
||||
// > "0.000123"
|
||||
```
|
||||
|
||||
#### Formatting Percentages
|
||||
|
||||
Numbers can be formatted as percentages.
|
||||
|
||||
```javascript
|
||||
var enFormatter = Globalize( "en" ).numberFormatter({
|
||||
style: "percent",
|
||||
minimumFractionDigits: 1,
|
||||
maximumFractionDigits: 1
|
||||
});
|
||||
|
||||
var frFormatter = Globalize( "fr" ).numberFormatter({
|
||||
style: "percent",
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
|
||||
enFormatter( 0.0016 );
|
||||
// > "0.2%"
|
||||
|
||||
enFormatter( 0.0014 );
|
||||
// > "0.1%"
|
||||
|
||||
frFormatter( 0.0005 );
|
||||
// > "0,05 %"
|
||||
```
|
||||
|
||||
#### Formatting Compact Numbers
|
||||
|
||||
Long numbers can be represented in a compact format, with `short` using abbreviated units and `long` using the full unit name.
|
||||
|
||||
```javascript
|
||||
var shortFormatter = Globalize( "en" ).numberFormatter({
|
||||
compact: "short"
|
||||
});
|
||||
|
||||
var longFormatter = Globalize( "en" ).numberFormatter({
|
||||
compact: "long"
|
||||
});
|
||||
|
||||
shortFormatter( 27588910 );
|
||||
// > "28M"
|
||||
|
||||
longFormatter( 27588910 );
|
||||
// > "28 million"
|
||||
```
|
||||
|
||||
The minimumSignificantDigits and maximumSignificantDigits options are specially useful to control the number of digits to display.
|
||||
|
||||
```js
|
||||
Globalize( "en" ).formatNumber( 27588910, {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 3,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
// > "27.6M"
|
||||
```
|
||||
|
||||
#### Configuring Rounding
|
||||
|
||||
Numbers with a decreased amount of decimal places can be rounded up, rounded down, rounded arithmetically, or truncated by setting the `round` option to `ceil`, `floor`, `round` (default), or `truncate`.
|
||||
|
||||
```javascript
|
||||
var formatter = Globalize.numberFormatter({
|
||||
maximumFractionDigits: 2,
|
||||
round: "ceil"
|
||||
});
|
||||
|
||||
formatter( 3.141592 );
|
||||
// > "3.15"
|
||||
```
|
||||
|
||||
#### Performance Suggestions
|
||||
|
||||
For improved performance on iterations, the formatter should be created before the loop. Then, it can be reused in each iteration.
|
||||
|
||||
```javascript
|
||||
var numbers = [ 1, 1, 2, 3, ... ];
|
||||
var formatter = Globalize( "en" ).numberFormatter();
|
||||
|
||||
formattedNumbers = numbers.map(function( number ) {
|
||||
return formatter( number );
|
||||
});
|
||||
```
|
||||
130
EveryThing/wwwroot/vendor/libs/globalize/doc/api/number/number-parser.md
vendored
Normal file
130
EveryThing/wwwroot/vendor/libs/globalize/doc/api/number/number-parser.md
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
## .numberParser( [options] ) ➜ function( value )
|
||||
|
||||
Return a function that parses a String representing a number according to the given options. If value is invalid, `NaN` is returned.
|
||||
|
||||
The returned function is invoked with one argument: the String representing a number `value` to be parsed.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
See [.numberFormatter() options](./number-formatter.md#parameters).
|
||||
|
||||
#### value
|
||||
|
||||
String with number to be parsed, eg. `"3.14"`.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any number methods, you must load `cldr/main/{locale}/numbers.json` and `cldr/supplemental/numberingSystems.json`. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.numberParser()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var parser;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
parser = Globalize.numberParser();
|
||||
|
||||
parser( "3.14" );
|
||||
// > 3.14
|
||||
```
|
||||
|
||||
You can use the instance method `.numberParser()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var enParser = Globalize( "en" ).numberParser(),
|
||||
esParser = Globalize( "es" ).numberParser();
|
||||
|
||||
enParser( "3.14" );
|
||||
// > 3.14
|
||||
|
||||
esParser( "3,14" );
|
||||
// > 3.14
|
||||
```
|
||||
|
||||
Some more examples.
|
||||
|
||||
```javascript
|
||||
var enParser = Globalize( "en" ).numberParser();
|
||||
|
||||
enParser( "12,735" );
|
||||
// > 12735
|
||||
|
||||
enParser( "12,735.00" );
|
||||
// > 12735
|
||||
|
||||
Globalize( "en" ).numberParser({ style: "percent" })( "100%" );
|
||||
// > 1
|
||||
|
||||
enParser( "∞" );
|
||||
// > Infinity
|
||||
|
||||
enParser( "-3" );
|
||||
// > -3
|
||||
|
||||
enParser( "-∞" );
|
||||
// > -Infinity
|
||||
|
||||
enParser( "invalid-stuff" );
|
||||
// > NaN
|
||||
|
||||
enParser( "invalid-stuff-that-includes-number-123" );
|
||||
// > NaN
|
||||
|
||||
enParser( "invalid-stuff-123-that-includes-number" );
|
||||
// > NaN
|
||||
|
||||
enParser( "123-invalid-stuff-that-includes-number" );
|
||||
// > NaN
|
||||
|
||||
// Invalid decimal separator. (note `.` is used as decimal separator for English)
|
||||
enParser( "3,14" );
|
||||
// > NaN
|
||||
|
||||
// Invalid grouping separator position.
|
||||
enParser( "127,35.00" );
|
||||
// > NaN
|
||||
```
|
||||
|
||||
Loose matching examples.
|
||||
|
||||
```js
|
||||
var svParser = Globalize( "sv" ).numberParser();
|
||||
|
||||
// Swedish uses NO-BREAK-SPACE U+00A0 as grouping separator.
|
||||
svParser( "1\xA0000,50" );
|
||||
// > 1000.5
|
||||
|
||||
// The parser is lenient and accepts various space characters like regular space
|
||||
// SPACE U+0020. Technically, it accepts any character of the Unicode general
|
||||
// category [:Zs:].
|
||||
svParser( "1 000,50" );
|
||||
// > 1000.5
|
||||
|
||||
var fiParser = Globalize( "fi" ).numberParser();
|
||||
|
||||
// Finish uses MINUS SIGN U+2212 for the minus sign.
|
||||
fiParser( "\u22123" );
|
||||
// > -3
|
||||
|
||||
// The parser is lenient and accepts various hyphen characters like regular
|
||||
// HYPHEN-MINUS U+002D. Technically, it accepts any character of the Unicode
|
||||
// general category [:Dash:].
|
||||
fiParser( "-3" );
|
||||
// > -3
|
||||
```
|
||||
|
||||
For improved performance on iterations, first create the parser. Then, reuse it
|
||||
on each loop.
|
||||
|
||||
```javascript
|
||||
var formattedNumbers = [ "1", "1", "2", "3", ... ];
|
||||
var parser = Globalize( "en" ).numberParser();
|
||||
|
||||
numbers = formattedNumbers.map(function( formattedNumber ) {
|
||||
return parser( formattedNumber );
|
||||
});
|
||||
```
|
||||
140
EveryThing/wwwroot/vendor/libs/globalize/doc/api/number/number-to-parts-formatter.md
vendored
Normal file
140
EveryThing/wwwroot/vendor/libs/globalize/doc/api/number/number-to-parts-formatter.md
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
## .numberToPartsFormatter( [options] ) ➜ function( value )
|
||||
|
||||
Return a function that formats a number into parts tokens according to the given options.
|
||||
|
||||
The returned function is invoked with one argument: the Number `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
Please, see [.numberFormatter() options](./number-formatter.md#parameters).
|
||||
|
||||
### Returns
|
||||
|
||||
An Array of objects containing the formatted number in parts. The returned structure looks like this:
|
||||
|
||||
- `decimal`
|
||||
|
||||
The decimal separator string, e.g., `"."`.
|
||||
|
||||
- `fraction`
|
||||
|
||||
The fraction number.
|
||||
|
||||
- `group`
|
||||
|
||||
The group separator string, e.g., `","`.
|
||||
|
||||
- `infinity`
|
||||
|
||||
The Infinity string, e.g., `"∞"`.
|
||||
|
||||
- `integer`
|
||||
|
||||
The integer number.
|
||||
|
||||
- `literal`
|
||||
|
||||
Any literal strings or whitespace in the formatted number.
|
||||
|
||||
- `minusSign`
|
||||
|
||||
The minus sign string, e.g., `"-"`.
|
||||
|
||||
- `nan`
|
||||
|
||||
The NaN string, e.g., `"NaN"`.
|
||||
|
||||
- `plusSign`
|
||||
|
||||
The plus sign string, e.g., `"+"`.
|
||||
|
||||
- `percentSign`
|
||||
|
||||
The percent sign string, e.g., `"%"`.
|
||||
|
||||
- `compact`
|
||||
|
||||
The compact string, e.g., `"thousand"`.
|
||||
|
||||
### Examples
|
||||
|
||||
Prior to using any number methods, you must load `cldr/main/{locale}/numbers.json` and `cldr/supplemental/numberingSystems.json`. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
#### Static Formatter
|
||||
|
||||
You can use the static method `Globalize.numberToPartsFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.numberToPartsFormatter();
|
||||
|
||||
formatter( 3.141592 );
|
||||
// > [
|
||||
// { "type": "integer", "value": "3" },
|
||||
// { "type": "decimal", "value": "." },
|
||||
// { "type": "fraction", "value": "142" }
|
||||
// ]
|
||||
```
|
||||
|
||||
#### Instance Formatter
|
||||
|
||||
You can use the instance method `.numberFormatter()`, which uses the instance
|
||||
locale.
|
||||
|
||||
```javascript
|
||||
var arFormatter = Globalize( "ar" ).numberToPartsFormatter(),
|
||||
esFormatter = Globalize( "es" ).numberToPartsFormatter(),
|
||||
zhFormatter = Globalize( "zh-u-nu-native" ).numberToPartsFormatter();
|
||||
|
||||
arFormatter( 3.141592 );
|
||||
// > [
|
||||
// { "type": "integer", "value": "٣" },
|
||||
// { "type": "decimal", "value": "٫" },
|
||||
// { "type": "fraction", "value": "١٤٢" }
|
||||
// ]
|
||||
|
||||
esFormatter( 3.141592 );
|
||||
// > [
|
||||
// { "type": "integer", "value": "3" },
|
||||
// { "type": "decimal", "value": "," },
|
||||
// { "type": "fraction", "value": "142" }
|
||||
// ]
|
||||
|
||||
zhFormatter( 3.141592 );
|
||||
// > [
|
||||
// { "type": "integer", "value": "三" },
|
||||
// { "type": "decimal", "value": "." },
|
||||
// { "type": "fraction", "value": "一四二" }
|
||||
// ]
|
||||
```
|
||||
|
||||
The information is available separately and it can be formatted and concatenated again in a customized way. For example by using [`Array.prototype.map()`][], [arrow functions][], a [switch statement][], [template literals][], and [`Array.prototype.reduce()`][].
|
||||
|
||||
[`Array.prototype.map()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
|
||||
[arrow functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
|
||||
[switch statement]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
|
||||
[template literals]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
|
||||
[`Array.prototype.reduce()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
|
||||
|
||||
#### More Examples
|
||||
|
||||
Please, see [.numberFormatter() example](./number-formatter.md#example) for additional examples such as configuring decimal places, significant digits, percentages, and compact numbers.
|
||||
|
||||
#### Performance Suggestions
|
||||
|
||||
For improved performance on iterations, the formatter should be created before the loop. Then, it can be reused in each iteration.
|
||||
|
||||
```javascript
|
||||
var numbers = [ 1, 1, 2, 3, ... ];
|
||||
var formatter = Globalize( "en" ).numberFormatter();
|
||||
|
||||
formattedNumbers = numbers.map(function( number ) {
|
||||
return formatter( number );
|
||||
});
|
||||
```
|
||||
84
EveryThing/wwwroot/vendor/libs/globalize/doc/api/plural/plural-generator.md
vendored
Normal file
84
EveryThing/wwwroot/vendor/libs/globalize/doc/api/plural/plural-generator.md
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
## .pluralGenerator( [options] ) ➜ function( value )
|
||||
|
||||
It supports the creation of internationalized messages with plural inflection by returning a function that returns the value's plural group: `zero`, `one`, `two`, `few`, `many`, or `other`.
|
||||
|
||||
The returned function is invoked with one argument: the Number `value` for which to return the plural group.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options.type
|
||||
|
||||
Optional. String `cardinal` (default), or `ordinal`.
|
||||
|
||||
#### value
|
||||
|
||||
A Number for which to return the plural group.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any plural method, you must load either `supplemental/plurals.json` for cardinals or `supplemental/ordinals.json` for ordinals.
|
||||
|
||||
Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.pluralGenerator()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var plural;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
|
||||
// Cardinals
|
||||
plural = Globalize.pluralGenerator();
|
||||
|
||||
plural( 0 );
|
||||
// > "other"
|
||||
|
||||
plural( 1 );
|
||||
// > "one"
|
||||
|
||||
plural( 2 );
|
||||
// > "other"
|
||||
|
||||
// Ordinals
|
||||
plural = Globalize.pluralGenerator({ type: "ordinal" });
|
||||
|
||||
plural( 0 );
|
||||
// > "other"
|
||||
|
||||
plural( 1 );
|
||||
// > "one"
|
||||
|
||||
plural( 2 );
|
||||
// > "two"
|
||||
```
|
||||
|
||||
You can use the instance method `.pluralGenerator()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var plural = Globalize( "zh" ).pluralGenerator();
|
||||
|
||||
plural( 1 );
|
||||
// > "other"
|
||||
```
|
||||
|
||||
For comparison (cardinals):
|
||||
|
||||
| | en (English) | ru (Russian) | ar (Arabic) |
|
||||
| ------------- | ------------ | ------------ | ----------- |
|
||||
| `plural( 0 )` | `other` | `many` | `zero` |
|
||||
| `plural( 1 )` | `one` | `one` | `one` |
|
||||
| `plural( 2 )` | `other` | `few` | `two` |
|
||||
| `plural( 3 )` | `other` | `few` | `few` |
|
||||
| `plural( 5 )` | `other` | `many` | `few` |
|
||||
|
||||
For comparison (ordinals):
|
||||
|
||||
| | en (English) | ru (Russian) | ar (Arabic) |
|
||||
| ---------------------------------- | ------------ | ------------ | ----------- |
|
||||
| `plural( 0, { type: "ordinal" } )` | `other` | `other` | `other` |
|
||||
| `plural( 1, { type: "ordinal" } )` | `one` | `other` | `other` |
|
||||
| `plural( 2, { type: "ordinal" } )` | `two` | `other` | `other` |
|
||||
| `plural( 3, { type: "ordinal" } )` | `few` | `other` | `other` |
|
||||
| `plural( 5, { type: "ordinal" } )` | `other` | `other` | `other` |
|
||||
60
EveryThing/wwwroot/vendor/libs/globalize/doc/api/relative-time/relative-time-formatter.md
vendored
Normal file
60
EveryThing/wwwroot/vendor/libs/globalize/doc/api/relative-time/relative-time-formatter.md
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
## .relativeTimeFormatter( unit [, options] ) ➜ function( value )
|
||||
|
||||
Returns a function that formats a relative time according to the given unit, options, and the default/instance locale.
|
||||
|
||||
The returned function is invoked with one argument: the number `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### unit
|
||||
|
||||
String value indicating the unit to be formatted. eg. "day", "week", "month", etc.
|
||||
|
||||
#### options.form
|
||||
|
||||
String, e.g., `"short"` or `"narrow"`, or falsy for default long form.
|
||||
|
||||
#### value
|
||||
|
||||
The number to be formatted.
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any relative time methods, you must load `cldr/main/{locale}/dateFields.json` and the CLDR content required by the number and plural modules. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.relativeTimeFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.relativeTimeFormatter( "month" );
|
||||
|
||||
formatter( 1 );
|
||||
// > "next month"
|
||||
|
||||
formatter( 3 );
|
||||
// > "in 3 months"
|
||||
|
||||
formatter( -1 );
|
||||
// > "last month"
|
||||
|
||||
formatter( -3 );
|
||||
// > "3 months ago"
|
||||
```
|
||||
|
||||
You can use the instance method `.relativeTimeFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var globalize = new Globalize( "en" ),
|
||||
formatter = globalize.relativeTimeFormatter( "week" );
|
||||
|
||||
formatter( 1 );
|
||||
// > "next week"
|
||||
```
|
||||
|
||||
|
||||
|
||||
72
EveryThing/wwwroot/vendor/libs/globalize/doc/api/unit/unit-formatter.md
vendored
Normal file
72
EveryThing/wwwroot/vendor/libs/globalize/doc/api/unit/unit-formatter.md
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
## .unitFormatter( unit [, options] ) ➜ function( value )
|
||||
|
||||
Returns a function that formats a unit according to the given unit, options, and the default/instance locale.
|
||||
|
||||
The returned function is invoked with one argument: the number `value` to be formatted.
|
||||
|
||||
### Parameters
|
||||
|
||||
#### unit
|
||||
|
||||
String value indicating the unit to be formatted. eg. "day", "week", "month", etc. Could also be a compound unit, eg. "mile-per-hour" or "mile/hour"
|
||||
|
||||
#### options.form
|
||||
|
||||
Optional. String, e.g., `"long"` (default), `"short"` or `"narrow"`.
|
||||
|
||||
#### options.numberFormatter
|
||||
|
||||
Optional. A number formatter function. Defaults to `Globalize.numberFormatter()` for the current locale using the default options.
|
||||
|
||||
#### value
|
||||
|
||||
The number to be formatted.
|
||||
|
||||
### Example
|
||||
|
||||
Prior to using any unit methods, you must load `cldr/main/{locale}/units.json` and the CLDR content required by the plural module. Read [CLDR content][] if you need more information.
|
||||
|
||||
[CLDR content]: ../../../README.md#2-cldr-content
|
||||
|
||||
You can use the static method `Globalize.unitFormatter()`, which uses the default locale.
|
||||
|
||||
```javascript
|
||||
var customNumberFormatter, formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.unitFormatter( "month", { form: "long" } );
|
||||
|
||||
formatter( 1 );
|
||||
// > "1 month"
|
||||
|
||||
formatter( 3 );
|
||||
// > "3 months"
|
||||
|
||||
formatter( 3000 );
|
||||
// > "3,000 months"
|
||||
```
|
||||
|
||||
You can pass a custom number formatter to format the number of units.
|
||||
|
||||
```javascript
|
||||
var customNumberFormatter, formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
customNumberFormatter = Globalize.numberFormatter({ useGrouping = false })
|
||||
formatter = Globalize.unitFormatter( "mile-per-hour", {
|
||||
form: "narrow", numberFormatter: customNumberFormatter
|
||||
} );
|
||||
|
||||
formatter(5000)
|
||||
// > "5000mph"
|
||||
```
|
||||
|
||||
You can use the instance method `.unitFormatter()`, which uses the instance locale.
|
||||
|
||||
```javascript
|
||||
var globalize = new Globalize( "en" ),
|
||||
formatter = globalize.unitFormatter( "mile-per-hour", { form: "narrow" } );
|
||||
|
||||
formatter( 10 );
|
||||
// > "10mph"
|
||||
```
|
||||
177
EveryThing/wwwroot/vendor/libs/globalize/doc/blog-post/2017-07-xx-1.3.0-announcement.md
vendored
Normal file
177
EveryThing/wwwroot/vendor/libs/globalize/doc/blog-post/2017-07-xx-1.3.0-announcement.md
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
# Globalize 1.3.0 announcement
|
||||
|
||||
On July 3rd, we released Globalize 1.3.0. It is a special release, because it includes some very useful feature enhancements to support advanced date, time, timezone manipulation, and other long due fixes. We wanted to share more details on these improvements.
|
||||
|
||||
## IANA/Olson Time Zone Support
|
||||
|
||||
> This change was contributed by Kandaswamy Manikandan @rajavelmani (PayPal) and Rafael Xavier @rxaviers in #687 and #701.
|
||||
|
||||
In previous versions, Globalize had some partial time zone support for a user's runtime time zone. However specific CLDR patterns (`z`, `v`, and `V`) that display strings such as `PDT`, `Pacific Daylight Time`, `Pacific Time`, and `Los Angeles Time` could not be displayed. The challenge [we had](https://github.com/globalizejs/globalize/pull/202) to determine how costly a solution would be to provide full IANA/Olson time zone support due to the additional manipulation code and data (i.e., IANA database). Therefore, in the past, we encouraged users that needed to manipulate date in arbitrary time zones to use a separate library, like *moment-timezone*. Nevertheless, this solution never closed the gap between internationalization (i18n) implementations leveraging CLDR and having full maneuverability of time zones.
|
||||
|
||||
With the latest release 1.3.0, Globalize fully supports time zone. Simply put, by using Globalize 1.3.0, you now have full IANA support with the strength of CLDR for i18n!
|
||||
|
||||
```js
|
||||
Globalize.locale("en");
|
||||
let date = new Date();
|
||||
|
||||
Globalize.formatDate(date, {datetime: "short", timeZone: "America/Los_Angeles"});
|
||||
// > '3/19/17, 3:19 PM'
|
||||
Globalize.formatDate(date, {datetime: "short", timeZone: "America/New_York"});
|
||||
// > '3/19/17, 6:19 PM'
|
||||
Globalize.formatDate(date, {datetime: "short", timeZone: "America/Sao_Paulo"});
|
||||
// > '3/19/17, 7:19 PM'
|
||||
Globalize.formatDate(date, {datetime: "short", timeZone: "Europe/Berlin"});
|
||||
// > '3/19/17, 11:19 PM'
|
||||
|
||||
Globalize.formatDate(date, {datetime: "full", timeZone: "America/Los_Angeles"});
|
||||
// > 'Sunday, March 19, 2017 at 3:19:22 PM Pacific Daylight Time'
|
||||
Globalize.formatDate(date, {datetime: "full", timeZone: "America/New_York"});
|
||||
// > 'Sunday, March 19, 2017 at 6:19:22 PM Eastern Daylight Time'
|
||||
Globalize.formatDate(date, {datetime: "full", timeZone: "America/Sao_Paulo"});
|
||||
// > 'Sunday, March 19, 2017 at 7:19:22 PM Brasilia Standard Time'
|
||||
Globalize.formatDate(date, {datetime: "full", timeZone: "Europe/Berlin"});
|
||||
// > 'Sunday, March 19, 2017 at 11:19:22 PM Central European Standard Time'
|
||||
|
||||
Globalize("pt").formatDate(date, {datetime: "full", timeZone: "America/Sao_Paulo"});
|
||||
// > 'domingo, 19 de março de 2017 19:19:22 Horário Padrão de Brasília'
|
||||
Globalize("de").formatDate(date, {datetime: "full", timeZone: "Europe/Berlin"});
|
||||
// > 'Sonntag, 19. März 2017 um 23:19:22 Mitteleuropäische Normalzeit'
|
||||
Globalize("zh").formatDate(date, {datetime: "full", timeZone: "Asia/Shanghai"});
|
||||
// > '2017年3月20日星期一 中国标准时间 上午6:19:22'
|
||||
Globalize("ar").formatDate(date, {datetime: "full", timeZone: "Africa/Cairo"});
|
||||
// > 'الاثنين، ٢٠ مارس، ٢٠١٧ ١٢:١٩:٢٢ ص توقيت شرق أوروبا الرسمي'
|
||||
```
|
||||
|
||||
We have solved this in a low footprint, high performance implementation using [zoned-date-time](https://github.com/rxaviers/zoned-date-time) under the hoods, which is a 0.6KB library for the time zone manipulations. We have leveraged the Globalize Compiler for precompling the IANA data base for production. For example, let's say you are serving content in English (e.g. locale en-US) for America/Los_Angeles time using the following formatter:
|
||||
|
||||
```js
|
||||
var dateWithTimeZoneFormatter = Globalize.dateFormatter({
|
||||
datetime: "full",
|
||||
timeZone: "America/Los_Angeles"
|
||||
});
|
||||
```
|
||||
|
||||
The final size (for production) of this code will be:
|
||||
|
||||
| filename | minified+gzipped size |
|
||||
| ---------------------------------------- | --------------------- |
|
||||
| i18n/en.js (includes CLDR and IANA data) | 1.7KB |
|
||||
| core, number, and date globalize runtime lib + zoned-date-time | 7.0KB |
|
||||
|
||||
See globalize [compiler example](https://github.com/globalizejs/globalize/tree/master/examples/globalize-compiler) or [app-npm-webpack example](https://github.com/globalizejs/globalize/tree/master/examples/app-npm-webpack) for details.
|
||||
|
||||
## Format Date To Parts
|
||||
|
||||
> This change was contributed by Reza Payami @rpayami (PayPal) and Rafael Xavier @rxaviers in #697 and #700.
|
||||
|
||||
Modern user interfaces often need to manipulate the date format output, which is impossible via the existing format function that returns an opaque string. Making any attempt to do this can break internationalization support. [Ecma-402](https://github.com/tc39/ecma402/) has recently added [`Intl.DateTimeFormat.prototype.formatToParts`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts) to fulfill that purpose, which at the time of this post, is at stage 4 and is implemented by latest Firefox and Chrome.
|
||||
|
||||
In Globalize, we introduced [`.dateToPartsFormatter`](https://github.com/globalizejs/globalize/blob/master/doc/api/date/date-to-parts-formatter.md) and [`.formatDateToParts`](https://github.com/globalizejs/globalize/blob/master/doc/api/date/date-to-parts-formatter.md).
|
||||
|
||||
```js
|
||||
Globalize.locale( "en" );
|
||||
Globalize.formatDateToParts(new Date(2010, 10, 30));
|
||||
// > [
|
||||
// { "type": "month", "value": "11" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "day", "value": "30" },
|
||||
// { "type": "literal", "value": "/" },
|
||||
// { "type": "year", "value": "2010" }
|
||||
// ]
|
||||
```
|
||||
|
||||
The data is available separately and it can be formatted and concatenated again in a customized way. For example by using [`Array.prototype.map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), a [switch statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch), [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals), and [`Array.prototype.reduce()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
|
||||
|
||||
```js
|
||||
let formatter;
|
||||
|
||||
Globalize.locale( "en" );
|
||||
formatter = Globalize.dateToPartsFormatter({datetime: "short"});
|
||||
|
||||
formatter( new Date( 2010, 10, 30, 17, 55 ) ).map(({type, value}) => {
|
||||
switch ( type ) {
|
||||
case "year": return `<strong>${value}</strong>`;
|
||||
default: return value;
|
||||
}
|
||||
}).join( "" );
|
||||
// > "11/30/<strong>10</strong>, 5:55 PM"
|
||||
```
|
||||
|
||||
See [React Date Input](https://github.com/rxaviers/react-date-input) as a demo of a UI component for React optimized for i18n and a11y.
|
||||
|
||||
| Localized and smart date input | Feb 28 in `en`, `es`, `pt`, `de`, `zh`, `ko`, and `ar` |
|
||||
| ---------------------------------------- | ---------------------------------------- |
|
||||
|  |  |
|
||||
|
||||
## Dynamically Augmented Date Skeletons
|
||||
|
||||
> This change was contributed by Marat Dyatko @vectart and Artur Eshenbrener @Strate in #462 and #604.
|
||||
|
||||
The style used to display a date format often varies depending on the application. CLDR offers data for certain presets like short (e.g., short date `"7/1/17"`), medium (e.g., medium date `"Jul 1, 2017"`), long (e.g., long date `"July 1, 2017"`), and full (e.g., full date `"Saturday, July 1, 2017"`). Although, we may want something different such as `"Jul 1"`. For that CLDR offers data for individual [date fields](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) and their combinations, which are used by Globalize to synthesize an open-ended list of custom formats (called skeletons). But, what's interesting is that it would be prohibitively large if CLDR provided data for every single possible combination. So, there's an algorithm specified by [UTS#35](http://www.unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems) to deduce missing data from the requested format.
|
||||
|
||||
For the `"Jul 1"` example, we should use `{skeleton: "MMMd"}`. Internally, Globalize finds a direct match in CLDR for the requested skeleton. This works fine in previous Globalize versions.
|
||||
|
||||
For that next example, let's assume we want `"July 1"`, i.e., `{skeleton: "MMMMd"}`. Internally, Globalize doesn't find a direct match in CLDR. For this skeleton, Globalize needs to use the data for `MMMd`, which maps to `"MMM d"` in the English case, and then it needs to replace `MMM` with `MMMM` dynamically generating `"MMMM d"`. This doesn't work in previous versions of Globalize, but it works now on latest v1.3.0.
|
||||
|
||||
If we wanted `"07/01"` instead, we should use `{skeleton: "MMdd"}`. Internally, Globalize doesn't find a direct match in CLDR for this skeleton and, therefore, it fais in globalize v1.2.3. Globalize needs to use the data for `Md`, which in the case of English maps to `"M/d"`, and then replace `M` wtih `MM` and `d` with `dd` dynamically generating `"MM/dd"`.
|
||||
|
||||
To make a long story short, the algorithm in globalize v1.3.0 has been significantly improved and it allows using virtually any skeletons.
|
||||
|
||||
```js
|
||||
// A skeleton not directly found in CLDR and that needs to be deduced by globalize.
|
||||
// In English, globalize needs to use the data for GyMMMEd, and adjust MMM with MMMM,
|
||||
// and E with EEEE. Then, it needs to find the data for hms and glue them together
|
||||
// using the appropriate format.
|
||||
// On globalize v1.2.3, an error is thrown saying this skeleton wasn't found.
|
||||
let skeleton = "GyMMMMEEEEdhms";
|
||||
Globalize("en").formatDate(new Date(), {skeleton});
|
||||
// > 'Saturday, July 1, 2017 AD at 4:58:27 PM'
|
||||
Globalize("pt").formatDate(new Date(), {skeleton});
|
||||
// > 'sábado, 1 de julho de 2017 d.C. 5:01:20 PM'
|
||||
Globalize("de").formatDate(new Date(), {skeleton});
|
||||
// > 'Samstag, 1. Juli 2017 n. Chr. um 5:01:33 nachm.'
|
||||
Globalize("zh").formatDate(new Date(), {skeleton});
|
||||
// > '公元2017年七月月1日星期六 下午5:01:35'
|
||||
Globalize("ko").formatDate(new Date(), {skeleton});
|
||||
// > 'AD 2017년 7월 1일 토요일 오후 5:01:38'
|
||||
Globalize("ar").formatDate(new Date(), {skeleton});
|
||||
// > 'السبت، ١ يوليو، ٢٠١٧ م ٥:٠١:٤٠ م'
|
||||
Globalize("ar-MA").formatDate(new Date(), {skeleton});
|
||||
// > 'السبت، 1 يوليوز، 2017 م 5:04:29 م'
|
||||
Globalize("it").formatDate(new Date(), {skeleton});
|
||||
// > 'sabato 1 luglio 2017 d.C. 5:01:52 PM'
|
||||
```
|
||||
|
||||
Read our [getting started](https://github.com/globalizejs/globalize/#getting-started) and play with it yourself.
|
||||
|
||||
## Other Enhancements and Bug Fixes
|
||||
|
||||
🎉 Enhancements
|
||||
|
||||
- Date: Show timezone offset optional minutes for O pattern (e.g., GMT-6:30 note the :30) [#339](https://github.com/globalizejs/globalize/pull/339) (via PR [#729](https://github.com/globalizejs/globalize/pull/729)) (Rafael Xavier)
|
||||
- Date: Show timezone offset optional minutes and seconds for x and X patterns (e.g., -06:30 note the :30) [#339](https://github.com/globalizejs/globalize/pull/339) (via PR [#729](https://github.com/globalizejs/globalize/pull/729)) (Rafael Xavier)
|
||||
- Date: Assert options.skeleton (PR [#726](https://github.com/globalizejs/globalize/pull/726)) (Rafael Xavier)
|
||||
- Date parser: Make runtime phase lighter [#735](https://github.com/globalizejs/globalize/pull/735) (Rafael Xavier)
|
||||
- Date parser: Loose Matching PR [#730](https://github.com/globalizejs/globalize/pull/730) (Rafael Xavier)
|
||||
- Allows, among others, parsing arabic dates as user types them (i.e., without control characters)
|
||||
- Number formatter: Amend integer and fraction formatter for small numbers like 1e-7 [#750](https://github.com/globalizejs/globalize/pull/750) (Rafael Xavier)
|
||||
- Number parser: Lenient about trailing decimal separator [#744](https://github.com/globalizejs/globalize/pull/744) (Rafael Xavier)
|
||||
- Runtime: Use strict [#676](https://github.com/globalizejs/globalize/pull/676) (Zack Birkenbuel)
|
||||
|
||||
🐛 Fixes
|
||||
|
||||
- Date parser: invalid output by mixing numbering systems [#696](https://github.com/globalizejs/globalize/pull/696) (via PR [#733](https://github.com/globalizejs/globalize/pull/733)) (Rafael Xavier)
|
||||
- Date parser: fails on Turkish full datetime with Monday or Saturday [#690](https://github.com/globalizejs/globalize/pull/690) (via PR [#732](https://github.com/globalizejs/globalize/pull/732)) (Rafael Xavier)
|
||||
|
||||
⚙️ Others
|
||||
|
||||
- Compiler tests! [#721](https://github.com/globalizejs/globalize/pull/721) (via PR [#727](https://github.com/globalizejs/globalize/pull/727)) (Nikola Kovacs)
|
||||
- Documentation style refactor [#737](https://github.com/globalizejs/globalize/pull/737) (Rafael Xavier)
|
||||
|
||||
## Last but not least
|
||||
|
||||
Special thanks to other PayPal internationalization team members including Daniel Bruhn, Lucas Welti, Alolita Sharma, Mike McKenna for testing and helping integrate Globalize for PayPal products.
|
||||
|
||||
Special thanks to James Bellenger and Nicolas Gallagher for the React and Webpack integration enhancements for Twitter products, which certainly deserves its own blog post.
|
||||
|
||||
Many thanks to all of you who participated in this release by testing, reporting bugs, or submitting patches, including Jörn Zaefferer, Frédéric Miserey, Nova Patch, and whole Globalize team.
|
||||
114
EveryThing/wwwroot/vendor/libs/globalize/doc/cldr.md
vendored
Normal file
114
EveryThing/wwwroot/vendor/libs/globalize/doc/cldr.md
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
# Unicode CLDR usage
|
||||
|
||||
## How do I get CLDR 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
|
||||
|
||||
## How do I load CLDR data into Globalize?
|
||||
|
||||
The short answer is by using `Globalize.load()` and passing the JSON data as the first argument. Below, follow several examples on how this could be accomplished.
|
||||
|
||||
Example of embedding CLDR JSON data:
|
||||
|
||||
```html
|
||||
<script>
|
||||
Globalize.load({
|
||||
main: {
|
||||
en: {
|
||||
...
|
||||
}
|
||||
},
|
||||
supplemental: {
|
||||
likelySubtags: {
|
||||
...
|
||||
},
|
||||
timeDate: {
|
||||
...
|
||||
},
|
||||
weekData: {
|
||||
...
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Example of loading it dynamically:
|
||||
|
||||
```html
|
||||
<script src="jquery.js"></script>
|
||||
<script>
|
||||
|
||||
// Use $.getJSON instead of $.get if your server is not configured to return the
|
||||
// right MIME type for .json files.
|
||||
$.when(
|
||||
$.get( "cldr/main/en/ca-gregorian.json" ),
|
||||
$.get( "cldr/supplemental/likelySubtags.json" ),
|
||||
$.get( "cldr/supplemental/timeData.json" ),
|
||||
$.get( "cldr/supplemental/weekData.json" )
|
||||
).then(function() {
|
||||
|
||||
// Normalize $.get results, we only need the JSON, not the request statuses.
|
||||
return [].slice.apply( arguments, [ 0 ] ).map(function( result ) {
|
||||
return result[ 0 ];
|
||||
});
|
||||
|
||||
}).then( Globalize.load ).then(function() {
|
||||
|
||||
// Your code goes here.
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
Example using AMD (also see our [functional tests](../../test/functional.js)):
|
||||
```javascript
|
||||
define([
|
||||
"globalize",
|
||||
"json!cldr-data/main/en/ca-gregorian.json",
|
||||
"json!cldr-data/supplemental/likelySubtags.json",
|
||||
"json!cldr-data/supplemental/timeData.json",
|
||||
"json!cldr-data/supplemental/weekData.json",
|
||||
"globalize/date"
|
||||
], function( Globalize, enCaGregorian, likelySubtags, timeData, weekData ) {
|
||||
|
||||
Globalize.load(
|
||||
enCaGregorian,
|
||||
likelySubtags,
|
||||
timeData,
|
||||
weekData
|
||||
);
|
||||
|
||||
// Your code goes here.
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
Example using Node.js:
|
||||
|
||||
```javascript
|
||||
var Globalize = require( "globalize" );
|
||||
|
||||
Globalize.load(
|
||||
require( "cldr-data/main/en/ca-gregorian" ),
|
||||
require( "cldr-data/supplemental/likelySubtags" ),
|
||||
require( "cldr-data/supplemental/timeData" ),
|
||||
require( "cldr-data/supplemental/weekData" )
|
||||
);
|
||||
```
|
||||
9
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-default-locale-not-defined.md
vendored
Normal file
9
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-default-locale-not-defined.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
## 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> )`.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_DEFAULT_LOCALE_NOT_DEFINED` |
|
||||
14
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-invalid-cldr.md
vendored
Normal file
14
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-invalid-cldr.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
## E_INVALID_CLDR
|
||||
|
||||
Thrown when a CLDR item has an invalid or unexpected value.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_INVALID_CLDR` |
|
||||
| description | Reason why the data was considered invalid |
|
||||
|
||||
- description "Missing rules to deduce plural form of \`{value}\`"
|
||||
|
||||
Thrown when the plural form (also known as plural group) is not found for the given value. This error is very unlikely to occur and is related to incomplete or invalid CLDR `supplemental/plurals-type-cardinal/{language}` data.
|
||||
12
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-invalid-par-type.md
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-invalid-par-type.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
## 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 |
|
||||
11
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-invalid-par-value.md
vendored
Normal file
11
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-invalid-par-value.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
## E_INVALID_PAR_VALUE
|
||||
|
||||
Thrown for certain parameters when the type is correct, but the value is invalid. Currently, the only parameter with such validation is the date format (for either format and parse). Format allows [certain variants](../api/date/date-formatter.md#parameters), if it's none of them, error is thrown.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_INVALID_PAR_VALUE` |
|
||||
| name | Name of the invalid parameter |
|
||||
| value | Invalid value |
|
||||
11
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-missing-cldr.md
vendored
Normal file
11
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-missing-cldr.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
## E_MISSING_CLDR
|
||||
|
||||
Thrown when any required CLDR item is NOT found.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_MISSING_CLDR` |
|
||||
| path | Missing CLDR item path |
|
||||
|
||||
10
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-missing-parameter.md
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-missing-parameter.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
## 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 |
|
||||
9
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-missing-plural-module.md
vendored
Normal file
9
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-missing-plural-module.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
## E_MISSING_PLURAL_MODULE
|
||||
|
||||
Thrown when plural module is needed, but not loaded, eg. formatting currencies using plural messages.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_MISSING_PLURAL_MODULE` |
|
||||
11
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-par-missing-key.md
vendored
Normal file
11
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-par-missing-key.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
## E_PAR_MISSING_KEY
|
||||
|
||||
Thrown when a parameter misses a required key.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_PAR_MISSING_KEY` |
|
||||
| key | Name of the missing parameter's key |
|
||||
| name | Name of the missing parameter |
|
||||
13
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-par-out-of-range.md
vendored
Normal file
13
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-par-out-of-range.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
## E_PAR_OUT_OF_RANGE
|
||||
|
||||
Thrown when a parameter is not within a valid range of values.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_PAR_OUT_OF_RANGE` |
|
||||
| name | Name of the invalid parameter |
|
||||
| value | Invalid value |
|
||||
| minimum | Minimum value of the valid range |
|
||||
| maximum | Maximum value of the valid range |
|
||||
10
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-unsupported.md
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/globalize/doc/error/e-unsupported.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
## E_UNSUPPORTED
|
||||
|
||||
Thrown for unsupported features, eg. to format unsupported date patterns.
|
||||
|
||||
Error object:
|
||||
|
||||
| Attribute | Value |
|
||||
| --- | --- |
|
||||
| code | `E_UNSUPPORTED` |
|
||||
| feature | Description of the unsupported feature |
|
||||
64
EveryThing/wwwroot/vendor/libs/globalize/doc/migrating-from-0.x.md
vendored
Normal file
64
EveryThing/wwwroot/vendor/libs/globalize/doc/migrating-from-0.x.md
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Migrating from Globalize 0.x
|
||||
|
||||
Globalize 0.x came with a bundled locale for US English, and optional files for various other locales. Globalize 1.x uses CLDR for the locale data, and it doesn't bundle any locale data. Check out the documentation for loading CLDR data in 1.x to learn more about that. If you were only using the bundle locale, you only need to load CLDR data for US English. If you were loading other locales, make sure you load those from CLDR as well.
|
||||
|
||||
On the API side, things have also changed, to simplify usage, remove ambiguity and add features. The rest of this document provides a brief function-by-function list.
|
||||
|
||||
If you still need help with migration, let us know. We may extend this guide later as necessary.
|
||||
|
||||
## Globalize.addCultureInfo()
|
||||
|
||||
This method is replaced by `Globalize.loadMessages( json )`. If you were using it for anything except message translations, you may also need to use `Globalize.load`.
|
||||
|
||||
## Globalize.cultures
|
||||
|
||||
This property is gone. You can use Cldrjs to traverse CLDR directly.
|
||||
|
||||
## Globalize.culture( [locale] )
|
||||
|
||||
This method is replaced by the `Globalize.locale( [locale|cldr] )` method. Call it without arguments to retrieve the default locale, call it with a string argument to set the default locale.
|
||||
|
||||
## Globalize.findClosestCulture
|
||||
|
||||
This method is gone, there is no replacement. If you still need this method, create an issue with your usecase.
|
||||
|
||||
## Globalize.format
|
||||
|
||||
Replaced by three separate methods:
|
||||
|
||||
* `.formatNumber( value [, options] )`
|
||||
* `.formatCurrency( value, currency [, options] )`
|
||||
* `.formatDate( value, pattern )`
|
||||
|
||||
See their respective documentation for usage details. Note that the number and date formats are now based on CLDR, using the options and patterns standardized by Unicode. We don't currently have documentation for migrating these formats.
|
||||
|
||||
## Globalize.localize
|
||||
|
||||
Replaced by `.formatMessage( path [, variables ] )`. The new API is quite different and provides much more than just value-lookup. See their respective documentation for usage details.
|
||||
|
||||
## Globalize.parseInt/parseFloat
|
||||
|
||||
Replaced by `.parseNumber( value [, options] )`. So where you might have previously executed:
|
||||
|
||||
```js
|
||||
Globalize( "en" ).parseFloat( "123,456.789" )
|
||||
// > 123456.789
|
||||
```
|
||||
|
||||
You could now execute:
|
||||
|
||||
```js
|
||||
Globalize( "en" ).parseNumber( "123,456.789" )
|
||||
// > 123456.789
|
||||
```
|
||||
|
||||
`parseNumber` is an alias for [`.numberParser( [options] )( value )`](api/number/number-parser.md). So you could also do this:
|
||||
|
||||
```js
|
||||
Globalize( "en" ).numberParser()( "123,456.789" )
|
||||
// > 123456.789
|
||||
```
|
||||
|
||||
## Globalize.parseDate
|
||||
|
||||
This method still exists, and the signature is almost the same: `.parseDate( value, pattern )`. Note that `pattern` indicates just a single "format", where Globalize 0.x supported multiple of those "formats".
|
||||
7
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.bowerrc
vendored
Normal file
7
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.bowerrc
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"directory": "bower_components",
|
||||
"scripts": {
|
||||
"preinstall": "npm install cldr-data-downloader",
|
||||
"postinstall": "node ./node_modules/cldr-data-downloader/bin/download.js -i bower_components/cldr-data/index.json -o bower_components/cldr-data/"
|
||||
}
|
||||
}
|
||||
1
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.npmignore
vendored
Normal file
1
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.npmignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bower_components/
|
||||
65
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/README.md
vendored
Normal file
65
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/README.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Hello World (AMD + bower)
|
||||
|
||||
We assume you know what [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) and
|
||||
[bower](http://bower.io/) is.
|
||||
|
||||
The demo is composed of the following files:
|
||||
|
||||
```
|
||||
.
|
||||
├── index.html
|
||||
└── main.js
|
||||
```
|
||||
|
||||
Before running it, execute the requirements below.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
**1. Install Globalize**
|
||||
|
||||
Let's use bower to download Globalize. For more information on regard of
|
||||
installation, please read [Getting Started](../../README.md#installation).
|
||||
|
||||
```
|
||||
bower install
|
||||
```
|
||||
|
||||
Note bower will also fetch some other dependencies of this demo, eg. require.js
|
||||
and its json plugin.
|
||||
|
||||
You'll get this:
|
||||
|
||||
```
|
||||
.
|
||||
├── bower_components/
|
||||
│ ├── globalize/
|
||||
│ │ └── dist/
|
||||
│ │ ├── globalize
|
||||
│ │ │ ├── date.js
|
||||
│ │ │ └── ...
|
||||
│ │ └── globalize.js
|
||||
│ └── ...
|
||||
├── index.html
|
||||
└── main.js
|
||||
```
|
||||
|
||||
**2. Install Dependencies**
|
||||
|
||||
No action needed, because bower has already handled that for us.
|
||||
|
||||
**3. CLDR content**
|
||||
|
||||
No action needed, because bower has already handled that for us. Note `.bowerrc`
|
||||
has postinstall hook that populates bower's cldr-data skeleton. For more
|
||||
information, see [bower's cldr-data](https://github.com/rxaviers/cldr-data-bower).
|
||||
|
||||
|
||||
## Running the demo
|
||||
|
||||
Once you've completed the requirements above:
|
||||
|
||||
1. Start a server by running `python -m SimpleHTTPServer` or other alternative servers such as [http-server](https://github.com/nodeapps/http-server), [nginx](http://nginx.org/en/docs/), [apache](http://httpd.apache.org/docs/trunk/).
|
||||
1. Point your browser at `http://localhost:8000/`.
|
||||
1. Understand the demo by reading the source code (both index.html and main.js).
|
||||
We have comments there for you.
|
||||
13
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/bower.json
vendored
Normal file
13
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/bower.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "globalize-hello-world-amd-bower",
|
||||
"dependencies": {
|
||||
"cldr-data": "*",
|
||||
"globalize": "^1.3.0",
|
||||
"iana-tz-data": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": "2.1.14",
|
||||
"requirejs-plugins": "1.0.2" ,
|
||||
"requirejs-text": "2.0.12"
|
||||
}
|
||||
}
|
||||
46
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/index.html
vendored
Normal file
46
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/index.html
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Globalize Hello World (AMD + bower)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Globalize Hello World (AMD + bower)</h1>
|
||||
|
||||
<div id="requirements">
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>Run `bower install` (you must have bower installed first).</li>
|
||||
<li>Start a server, e.g., by running `python -m SimpleHTTPServer`.</li>
|
||||
<li>Point your browser at `http://localhost:8000/`.</li>
|
||||
<li>Please, read README.md for more information on any of the above.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="demo" style="display: none">
|
||||
<h2>Demo output</h2>
|
||||
<p>Now: <span id="date"></span></p>
|
||||
<p>Now: <span id="dateToParts"></span> (note the highlighted month, the markup was added using formatDateToParts)</p>
|
||||
<p>Now (in America/Sao_Paulo): <span id="zonedDate"></span></p>
|
||||
<p>A number: <span id="number"></span></p>
|
||||
<p>A number (compact form): <span id="number-compact"></span></p>
|
||||
<p>A currency: <span id="currency"></span></p>
|
||||
<p>Plural form of <span id="plural-number"></span> is <span id="plural-form"></span></p>
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
<li><span id="message-0"></span></li>
|
||||
<li><span id="message-1"></span></li>
|
||||
<li><span id="message-2"></span></li>
|
||||
<li><span id="message-3"></span></li>
|
||||
</ul>
|
||||
<p>Something happened: <span id="relative-time"></span></p>
|
||||
<p>Speed limit: <span id="unit"></span></p>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
Load require.js and let it execute main.js
|
||||
-->
|
||||
<script data-main="main.js" src="bower_components/requirejs/require.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
141
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/main.js
vendored
Normal file
141
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/main.js
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* 1. Configure require.js paths.
|
||||
*/
|
||||
require.config({
|
||||
paths: {
|
||||
// Globalize dependencies paths.
|
||||
cldr: "./bower_components/cldrjs/dist/cldr",
|
||||
|
||||
// Unicode CLDR JSON data.
|
||||
"cldr-data": "./bower_components/cldr-data",
|
||||
|
||||
// IANA time zone data.
|
||||
"iana-tz-data": "../bower_components/iana-tz-data/iana-tz-data",
|
||||
|
||||
// require.js plugin we'll use to fetch CLDR JSON content.
|
||||
json: "./bower_components/requirejs-plugins/src/json",
|
||||
|
||||
// text is json's dependency.
|
||||
text: "./bower_components/requirejs-text/text",
|
||||
|
||||
// Globalize.
|
||||
globalize: "./bower_components/globalize/dist/globalize"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 2. Require dependencies and run your code.
|
||||
*/
|
||||
require([
|
||||
"globalize",
|
||||
|
||||
// CLDR content.
|
||||
"json!cldr-data/main/en/ca-gregorian.json",
|
||||
"json!cldr-data/main/en/currencies.json",
|
||||
"json!cldr-data/main/en/dateFields.json",
|
||||
"json!cldr-data/main/en/numbers.json",
|
||||
"json!cldr-data/main/en/timeZoneNames.json",
|
||||
"json!cldr-data/main/en/units.json",
|
||||
"json!cldr-data/supplemental/currencyData.json",
|
||||
"json!cldr-data/supplemental/likelySubtags.json",
|
||||
"json!cldr-data/supplemental/metaZones.json",
|
||||
"json!cldr-data/supplemental/plurals.json",
|
||||
"json!cldr-data/supplemental/timeData.json",
|
||||
"json!cldr-data/supplemental/weekData.json",
|
||||
"json!messages/en.json",
|
||||
"json!iana-tz-data.json",
|
||||
|
||||
// Extend Globalize with Date and Number modules.
|
||||
"globalize/currency",
|
||||
"globalize/date",
|
||||
"globalize/message",
|
||||
"globalize/number",
|
||||
"globalize/plural",
|
||||
"globalize/relative-time",
|
||||
"globalize/unit"
|
||||
], function( Globalize, enGregorian, enCurrencies, enDateFields, enNumbers,
|
||||
enTimeZoneNames, enUnits, currencyData, likelySubtags, metaZones,
|
||||
pluralsData, timeData, weekData, messages, ianaTzData ) {
|
||||
|
||||
var en, like, number;
|
||||
|
||||
// At this point, we have Globalize loaded. But, before we can use it, we need to feed it on the appropriate I18n content (Unicode CLDR). Read Requirements on Getting Started on the root's README.md for more information.
|
||||
Globalize.load(
|
||||
currencyData,
|
||||
enCurrencies,
|
||||
enDateFields,
|
||||
enGregorian,
|
||||
enNumbers,
|
||||
enTimeZoneNames,
|
||||
enUnits,
|
||||
likelySubtags,
|
||||
metaZones,
|
||||
pluralsData,
|
||||
timeData,
|
||||
weekData
|
||||
);
|
||||
Globalize.loadMessages( messages );
|
||||
Globalize.loadTimeZone( ianaTzData );
|
||||
|
||||
// Instantiate "en".
|
||||
en = Globalize( "en" );
|
||||
|
||||
// Use Globalize to format dates.
|
||||
document.getElementById( "date" ).textContent = en.formatDate( new Date(), {
|
||||
datetime: "medium"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates on specific time zone.
|
||||
document.getElementById( "zonedDate" ).textContent = en.formatDate( new Date(), {
|
||||
datetime: "full",
|
||||
timeZone: "America/Sao_Paulo"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates to parts.
|
||||
document.getElementById( "dateToParts" ).innerHTML = en.formatDateToParts( new Date(), {
|
||||
datetime: "medium"
|
||||
}).map( function( part ) {
|
||||
switch ( part.type ) {
|
||||
case "month": return "<strong>" + part.value + "</strong>";
|
||||
default: return part.value;
|
||||
}
|
||||
}).reduce( function( memo, value ) {
|
||||
return memo + value;
|
||||
});
|
||||
|
||||
// Use Globalize to format numbers.
|
||||
number = en.numberFormatter();
|
||||
document.getElementById( "number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "number-compact" ).textContent = en.formatNumber( 12345.6789, {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
// Use Globalize to format currencies.
|
||||
document.getElementById( "currency" ).textContent = en.formatCurrency( 69900, "USD" );
|
||||
|
||||
// Use Globalize to get the plural form of a numeric value.
|
||||
document.getElementById( "plural-number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "plural-form" ).textContent = en.plural( 12345.6789 );
|
||||
|
||||
// Use Globalize to format a message with plural inflection.
|
||||
like = en.messageFormatter( "like" );
|
||||
document.getElementById( "message-0" ).textContent = like( 0 );
|
||||
document.getElementById( "message-1" ).textContent = like( 1 );
|
||||
document.getElementById( "message-2" ).textContent = like( 2 );
|
||||
document.getElementById( "message-3" ).textContent = like( 3 );
|
||||
|
||||
// Use Globalize to format a relative time.
|
||||
document.getElementById( "relative-time" ).textContent = en.formatRelativeTime( -35, "second" );
|
||||
|
||||
// Use Globalize to format a unit.
|
||||
document.getElementById( "unit" ).textContent = en.formatUnit( 60, "mile/hour", {
|
||||
form: "short"
|
||||
});
|
||||
|
||||
document.getElementById( "requirements" ).style.display = "none";
|
||||
document.getElementById( "demo" ).style.display = "block";
|
||||
|
||||
});
|
||||
12
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/messages/en.json
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/messages/en.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"en": {
|
||||
"like": [
|
||||
"{0, plural, offset:1",
|
||||
" =0 {Be the first to like this}",
|
||||
" =1 {You liked this}",
|
||||
" one {You and someone else liked this}",
|
||||
" other {You and # others liked this}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
14
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/package.json
vendored
Normal file
14
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/package.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "globalize-hello-world-amd-bower",
|
||||
"private": true,
|
||||
"comment": [
|
||||
"You don't need this file. The only reasone this example does have a",
|
||||
"package.json is to fool npm, so cldr-data-downloader doesn't get",
|
||||
"installed on Globalize's root.",
|
||||
"",
|
||||
"It's analogous to `chroot .` for npm. [:P]"
|
||||
],
|
||||
"dependencies": {
|
||||
"cldr-data-downloader": "^0.3.4"
|
||||
}
|
||||
}
|
||||
3
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/.npmignore
vendored
Normal file
3
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/.npmignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
dist/
|
||||
node_modules
|
||||
.tmp-globalize-webpack
|
||||
74
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/README.md
vendored
Normal file
74
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/README.md
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# Globalize App example using webpack
|
||||
|
||||
This example demonstrates how to integrate Globalize with Webpack in your
|
||||
Application. If you already have an existing Application using Webpack stack,
|
||||
this example should as well provide you guidance on how to integrate Globalize.
|
||||
It focuses on the [Globalize Webpack Plugin][], which automates data loading
|
||||
(CLDR and app messages) during development and automates Globalize compilation
|
||||
and the usage of Globalize runtime modules for production. It assumes knowledge
|
||||
of Globalize, npm, and Webpack usage basics.
|
||||
|
||||
## Requirements
|
||||
|
||||
**1. Install app development dependencies**
|
||||
|
||||
This example uses `npm` to download the app development dependencies (i.e.,
|
||||
Globalize, CLDR data, Cldrjs, Webpack, [Globalize Webpack Plugin][], and
|
||||
others).
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
## Running the example
|
||||
|
||||
### Development mode
|
||||
|
||||
```
|
||||
npm start
|
||||
```
|
||||
|
||||
1. Start a server by running `npm start`, which uses webpack's live reload HMR
|
||||
(Hot Module Replacement). See `package.json` to understand the actual shell
|
||||
command that is used.
|
||||
1. Point your browser at `http://localhost:8080`. Note that your browser will
|
||||
automatically reload on any changes made to the application code (`app/*.js`
|
||||
files). Also note that for faster page reload, formatters are created
|
||||
dynamically and automatically by the [Globalize Webpack Plugin][].
|
||||
1. Note you can specify the development locale of your choice by setting the
|
||||
`developmentLocale` property of the Globalize Webpack Plugin on the Webpack
|
||||
config file.
|
||||
1. Note that CLDR data and your messages data are automatically loaded by the
|
||||
[Globalize Webpack Plugin][].
|
||||
1. Understand the demo by reading the source code. We have comments there for
|
||||
you.
|
||||
|
||||
### Production mode
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
1. Generate the compiled bundles by running `npm run build`, which will be
|
||||
created at `./dist`. Note the production bundles are split into three chunks:
|
||||
(a) vendor, which holds third-party libraries, which in this case means
|
||||
Globalize Runtime modules, (b) i18n precompiled data, which means the minimum
|
||||
yet sufficient set of precompiled i18n data that your application needs (one
|
||||
file for each supported locale), and (c) app, which means your application code.
|
||||
Also note that all the production code is already minified using UglifyJS. See
|
||||
`package.json` to understand the actual shell command that is used.
|
||||
1. Note that your formatters are already precompiled. This is
|
||||
obvious, but worth emphasizing. It means your formatters are prebuilt, so no client
|
||||
CPU clock is wasted to generate them and no CLDR or messages data needs to be
|
||||
dynamically loaded. It means fast to load code (small code) and fast to run
|
||||
code.
|
||||
1. Point your browser at `./dist/index.html` to run the application using the
|
||||
generated production files. Edit this file to display the application using a
|
||||
different locale (source code has instructions).
|
||||
1. Understand the demo by reading the source code. We have comments there for
|
||||
you.
|
||||
|
||||
For more information about the plugin, see the [Globalize Webpack Plugin][]
|
||||
documentation.
|
||||
|
||||
[Globalize Webpack Plugin]: https://github.com/rxaviers/globalize-webpack-plugin
|
||||
89
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/app/index.js
vendored
Normal file
89
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/app/index.js
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
var Globalize = require( "globalize" );
|
||||
var startTime = new Date();
|
||||
|
||||
// Standalone table.
|
||||
var numberFormatter = Globalize.numberFormatter({ maximumFractionDigits: 2 });
|
||||
document.getElementById( "number" ).textContent = numberFormatter( 12345.6789 );
|
||||
|
||||
var numberCompactFormatter = Globalize.numberFormatter({
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
document.getElementById( "number-compact" ).textContent = numberCompactFormatter( 12345.6789 );
|
||||
|
||||
var currencyFormatter = Globalize.currencyFormatter( "USD" );
|
||||
document.getElementById( "currency" ).textContent = currencyFormatter( 69900 );
|
||||
|
||||
var dateFormatter = Globalize.dateFormatter({ datetime: "medium" });
|
||||
document.getElementById( "date" ).textContent = dateFormatter( new Date() );
|
||||
|
||||
var dateWithTimeZoneFormatter = Globalize.dateFormatter({
|
||||
datetime: "full",
|
||||
timeZone: "America/Sao_Paulo"
|
||||
});
|
||||
document.getElementById( "date-time-zone" ).textContent = dateWithTimeZoneFormatter( new Date() );
|
||||
|
||||
var _dateToPartsFormatter = Globalize.dateToPartsFormatter({ datetime: "medium" });
|
||||
var dateToPartsFormatter = function( value ) {
|
||||
return _dateToPartsFormatter( value, {
|
||||
datetime: "medium"
|
||||
}).map(function( part ) {
|
||||
switch(part.type) {
|
||||
case "month": return "<strong>" + part.value + "</strong>";
|
||||
default: return part.value;
|
||||
}
|
||||
}).reduce(function( memo, value ) {
|
||||
return memo + value;
|
||||
});
|
||||
};
|
||||
document.getElementById( "date-to-parts" ).innerHTML = dateToPartsFormatter( new Date() );
|
||||
|
||||
var relativeTimeFormatter = Globalize.relativeTimeFormatter( "second" );
|
||||
document.getElementById( "relative-time" ).textContent = relativeTimeFormatter( 0 );
|
||||
|
||||
var unitFormatter = Globalize.unitFormatter( "mile/hour", { form: "short" } );
|
||||
document.getElementById( "unit" ).textContent = unitFormatter( 60 );
|
||||
|
||||
// Messages.
|
||||
document.getElementById( "intro-1" ).textContent = Globalize.formatMessage( "intro-1" );
|
||||
document.getElementById( "number-label" ).textContent = Globalize.formatMessage( "number-label" );
|
||||
document.getElementById( "number-compact-label" ).textContent = Globalize.formatMessage( "number-compact-label" );
|
||||
document.getElementById( "currency-label" ).textContent = Globalize.formatMessage( "currency-label" );
|
||||
document.getElementById( "date-label" ).textContent = Globalize.formatMessage( "date-label" );
|
||||
document.getElementById( "date-time-zone-label" ).textContent = Globalize.formatMessage( "date-time-zone-label" );
|
||||
document.getElementById( "date-to-parts-label" ).textContent = Globalize.formatMessage( "date-to-parts-label" );
|
||||
document.getElementById( "relative-time-label" ).textContent = Globalize.formatMessage( "relative-time-label" );
|
||||
document.getElementById( "unit-label" ).textContent = Globalize.formatMessage( "unit-label" );
|
||||
document.getElementById( "message-1" ).textContent = Globalize.formatMessage( "message-1", {
|
||||
currency: currencyFormatter( 69900 ),
|
||||
date: dateFormatter( new Date() ),
|
||||
number: numberFormatter( 12345.6789 ),
|
||||
relativeTime: relativeTimeFormatter( 0 ),
|
||||
unit: unitFormatter( 60 )
|
||||
});
|
||||
|
||||
document.getElementById( "message-2" ).textContent = Globalize.formatMessage( "message-2", {
|
||||
count: 3
|
||||
});
|
||||
|
||||
// Display demo.
|
||||
document.getElementById( "requirements" ).style.display = "none";
|
||||
document.getElementById( "demo" ).style.display = "block";
|
||||
|
||||
// Refresh elapsed time
|
||||
setInterval(function() {
|
||||
var elapsedTime = +( ( startTime - new Date() ) / 1000 ).toFixed( 0 );
|
||||
document.getElementById( "date" ).textContent = dateFormatter( new Date() );
|
||||
document.getElementById( "date-time-zone" ).textContent = dateWithTimeZoneFormatter( new Date() );
|
||||
document.getElementById( "date-to-parts" ).innerHTML = dateToPartsFormatter( new Date() );
|
||||
document.getElementById( "relative-time" ).textContent = relativeTimeFormatter( elapsedTime );
|
||||
document.getElementById( "message-1" ).textContent = Globalize.formatMessage( "message-1", {
|
||||
currency: currencyFormatter( 69900 ),
|
||||
date: dateFormatter( new Date() ),
|
||||
number: numberFormatter( 12345.6789 ),
|
||||
relativeTime: relativeTimeFormatter( elapsedTime ),
|
||||
unit: unitFormatter( 60 )
|
||||
});
|
||||
|
||||
}, 1000);
|
||||
71
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/index-template.html
vendored
Normal file
71
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/index-template.html
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Globalize App example using Webpack</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Globalize App example using Webpack</h1>
|
||||
|
||||
<div id="requirements">
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>Read README.md for instructions on how to run the demo.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="demo" style="display: none">
|
||||
<p id="intro-1">Use Globalize to internationalize your application.</p>
|
||||
<table border="1" style="marginBottom: 1em;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><span id="number-label">Standalone Number</span></td>
|
||||
<td>"<span id="number"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="number-compact-label">Standalone Number (compact form)</span></td>
|
||||
<td>"<span id="number-compact"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="currency-label">Standalone Currency</span></td>
|
||||
<td>"<span id="currency"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="date-label">Standalone Date</span></td>
|
||||
<td>"<span id="date"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="date-time-zone-label">Standalone Date (in a specific IANA time zone, e.g., America/Sao_Paulo)</span></td>
|
||||
<td>"<span id="date-time-zone"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="date-to-parts-label">Standalone Date (note the highlighted month, the markup was added using formatDateToParts)</span></td>
|
||||
<td>"<span id="date-to-parts"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="relative-time-label">Standalone Relative Time</span></td>
|
||||
<td>"<span id="relative-time"></span>"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span id="unit-label">Standalone Unit</span></td>
|
||||
<td>"<span id="unit"></span>"</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p id="message-1">
|
||||
An example of a message using mixed number "{number}", currency "{currency}", date "{date}", relative time "{relativeTime}", and unit "{unit}".
|
||||
</p>
|
||||
<p id="message-2">
|
||||
An example of a message with pluralization support:
|
||||
{count, plural,
|
||||
one {You have one remaining task}
|
||||
other {You have # remaining tasks}
|
||||
}.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/ar.json
vendored
Normal file
25
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/ar.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"ar": {
|
||||
"intro-1": "استخدم Globalize لتدويل تطبيقك.",
|
||||
"number-label": "رقم",
|
||||
"number-compact-label": "الرقم (شكل مدمج)",
|
||||
"currency-label": "عملة",
|
||||
"date-label": "تاريخ",
|
||||
"date-time-zone-label": "التاريخ (في منطقة زمنية محددة ل إيانا، على سبيل المثال، America/Sao_Paulo)",
|
||||
"date-to-parts-label": "التاريخ (لاحظ الشهر القوي، تمت إضافة الترميز باستخدام formatDateToParts)",
|
||||
"relative-time-label": "الوقت النسبي",
|
||||
"unit-label": "وحدة القياس",
|
||||
"message-1": "مثال علي رسالة باستخدام رقم مختلط \"{number}\", عملة \"{currency}\", تاريخ \"{date}\", وقت نسبي \"{relativeTime}\", و وحدة قياس \"{unit}\" .",
|
||||
"message-2": [
|
||||
"مثال على رسالة بدعم صيغة الجمع:",
|
||||
"{count, plural,",
|
||||
" zero {لا يوجد لديك اي مهام متبقية}",
|
||||
" one {لديك مهمة واحدة متبقية}",
|
||||
" two {لديك اثنين من المهام المتبقية}",
|
||||
" few {لديك # من المهام المتبقية}",
|
||||
" many {لديك # من المهام المتبقية}",
|
||||
" other {لديك # من المهام المتبقية}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/de.json
vendored
Normal file
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/de.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"de": {
|
||||
"intro-1": "Verwenden Sie Globalize um Ihre Anwendung zu internationalisieren.",
|
||||
"number-label": "Zahl",
|
||||
"number-compact-label": "Zahl (kompakte Form)",
|
||||
"currency-label": "Währung",
|
||||
"date-label": "Datum",
|
||||
"date-time-zone-label": "Datum (in einer bestimmten IANA-Zeitzone, z. B. America/Sao_Paulo)",
|
||||
"date-to-parts-label": "Datum (beachten Sie den hervorgehobenen Monat, das Markup wurde mit dateToPartsFormatter hinzugefügt)",
|
||||
"relative-time-label": "Relative Zeit",
|
||||
"unit-label": "Einheit",
|
||||
"message-1": "Ein Beispiel mit Zahl \"{number}\", Währung \"{currency}\", Datum \"{date}\", relative Zeit \"{relativeTime}\", und Einheit \"{unit}\".",
|
||||
"message-2": [
|
||||
"Ein Beispieltext mit Unterstützung von Plural Formen: ",
|
||||
"{count, plural,",
|
||||
" one {Sie haben noch eine Aufgabe}",
|
||||
" other {Sie haben noch # verbliebende Aufgaben}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/en.json
vendored
Normal file
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/en.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"en": {
|
||||
"intro-1": "Use Globalize to internationalize your application.",
|
||||
"number-label": "Number",
|
||||
"number-compact-label": "Number (compact form)",
|
||||
"currency-label": "Currency",
|
||||
"date-label": "Date",
|
||||
"date-time-zone-label": "Date (in a specific IANA time zone, e.g., America/Sao_Paulo)",
|
||||
"date-to-parts-label": "Date (note the highlighted month, the markup was added using formatDateToParts)",
|
||||
"relative-time-label": "Relative Time",
|
||||
"unit-label": "Unit",
|
||||
"message-1": "An example of a message using mixed number \"{number}\", currency \"{currency}\", date \"{date}\", relative time \"{relativeTime}\", and unit \"{unit}\".",
|
||||
"message-2": [
|
||||
"An example of a message with pluralization support:",
|
||||
"{count, plural,",
|
||||
" one {You have one remaining task}",
|
||||
" other {You have # remaining tasks}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/es.json
vendored
Normal file
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/es.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"es": {
|
||||
"intro-1": "Usa Globalize para internacionalizar tu aplicación.",
|
||||
"number-label": "Número",
|
||||
"number-compact-label": "Número (forma compacta)",
|
||||
"currency-label": "Moneda",
|
||||
"date-label": "Fecha",
|
||||
"date-time-zone-label": "Fecha (en una zona horaria IANA específica, por ejemplo, America/Sao_Paulo)",
|
||||
"date-to-parts-label": "Fecha (note el mes destacado en negro, el marcador de html se agregó utilizando dateToPartsFormatter)",
|
||||
"relative-time-label": "Tiempo Relativo",
|
||||
"unit-label": "Unidad",
|
||||
"message-1": "Un ejemplo de mensaje usando números mixtos \"{number}\", monedas \"{currency}\", fechas \"{date}\", tiempo relativo \"{relativeTime}\", y unidades \"{unit}\".",
|
||||
"message-2": [
|
||||
"Un ejemplo de mensaje con soporte de pluralización:",
|
||||
"{count, plural,",
|
||||
" one {Tienes una tarea restante}",
|
||||
" other {Tienes # tareas restantes}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/pt.json
vendored
Normal file
21
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/pt.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"pt": {
|
||||
"intro-1": "Use o Globalize para internacionalizar sua aplicação.",
|
||||
"number-label": "Número",
|
||||
"number-compact-label": "Número (forma compacta)",
|
||||
"currency-label": "Moeda",
|
||||
"date-label": "Data",
|
||||
"date-time-zone-label": "Data (em um fuso horário IANA específico, por exemplo, America/Sao_Paulo)",
|
||||
"date-to-parts-label": "Data (note o mês em negrito, a marcação HTML foi adicionada usando formatDateToParts)",
|
||||
"relative-time-label": "Tempo relativo",
|
||||
"unit-label": "Unit",
|
||||
"message-1": "Um exemplo de mensagem com mistura de número \"{number}\", moeda \"{currency}\", data \"{date}\", tempo relativo \"{relativeTime}\", e unidade \"{unit}\".",
|
||||
"message-2": [
|
||||
"Um exemplo de message com suporte a pluralização:",
|
||||
"{count, plural,",
|
||||
" one {Você tem uma tarefa restante}",
|
||||
" other {Você tem # tarefas restantes}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
23
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/ru.json
vendored
Normal file
23
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/ru.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"ru": {
|
||||
"intro-1": "Используйте Globalize для интернационализиции вашего приложения.",
|
||||
"number-label": "Число",
|
||||
"number-compact-label": "Число (компактная форма)",
|
||||
"currency-label": "Валюта",
|
||||
"date-label": "Дата",
|
||||
"date-time-zone-label": "Дата (в определенном часовом поясе IANA, например, America/Sao_Paulo)",
|
||||
"date-to-parts-label": "Дата (обратите внимание на сильный месяц, разметка была добавлена с помощью formatDateToParts)",
|
||||
"relative-time-label": "Относительное время",
|
||||
"unit-label": "Единица измерения",
|
||||
"message-1": "Пример сообщения с числом \"{number}\", валютой \"{currency}\", датой \"{date}\", относительным временем \"{relativeTime}\" и единицей измерения \"{unit}\".",
|
||||
"message-2": [
|
||||
"Пример сообщения с поддержкой множественного числа:",
|
||||
"{count, plural,",
|
||||
" one {У вас осталась одна задача}",
|
||||
" many {У вас осталось # задач}",
|
||||
" few {У вас осталось # задачи}",
|
||||
" other {У вас осталось # задачи}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
20
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/zh.json
vendored
Normal file
20
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/messages/zh.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"zh": {
|
||||
"intro-1": "使用Globalize的国际化应用程序",
|
||||
"number-label": "号码",
|
||||
"number-compact-label": "编号(紧凑形式)",
|
||||
"currency-label": "币",
|
||||
"date-label": "迄今",
|
||||
"date-time-zone-label": "日期(在特定的IANA时区,例如America / Sao_Paulo)",
|
||||
"date-to-parts-label": "日期(注意强烈的月份,使用formatDateToParts添加标记)",
|
||||
"relative-time-label": "相对时间",
|
||||
"unit-label": "单元",
|
||||
"message-1": "使用混合数\"{number}\",货币\"{currency}\",日期\"{date}\",相对时间\"{relativeTime}\"和单元\"{unit}\"的消息的例子。",
|
||||
"message-2": [
|
||||
"与多元化支持消息的例子:",
|
||||
"{count, plural,",
|
||||
" other {你有#剩下的任务}",
|
||||
"}."
|
||||
]
|
||||
}
|
||||
}
|
||||
17
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/package.json
vendored
Normal file
17
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/package.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"cldr-data": ">=25",
|
||||
"globalize": "^1.3.0",
|
||||
"globalize-webpack-plugin": "^2.1.0",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"iana-tz-data": "^2017.1.0",
|
||||
"webpack": "^3.11.0",
|
||||
"webpack-dev-server": "^2.11.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "webpack-dev-server --config webpack-config.js --hot --progress --colors --inline",
|
||||
"build": "NODE_ENV=production webpack --config webpack-config.js"
|
||||
},
|
||||
"cldr-data-urls-filter": "(core|dates|numbers|units)"
|
||||
}
|
||||
63
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/webpack-config.js
vendored
Normal file
63
EveryThing/wwwroot/vendor/libs/globalize/examples/app-npm-webpack/webpack-config.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
var webpack = require( "webpack" );
|
||||
var path = require("path");
|
||||
var CommonsChunkPlugin = require( "webpack/lib/optimize/CommonsChunkPlugin" );
|
||||
var HtmlWebpackPlugin = require( "html-webpack-plugin" );
|
||||
var GlobalizePlugin = require( "globalize-webpack-plugin" );
|
||||
|
||||
var production = process.env.NODE_ENV === "production";
|
||||
var globalizeCompiledDataRegex = new RegExp( /^(globalize\-compiled\-data)\-\S+$/ );
|
||||
|
||||
function subLocaleNames( name ) {
|
||||
return name.replace( globalizeCompiledDataRegex, "$1" );
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
main: "./app/index.js",
|
||||
},
|
||||
output: {
|
||||
path: path.join( __dirname, production ? "./dist" : "./tmp" ),
|
||||
publicPath: production ? "" : "http://localhost:8080/",
|
||||
chunkFilename: "[name].[chunkhash].js",
|
||||
filename: production ? "[name].[chunkhash].js" : "app.js"
|
||||
},
|
||||
resolve: {
|
||||
extensions: [ "*", ".js" ]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: "./index-template.html",
|
||||
// filter to a single compiled globalize language
|
||||
// change 'en' to language of choice or remove inject all languages
|
||||
// NOTE: last language will be set language
|
||||
chunks: [ "vendor", "globalize-compiled-data-en", "main" ],
|
||||
chunksSortMode: function ( c1, c2 ) {
|
||||
var orderedChunks = [ "vendor", "globalize-compiled-data", "main" ];
|
||||
var o1 = orderedChunks.indexOf( subLocaleNames( c1.names[ 0 ]));
|
||||
var o2 = orderedChunks.indexOf( subLocaleNames( c2.names[ 0 ]));
|
||||
return o1 - o2;
|
||||
},
|
||||
}),
|
||||
new GlobalizePlugin({
|
||||
production: production,
|
||||
developmentLocale: "en",
|
||||
supportedLocales: [ "ar", "de", "en", "es", "pt", "ru", "zh" ],
|
||||
messages: "messages/[locale].json",
|
||||
output: "i18n/[locale].[chunkhash].js"
|
||||
})
|
||||
].concat( production ? [
|
||||
new CommonsChunkPlugin({
|
||||
name: "vendor",
|
||||
minChunks: function(module) {
|
||||
return (
|
||||
module.context && module.context.indexOf("node_modules") !== -1
|
||||
);
|
||||
}
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
})
|
||||
] : [] )
|
||||
};
|
||||
1
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/.npmignore
vendored
Normal file
1
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/.npmignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
compiled-formatters.js
|
||||
45
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/README.md
vendored
Normal file
45
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/README.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Basic Globalize Compiler example
|
||||
|
||||
This example focuses on the Globalize Compiler and the Globalize runtime
|
||||
modules. It assumes knowledge of Globalize usage basics.
|
||||
|
||||
## Requirements
|
||||
|
||||
**1. Install Globalize dependencies and Globalize Compiler**
|
||||
|
||||
This example uses `npm` to download Globalize dependencies (i.e., CLDR data and
|
||||
the Cldrjs library) and the [Globalize Compiler][].
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
[Globalize Compiler]: https://github.com/globalizejs/globalize-compiler
|
||||
|
||||
## Running the example
|
||||
|
||||
### Development mode
|
||||
|
||||
1. Start a server by running `python -m SimpleHTTPServer` or other alternative
|
||||
servers such as [http-server][], [nginx][], [apache][].
|
||||
1. Point your browser at `http://localhost:8000/development.html`. Note that the
|
||||
formatters are created dynamically. Therefore, Cldrjs and CLDR data are
|
||||
required.
|
||||
1. Understand the demo by reading the source code. We have comments there for
|
||||
you.
|
||||
|
||||
[http-server]: https://github.com/nodeapps/http-server
|
||||
[nginx]: http://nginx.org/en/docs/
|
||||
[apache]: http://httpd.apache.org/docs/trunk/
|
||||
|
||||
### Production mode
|
||||
|
||||
1. Compile the application formatters by running `npm run build`. See
|
||||
`package.json` to understand the actual shell command that is used. For more
|
||||
information about the compiler, see the [Globalize Compiler documentation][].
|
||||
1. Point your browser at `./production.html`. Note that we don't need Cldrjs nor
|
||||
CLDR data in production here.
|
||||
1. Understand the demo by reading the source code. We have comments there for
|
||||
you.
|
||||
|
||||
[Globalize Compiler documentation]: https://github.com/globalizejs/globalize-compiler#README
|
||||
58
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/app.js
vendored
Normal file
58
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/app.js
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
var like, number;
|
||||
|
||||
// Use Globalize to format dates.
|
||||
document.getElementById( "date" ).textContent = Globalize.formatDate( new Date(), {
|
||||
datetime: "medium"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates on specific time zone.
|
||||
document.getElementById( "zonedDate" ).textContent = Globalize.formatDate( new Date(), {
|
||||
datetime: "full",
|
||||
timeZone: "America/Sao_Paulo"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates to parts.
|
||||
document.getElementById( "dateToParts" ).innerHTML = Globalize.formatDateToParts( new Date(), {
|
||||
datetime: "medium"
|
||||
}).map(function( part ) {
|
||||
switch(part.type) {
|
||||
case "month": return "<strong>" + part.value + "</strong>";
|
||||
default: return part.value;
|
||||
}
|
||||
}).reduce(function( memo, value ) {
|
||||
return memo + value;
|
||||
});
|
||||
|
||||
// Use Globalize to format numbers.
|
||||
number = Globalize.numberFormatter();
|
||||
document.getElementById( "number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "number-compact" ).textContent = Globalize.formatNumber( 12345.6789, {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
// Use Globalize to format currencies.
|
||||
document.getElementById( "currency" ).textContent = Globalize.formatCurrency( 69900, "USD" );
|
||||
|
||||
// Use Globalize to get the plural form of a numeric value.
|
||||
document.getElementById( "plural-number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "plural-form" ).textContent = Globalize.plural( 12345.6789 );
|
||||
|
||||
// Use Globalize to format a message with plural inflection.
|
||||
like = Globalize.messageFormatter( "like" );
|
||||
document.getElementById( "message-0" ).textContent = like( 0 );
|
||||
document.getElementById( "message-1" ).textContent = like( 1 );
|
||||
document.getElementById( "message-2" ).textContent = like( 2 );
|
||||
document.getElementById( "message-3" ).textContent = like( 3 );
|
||||
|
||||
// Use Globalize to format a relative time.
|
||||
document.getElementById( "relative-time" ).textContent = Globalize.formatRelativeTime( -35, "second" );
|
||||
|
||||
// Use Globalize to format a unit.
|
||||
document.getElementById( "unit" ).textContent = Globalize.formatUnit( 60, "mile/hour", {
|
||||
form: "short"
|
||||
});
|
||||
|
||||
document.getElementById( "requirements" ).style.display = "none";
|
||||
document.getElementById( "demo" ).style.display = "block";
|
||||
121
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/development.html
vendored
Normal file
121
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/development.html
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Basic Globalize Compiler example (development mode)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Globalize Compiler example (development mode)</h1>
|
||||
|
||||
<div id="requirements">
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>Read README.md for instructions.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="demo" style="display: none">
|
||||
<h2>Demo output</h2>
|
||||
<p>Now: <span id="date"></span></p>
|
||||
<p>Now: <span id="dateToParts"></span> (note the highlighted month, the markup was added using formatDateToParts)</p>
|
||||
<p>Now (in America/Sao_Paulo): <span id="zonedDate"></span></p>
|
||||
<p>A number: <span id="number"></span></p>
|
||||
<p>A number (compact form): <span id="number-compact"></span></p>
|
||||
<p>A currency: <span id="currency"></span></p>
|
||||
<p>Plural form of <span id="plural-number"></span> is <span id="plural-form"></span></p>
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
<li><span id="message-0"></span></li>
|
||||
<li><span id="message-1"></span></li>
|
||||
<li><span id="message-2"></span></li>
|
||||
<li><span id="message-3"></span></li>
|
||||
</ul>
|
||||
<p>Something happened: <span id="relative-time"></span></p>
|
||||
<p>Speed limit: <span id="unit"></span></p>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
First, we load Globalize's dependencies (`cldrjs` and its supplemental
|
||||
module).
|
||||
-->
|
||||
<script src="node_modules/globalize/node_modules/cldrjs/dist/cldr.js"></script>
|
||||
<script src="node_modules/globalize/node_modules/cldrjs/dist/cldr/event.js"></script>
|
||||
<script src="node_modules/globalize/node_modules/cldrjs/dist/cldr/supplemental.js"></script>
|
||||
<!--
|
||||
npm@3 installs flat by default differently from npm@1 and npm@2, so either
|
||||
the below or the above will work. Don't do this at your application, pick
|
||||
one.
|
||||
-->
|
||||
<script src="node_modules/cldrjs/dist/cldr.js"></script>
|
||||
<script src="node_modules/cldrjs/dist/cldr/event.js"></script>
|
||||
<script src="node_modules/cldrjs/dist/cldr/supplemental.js"></script>
|
||||
|
||||
<!--
|
||||
Next, we load Globalize and its modules. Note they are already available on
|
||||
this repository. If it's not, read Usage on Getting Started on the root's
|
||||
README.md.
|
||||
-->
|
||||
<script src="node_modules/globalize/dist/globalize.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize/message.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize/number.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize/plural.js"></script>
|
||||
|
||||
<!-- Load after globalize/number.js -->
|
||||
<script src="node_modules/globalize/dist/globalize/date.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize/currency.js"></script>
|
||||
|
||||
<!-- Load after globalize/number.js and globalize/plural.js-->
|
||||
<script src="node_modules/globalize/dist/globalize/relative-time.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize/unit.js"></script>
|
||||
|
||||
<!-- Load jQuery to fetch the CLDR and message JSONs -->
|
||||
<script src="node_modules/jquery/dist/jquery.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
// At this point, we have Globalize loaded. But, before we can use it, we
|
||||
// need to feed it on the appropriate I18n content (Unicode CLDR). In order
|
||||
// to do so, we use `Globalize.load()` and pass the content. On this demo,
|
||||
// we made the things a little easier for you: we've embedded static JSON
|
||||
// into the demo. So, you don't need to actually fetch it elsewhere.
|
||||
$.when(
|
||||
$.getJSON( "node_modules/cldr-data/main/en/ca-gregorian.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/main/en/currencies.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/main/en/dateFields.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/main/en/numbers.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/main/en/timeZoneNames.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/main/en/units.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/supplemental/currencyData.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/supplemental/likelySubtags.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/supplemental/metaZones.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/supplemental/plurals.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/supplemental/timeData.json" ),
|
||||
$.getJSON( "node_modules/cldr-data/supplemental/weekData.json" ),
|
||||
$.getJSON( "messages.json" ),
|
||||
$.getJSON( "node_modules/iana-tz-data/iana-tz-data.json" )
|
||||
).then(function( enCaGregorian, enCurrencies, enDateFields, enNumbers, enTimeZoneNames, enUnits,
|
||||
currencyData, likelySubtags, metaZones, plurals, timeData, weekData, messages, ianaTzData ) {
|
||||
|
||||
Globalize.load( enCaGregorian[ 0 ] );
|
||||
Globalize.load( enCurrencies[ 0 ] );
|
||||
Globalize.load( enDateFields[ 0 ] );
|
||||
Globalize.load( enNumbers[ 0 ] );
|
||||
Globalize.load( enTimeZoneNames[ 0 ] );
|
||||
Globalize.load( enUnits[ 0 ] );
|
||||
Globalize.load( currencyData[ 0 ] );
|
||||
Globalize.load( likelySubtags[ 0 ] );
|
||||
Globalize.load( metaZones[ 0 ] );
|
||||
Globalize.load( plurals[ 0 ] );
|
||||
Globalize.load( timeData[ 0 ] );
|
||||
Globalize.load( weekData[ 0 ] );
|
||||
Globalize.loadMessages( messages[ 0 ] );
|
||||
Globalize.loadTimeZone( ianaTzData[ 0 ] );
|
||||
Globalize.locale("en");
|
||||
|
||||
// Load and execute our App.
|
||||
$.getScript( "app.js" );
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
12
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/messages.json
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/messages.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"en": {
|
||||
"like": [
|
||||
"{0, plural, offset:1",
|
||||
" =0 {Be the first to like this}",
|
||||
" =1 {You liked this}",
|
||||
" one {You and someone else liked this}",
|
||||
" other {You and # others liked this}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
15
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/package.json
vendored
Normal file
15
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "basic-globalize-compiler",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "globalize-compiler -l en -m messages.json -o compiled-formatters.js app.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cldr-data": ">=25",
|
||||
"globalize": "^1.5.0",
|
||||
"globalize-compiler": "^1.1.1",
|
||||
"iana-tz-data": "^2017.1.0",
|
||||
"jquery": "latest"
|
||||
},
|
||||
"cldr-data-urls-filter": "(core|dates|numbers|units)"
|
||||
}
|
||||
75
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/production.html
vendored
Normal file
75
EveryThing/wwwroot/vendor/libs/globalize/examples/globalize-compiler/production.html
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Basic Globalize Compiler example (production mode)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Globalize Compiler example (production mode)</h1>
|
||||
|
||||
<div id="requirements">
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>You need to build the `compiled-formatters.js`. Read README.md for instructions.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="demo" style="display: none">
|
||||
<h2>Demo output</h2>
|
||||
<p>Now: <span id="date"></span></p>
|
||||
<p>Now: <span id="dateToParts"></span> (note the highlighted month, the markup was added using formatDateToParts)</p>
|
||||
<p>Now (in America/Sao_Paulo): <span id="zonedDate"></span></p>
|
||||
<p>A number: <span id="number"></span></p>
|
||||
<p>A number (compact form): <span id="number-compact"></span></p>
|
||||
<p>A currency: <span id="currency"></span></p>
|
||||
<p>Plural form of <span id="plural-number"></span> is <span id="plural-form"></span></p>
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
<li><span id="message-0"></span></li>
|
||||
<li><span id="message-1"></span></li>
|
||||
<li><span id="message-2"></span></li>
|
||||
<li><span id="message-3"></span></li>
|
||||
</ul>
|
||||
<p>Something happened: <span id="relative-time"></span></p>
|
||||
<p>Speed limit: <span id="unit"></span></p>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
Note, we don't need cldrjs library anymore because the formatters have
|
||||
already been created by the compilation step. More info below.
|
||||
-->
|
||||
|
||||
<!-- Load Globalize runtime and its runtime modules -->
|
||||
<script src="node_modules/globalize/dist/globalize-runtime.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/message.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/number.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/plural.js"></script>
|
||||
|
||||
<!-- Load after globalize-runtime/number.js -->
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/date.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/currency.js"></script>
|
||||
|
||||
<!--
|
||||
Load after globalize-runtime/number.js and globalize-runtime/plural.js
|
||||
-->
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/relative-time.js"></script>
|
||||
<script src="node_modules/globalize/dist/globalize-runtime/unit.js"></script>
|
||||
|
||||
<!--
|
||||
Then, load the compiled formatters.
|
||||
|
||||
Note, we don't need to feed Globalize on CLDR data anymore because the
|
||||
formatters have already been created by the compilation step and their
|
||||
"snapshots" are available below.
|
||||
-->
|
||||
<script src="compiled-formatters.js"></script>
|
||||
|
||||
<!-- Our App -->
|
||||
<script>
|
||||
Globalize.locale("en");
|
||||
</script>
|
||||
<script src="app.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
57
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/README.md
vendored
Normal file
57
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/README.md
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# Hello World (Node.js + npm)
|
||||
|
||||
We assume you know what [Node.js](http://nodejs.org/) and
|
||||
[npm](https://www.npmjs.org/) is.
|
||||
|
||||
The demo contains one single file:
|
||||
|
||||
```
|
||||
.
|
||||
└── main.js
|
||||
```
|
||||
|
||||
Before running it, execute the requirements below.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
**1. Install Globalize**
|
||||
|
||||
Let's use npm to download Globalize. For more information on regard of
|
||||
installation, please read [Getting Started](../../README.md#installation).
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
Then, you'll get this:
|
||||
|
||||
```
|
||||
.
|
||||
├── node_modules/
|
||||
│ ├── globalize/
|
||||
│ │ └── dist/
|
||||
│ │ ├── globalize
|
||||
│ │ │ ├── date.js
|
||||
│ │ │ └── ...
|
||||
│ │ └── globalize.js
|
||||
│ └── ...
|
||||
└── main.js
|
||||
```
|
||||
|
||||
**2. Dependencies**
|
||||
|
||||
No action needed, because npm has already handled that for us.
|
||||
|
||||
**3. CLDR content**
|
||||
|
||||
No action needed, because npm has already handled that for us. For more
|
||||
information, see [npm's cldr-data](https://github.com/rxaviers/cldr-data-npm).
|
||||
|
||||
|
||||
## Running the demo
|
||||
|
||||
Once you've completed the requirements above:
|
||||
|
||||
1. Run `node main.js`.
|
||||
1. Understand the demo by reading the source code. We have comments there for you.
|
||||
65
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/main.js
vendored
Normal file
65
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/main.js
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var like;
|
||||
var Globalize = require( "globalize" );
|
||||
|
||||
// Before we can use Globalize, we need to feed it on the appropriate I18n content (Unicode CLDR). Read Requirements on Getting Started on the root's README.md for more information.
|
||||
Globalize.load(
|
||||
require( "cldr-data/main/en/ca-gregorian" ),
|
||||
require( "cldr-data/main/en/currencies" ),
|
||||
require( "cldr-data/main/en/dateFields" ),
|
||||
require( "cldr-data/main/en/numbers" ),
|
||||
require( "cldr-data/main/en/timeZoneNames" ),
|
||||
require( "cldr-data/main/en/units" ),
|
||||
require( "cldr-data/supplemental/currencyData" ),
|
||||
require( "cldr-data/supplemental/likelySubtags" ),
|
||||
require( "cldr-data/supplemental/metaZones" ),
|
||||
require( "cldr-data/supplemental/plurals" ),
|
||||
require( "cldr-data/supplemental/timeData" ),
|
||||
require( "cldr-data/supplemental/weekData" )
|
||||
);
|
||||
Globalize.loadMessages( require( "./messages/en" ) );
|
||||
|
||||
Globalize.loadTimeZone( require( "iana-tz-data" ) );
|
||||
|
||||
// Set "en" as our default locale.
|
||||
Globalize.locale( "en" );
|
||||
|
||||
// Use Globalize to format dates.
|
||||
console.log( Globalize.formatDate( new Date(), { datetime: "medium" } ) );
|
||||
|
||||
// Use Globalize to format dates in specific time zones.
|
||||
console.log( Globalize.formatDate( new Date(), {
|
||||
datetime: "full",
|
||||
timeZone: "America/Sao_Paulo"
|
||||
}));
|
||||
|
||||
// Use Globalize to format dates to parts.
|
||||
console.log( Globalize.formatDateToParts( new Date(), { datetime: "medium" } ) );
|
||||
|
||||
// Use Globalize to format numbers.
|
||||
console.log( Globalize.formatNumber( 12345.6789 ) );
|
||||
|
||||
// Use Globalize to format numbers (compact form).
|
||||
console.log( Globalize.formatNumber( 12345.6789, {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
}));
|
||||
|
||||
// Use Globalize to format currencies.
|
||||
console.log( Globalize.formatCurrency( 69900, "USD" ) );
|
||||
|
||||
// Use Globalize to get the plural form of a numeric value.
|
||||
console.log( Globalize.plural( 12345.6789 ) );
|
||||
|
||||
// Use Globalize to format a message with plural inflection.
|
||||
like = Globalize.messageFormatter( "like" );
|
||||
console.log( like( 0 ) );
|
||||
console.log( like( 1 ) );
|
||||
console.log( like( 2 ) );
|
||||
console.log( like( 3 ) );
|
||||
|
||||
// Use Globalize to format relative time.
|
||||
console.log( Globalize.formatRelativeTime( -35, "second" ) );
|
||||
|
||||
// Use Globalize to format unit.
|
||||
console.log( Globalize.formatUnit( 60, "mile/hour", { form: "short" } ) );
|
||||
12
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/messages/en.json
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/messages/en.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"en": {
|
||||
"like": [
|
||||
"{0, plural, offset:1",
|
||||
" =0 {Be the first to like this}",
|
||||
" =1 {You liked this}",
|
||||
" one {You and someone else liked this}",
|
||||
" other {You and # others liked this}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
10
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/package.json
vendored
Normal file
10
EveryThing/wwwroot/vendor/libs/globalize/examples/node-npm/package.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "globalize-hello-world-node-npm",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"cldr-data": "latest",
|
||||
"globalize": "^1.3.0",
|
||||
"iana-tz-data": ">=2017.0.0"
|
||||
},
|
||||
"cldr-data-urls-filter": "(core|dates|numbers|units)"
|
||||
}
|
||||
2
EveryThing/wwwroot/vendor/libs/globalize/examples/plain-javascript/.npmignore
vendored
Normal file
2
EveryThing/wwwroot/vendor/libs/globalize/examples/plain-javascript/.npmignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
cldrjs/
|
||||
globalize/
|
||||
81
EveryThing/wwwroot/vendor/libs/globalize/examples/plain-javascript/README.md
vendored
Normal file
81
EveryThing/wwwroot/vendor/libs/globalize/examples/plain-javascript/README.md
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
# Hello World (plain javascript)
|
||||
|
||||
The demo contains one single file:
|
||||
|
||||
```
|
||||
.
|
||||
└── index.html
|
||||
```
|
||||
|
||||
Before running it, execute the requirements below.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
**1. Dependencies**
|
||||
|
||||
The demo requires Globalize and its dependencies. Globalize's dependencies are listed on [Getting
|
||||
Started](../../README.md#dependencies), and the only one is
|
||||
[cldrjs](https://github.com/rxaviers/cldrjs). You are free to fetch it the way you want. But, as an
|
||||
exercise of this demo, we'll download it ourselves. So:
|
||||
|
||||
1. Click at [Globalize releases tab](https://github.com/globalizejs/globalize/releases).
|
||||
1. Download the latest package.
|
||||
1. Unzip it.
|
||||
1. Rename the extracted directory `globalize` and move it alongside `index.html` and `README.md`.
|
||||
1. Click at [cldrjs releases tab](https://github.com/rxaviers/cldrjs/releases).
|
||||
1. Download the latest package.
|
||||
1. Unzip it.
|
||||
1. Rename the extracted directory `cldrjs` and move it alongside `index.html` and `README.md`.
|
||||
|
||||
Then, you'll get this:
|
||||
|
||||
```
|
||||
.
|
||||
├── cldrjs
|
||||
│ └── dist
|
||||
│ ├── cldr.js
|
||||
│ ├── ...
|
||||
│ └── cldr
|
||||
│ ├── event.js
|
||||
│ ├── supplemental.js
|
||||
│ └── ...
|
||||
├── globalize
|
||||
│ └── dist
|
||||
│ ├── globalize.js
|
||||
│ ├── ...
|
||||
│ └── globalize
|
||||
│ ├── currency.js
|
||||
│ ├── date.js
|
||||
│ └── ...
|
||||
├── index.html
|
||||
└── README.md
|
||||
```
|
||||
|
||||
For more information read [cldrjs' usage and
|
||||
installation](https://github.com/rxaviers/cldrjs#usage-and-installation) docs.
|
||||
|
||||
**2. CLDR content**
|
||||
|
||||
Another typical Globalize requirement is to fetch CLDR content yourself. But, on
|
||||
this demo we made the things a little easier for you: we've embedded static JSON
|
||||
into the demo. So, you don't need to actually fetch it anywhere. For more
|
||||
information about fetching Unicode CLDR JSON data, see [How do I get CLDR
|
||||
data?](../../doc/cldr.md).
|
||||
|
||||
No action needed here.
|
||||
|
||||
**3. Globalize `dist` files**
|
||||
|
||||
*This step only applies if you are building the source files. If you have downloaded a ZIP or a TAR.GZ or are using a package manager (such as bower or npm) to install then you can ignore this step.*
|
||||
|
||||
[Install the development external dependencies](../../README.md#install-development-external-dependencies) and [build the distribution files](../../README.md#build).
|
||||
|
||||
## Running the demo
|
||||
|
||||
Once you've completed the requirements above:
|
||||
|
||||
1. Point your browser at `./index.html`.
|
||||
1. Open your JavaScript console to see the demo output.
|
||||
1. Understand the demo by reading the source code. We have comments there for
|
||||
you.
|
||||
445
EveryThing/wwwroot/vendor/libs/globalize/examples/plain-javascript/index.html
vendored
Normal file
445
EveryThing/wwwroot/vendor/libs/globalize/examples/plain-javascript/index.html
vendored
Normal file
@@ -0,0 +1,445 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Globalize Hello World (plain javascript)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Globalize Hello World (plain javascript)</h1>
|
||||
|
||||
<div id="requirements">
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>You need to download `cldrjs` and `globalize` dependencies yourself. Read README.md for instructions.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="demo" style="display: none">
|
||||
<h2>Demo output</h2>
|
||||
<p>Now: <span id="date"></span></p>
|
||||
<p>Now: <span id="dateToParts"></span> (note the highlighted month, the markup was added using formatDateToParts)</p>
|
||||
<p>Now (in America/Sao_Paulo): <span id="zonedDate"></span></p>
|
||||
<p>A number: <span id="number"></span></p>
|
||||
<p>A number (compact form): <span id="number-compact"></span></p>
|
||||
<p>A currency: <span id="currency"></span></p>
|
||||
<p>Plural form of <span id="plural-number"></span> is <span id="plural-form"></span></p>
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
<li><span id="message-0"></span></li>
|
||||
<li><span id="message-1"></span></li>
|
||||
<li><span id="message-2"></span></li>
|
||||
<li><span id="message-3"></span></li>
|
||||
</ul>
|
||||
<p>Something happened: <span id="relative-time"></span></p>
|
||||
<p>Speed limit: <span id="unit"></span></p>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
First, we load Globalize's dependencies (`cldrjs` and its supplemental
|
||||
module).
|
||||
-->
|
||||
<script src="cldrjs/dist/cldr.js"></script>
|
||||
<script src="cldrjs/dist/cldr/event.js"></script>
|
||||
<script src="cldrjs/dist/cldr/supplemental.js"></script>
|
||||
|
||||
<!--
|
||||
Next, we load Globalize and its modules. Note they are already available on
|
||||
this repository. If it's not, read Usage on Getting Started on the root's
|
||||
README.md.
|
||||
-->
|
||||
<script src="globalize/dist/globalize.js"></script>
|
||||
<script src="globalize/dist/globalize/message.js"></script>
|
||||
<script src="globalize/dist/globalize/number.js"></script>
|
||||
<script src="globalize/dist/globalize/plural.js"></script>
|
||||
|
||||
<!-- Load after globalize/number.js -->
|
||||
<script src="globalize/dist/globalize/date.js"></script>
|
||||
<script src="globalize/dist/globalize/currency.js"></script>
|
||||
|
||||
<!-- Load after globalize/number.js and globalize/plural.js-->
|
||||
<script src="globalize/dist/globalize/relative-time.js"></script>
|
||||
<script src="globalize/dist/globalize/unit.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
// At this point, we have Globalize loaded. But, before we can use it, we
|
||||
// need to feed it on the appropriate I18n content (Unicode CLDR). In order
|
||||
// to do so, we use `Globalize.load()` and pass the content. On this demo,
|
||||
// we made the things a little easier for you: we've embedded static JSON
|
||||
// into the demo. So, you don't need to actually fetch it elsewhere.
|
||||
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": {
|
||||
"days": {
|
||||
"format": {
|
||||
"wide": {
|
||||
"sun": "Sunday",
|
||||
"mon": "Monday",
|
||||
"tue": "Tuesday",
|
||||
"wed": "Wednesday",
|
||||
"thu": "Thursday",
|
||||
"fri": "Friday",
|
||||
"sat": "Saturday"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"wide": {
|
||||
"1": "January",
|
||||
"2": "February",
|
||||
"3": "March",
|
||||
"4": "April",
|
||||
"5": "May",
|
||||
"6": "June",
|
||||
"7": "July",
|
||||
"8": "August",
|
||||
"9": "September",
|
||||
"10": "October",
|
||||
"11": "November",
|
||||
"12": "December"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dayPeriods": {
|
||||
"format": {
|
||||
"wide": {
|
||||
"am": "AM",
|
||||
"am-alt-variant": "am",
|
||||
"noon": "noon",
|
||||
"pm": "PM",
|
||||
"pm-alt-variant": "pm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dateFormats": {
|
||||
"full": "EEEE, MMMM d, y",
|
||||
"medium": "MMM d, y"
|
||||
},
|
||||
"timeFormats": {
|
||||
"full": "h:mm:ss a zzzz",
|
||||
"medium": "h:mm:ss a",
|
||||
},
|
||||
"dateTimeFormats": {
|
||||
"full": "{1} 'at' {0}",
|
||||
"medium": "{1}, {0}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fields": {
|
||||
"second": {
|
||||
"displayName": "Second",
|
||||
"relative-type-0": "now",
|
||||
"relativeTime-type-future": {
|
||||
"relativeTimePattern-count-one": "in {0} second",
|
||||
"relativeTimePattern-count-other": "in {0} seconds"
|
||||
},
|
||||
"relativeTime-type-past": {
|
||||
"relativeTimePattern-count-one": "{0} second ago",
|
||||
"relativeTimePattern-count-other": "{0} seconds ago"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeZoneNames": {
|
||||
"metazone": {
|
||||
"Brasilia": {
|
||||
"long": {
|
||||
"generic": "Brasilia Time",
|
||||
"standard": "Brasilia Standard Time",
|
||||
"daylight": "Brasilia Summer Time"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"numbers": {
|
||||
"currencies": {
|
||||
"USD": {
|
||||
"symbol": "$"
|
||||
}
|
||||
},
|
||||
"defaultNumberingSystem": "latn",
|
||||
"symbols-numberSystem-latn": {
|
||||
"decimal": ".",
|
||||
"exponential": "E",
|
||||
"group": ",",
|
||||
"infinity": "∞",
|
||||
"minusSign": "-",
|
||||
"nan": "NaN",
|
||||
"percentSign": "%",
|
||||
"perMille": "‰",
|
||||
"plusSign": "+",
|
||||
"timeSeparator": ":"
|
||||
},
|
||||
"decimalFormats-numberSystem-latn": {
|
||||
"standard": "#,##0.###",
|
||||
"short": {
|
||||
"decimalFormat": {
|
||||
"1000-count-one": "0K",
|
||||
"1000-count-other": "0K",
|
||||
"10000-count-one": "00K",
|
||||
"10000-count-other": "00K",
|
||||
"100000-count-one": "000K",
|
||||
"100000-count-other": "000K",
|
||||
"1000000-count-one": "0M",
|
||||
"1000000-count-other": "0M",
|
||||
"10000000-count-one": "00M",
|
||||
"10000000-count-other": "00M",
|
||||
"100000000-count-one": "000M",
|
||||
"100000000-count-other": "000M",
|
||||
"1000000000-count-one": "0B",
|
||||
"1000000000-count-other": "0B",
|
||||
"10000000000-count-one": "00B",
|
||||
"10000000000-count-other": "00B",
|
||||
"100000000000-count-one": "000B",
|
||||
"100000000000-count-other": "000B",
|
||||
"1000000000000-count-one": "0T",
|
||||
"1000000000000-count-other": "0T",
|
||||
"10000000000000-count-one": "00T",
|
||||
"10000000000000-count-other": "00T",
|
||||
"100000000000000-count-one": "000T",
|
||||
"100000000000000-count-other": "000T"
|
||||
}
|
||||
}
|
||||
},
|
||||
"currencyFormats-numberSystem-latn": {
|
||||
"currencySpacing": {
|
||||
"beforeCurrency": {
|
||||
"currencyMatch": "[:^S:]",
|
||||
"surroundingMatch": "[:digit:]",
|
||||
"insertBetween": " "
|
||||
},
|
||||
"afterCurrency": {
|
||||
"currencyMatch": "[:^S:]",
|
||||
"surroundingMatch": "[:digit:]",
|
||||
"insertBetween": " "
|
||||
}
|
||||
},
|
||||
"standard": "¤#,##0.00"
|
||||
}
|
||||
},
|
||||
"units": {
|
||||
"short": {
|
||||
"per": {
|
||||
"compoundUnitPattern": "{0}/{1}"
|
||||
},
|
||||
"speed-mile-per-hour": {
|
||||
"displayName": "miles/hour",
|
||||
"unitPattern-count-one": "{0} mph",
|
||||
"unitPattern-count-other": "{0} mph"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"supplemental": {
|
||||
"version": {
|
||||
"_cldrVersion": "25",
|
||||
"_number": "$Revision: 91 $"
|
||||
},
|
||||
"currencyData": {
|
||||
"fractions": {
|
||||
"DEFAULT": {
|
||||
"_rounding": "0",
|
||||
"_digits": "2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"likelySubtags": {
|
||||
"en": "en-Latn-US",
|
||||
},
|
||||
"metaZones": {
|
||||
"metazoneInfo": {
|
||||
"timezone": {
|
||||
"America": {
|
||||
"Sao_Paulo": [
|
||||
{
|
||||
"usesMetazone": {
|
||||
"_mzone": "Brasilia"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"plurals-type-cardinal": {
|
||||
"en": {
|
||||
"pluralRule-count-one": "i = 1 and v = 0 @integer 1",
|
||||
"pluralRule-count-other": " @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Globalize.loadMessages({
|
||||
"en": {
|
||||
"like": [
|
||||
"{0, plural, offset:1",
|
||||
" =0 {Be the first to like this}",
|
||||
" =1 {You liked this}",
|
||||
" one {You and someone else liked this}",
|
||||
" other {You and # others liked this}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
});
|
||||
Globalize.loadTimeZone({
|
||||
"zoneData": {
|
||||
"America": {
|
||||
"Sao_Paulo": {
|
||||
"abbrs": [
|
||||
"LMT", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
||||
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02"
|
||||
],
|
||||
"untils": [
|
||||
-1767214412000, -1206957600000, -1191362400000, -1175374800000, -1159826400000,
|
||||
-633819600000, -622069200000, -602283600000, -591832800000, -570747600000,
|
||||
-560210400000, -539125200000, -531352800000, -195426000000, -184197600000,
|
||||
-155163600000, -150069600000, -128898000000, -121125600000, -99954000000, -89589600000,
|
||||
-68418000000, -57967200000, 499748400000, 511236000000, 530593200000, 540266400000,
|
||||
562129200000, 571197600000, 592974000000, 602042400000, 624423600000, 634701600000,
|
||||
656478000000, 666756000000, 687927600000, 697600800000, 719982000000, 728445600000,
|
||||
750826800000, 761709600000, 782276400000, 793159200000, 813726000000, 824004000000,
|
||||
844570800000, 856058400000, 876106800000, 888717600000, 908074800000, 919562400000,
|
||||
938919600000, 951616800000, 970974000000, 982461600000, 1003028400000, 1013911200000,
|
||||
1036292400000, 1045360800000, 1066532400000, 1076810400000, 1099364400000,
|
||||
1108864800000, 1129431600000, 1140314400000, 1162695600000, 1172368800000,
|
||||
1192330800000, 1203213600000, 1224385200000, 1234663200000, 1255834800000,
|
||||
1266717600000, 1287284400000, 1298167200000, 1318734000000, 1330221600000,
|
||||
1350788400000, 1361066400000, 1382238000000, 1392516000000, 1413687600000,
|
||||
1424570400000, 1445137200000, 1456020000000, 1476586800000, 1487469600000,
|
||||
1508036400000, 1518919200000, 1540090800000, 1550368800000, 1571540400000,
|
||||
1581818400000, 1602990000000, 1613872800000, 1634439600000, 1645322400000,
|
||||
1665889200000, 1677376800000, 1697338800000, 1708221600000, 1729393200000,
|
||||
1739671200000, 1760842800000, 1771725600000, 1792292400000, 1803175200000,
|
||||
1823742000000, 1834624800000, 1855191600000, 1866074400000, 1887246000000,
|
||||
1897524000000, 1918695600000, 1928973600000, 1950145200000, 1960423200000,
|
||||
1981594800000, 1992477600000, 2013044400000, 2024532000000, 2044494000000,
|
||||
2055376800000, 2076548400000, 2086826400000, 2107998000000, 2118880800000,
|
||||
2139447600000, null
|
||||
],
|
||||
"offsets": [
|
||||
186.4667, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
||||
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120,
|
||||
180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
||||
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120,
|
||||
180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
||||
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120,
|
||||
180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
||||
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120
|
||||
],
|
||||
"isdsts": [
|
||||
0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
||||
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
||||
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var en, like, number;
|
||||
|
||||
// Instantiate "en".
|
||||
en = Globalize( "en" );
|
||||
|
||||
// Use Globalize to format dates.
|
||||
document.getElementById( "date" ).textContent = en.formatDate( new Date(), {
|
||||
datetime: "medium"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates on specific time zone.
|
||||
document.getElementById( "zonedDate" ).textContent = en.formatDate( new Date(), {
|
||||
datetime: "full",
|
||||
timeZone: "America/Sao_Paulo"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates to parts.
|
||||
document.getElementById( "dateToParts" ).innerHTML = en.formatDateToParts( new Date(), {
|
||||
datetime: "medium"
|
||||
}).map(function( part ) {
|
||||
switch(part.type) {
|
||||
case "month": return "<strong>" + part.value + "<\/strong>";
|
||||
default: return part.value;
|
||||
}
|
||||
}).reduce(function( memo, value ) {
|
||||
return memo + value;
|
||||
});
|
||||
|
||||
// Use Globalize to format numbers.
|
||||
number = en.numberFormatter();
|
||||
document.getElementById( "number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "number-compact" ).textContent = en.formatNumber( 12345.6789, {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
// Use Globalize to format currencies.
|
||||
document.getElementById( "currency" ).textContent = en.formatCurrency( 69900, "USD" );
|
||||
|
||||
// Use Globalize to get the plural form of a numeric value.
|
||||
document.getElementById( "plural-number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "plural-form" ).textContent = en.plural( 12345.6789 );
|
||||
|
||||
// Use Globalize to format a message with plural inflection.
|
||||
like = en.messageFormatter( "like" );
|
||||
document.getElementById( "message-0" ).textContent = like( 0 );
|
||||
document.getElementById( "message-1" ).textContent = like( 1 );
|
||||
document.getElementById( "message-2" ).textContent = like( 2 );
|
||||
document.getElementById( "message-3" ).textContent = like( 3 );
|
||||
|
||||
// Use Globalize to format a relative time.
|
||||
document.getElementById( "relative-time" ).textContent = en.formatRelativeTime( -35, "second" );
|
||||
|
||||
// Use Globalize to format a unit.
|
||||
document.getElementById( "unit" ).textContent = en.formatUnit( 60, "mile/hour", {
|
||||
form: "short"
|
||||
});
|
||||
|
||||
document.getElementById( "requirements" ).style.display = "none";
|
||||
document.getElementById( "demo" ).style.display = "block";
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
134
EveryThing/wwwroot/vendor/libs/globalize/package.json
vendored
Normal file
134
EveryThing/wwwroot/vendor/libs/globalize/package.json
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"_from": "globalize@~1.7.0",
|
||||
"_id": "globalize@1.7.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-faR46vTIbFCeAemyuc9E6/d7Wrx9k2ae2L60UhakztFg6VuE42gENVJNuPFtt7Sdjrk9m2w8+py7Jj+JTNy59w==",
|
||||
"_location": "/globalize",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "globalize@~1.7.0",
|
||||
"name": "globalize",
|
||||
"escapedName": "globalize",
|
||||
"rawSpec": "~1.7.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.7.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/globalize/-/globalize-1.7.0.tgz",
|
||||
"_shasum": "321201eb18ded16d3f03c8d4ddbcb5d1edd6d4c2",
|
||||
"_spec": "globalize@~1.7.0",
|
||||
"_where": "D:\\EveryThing\\EveryThing\\EveryThing",
|
||||
"author": {
|
||||
"name": "OpenJS Foundation and other contributors",
|
||||
"url": "https://github.com/globalizejs/globalize/blob/master/AUTHORS.txt"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/globalizejs/globalize/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitplease": {
|
||||
"nohook": true
|
||||
},
|
||||
"dependencies": {
|
||||
"cldrjs": "^0.5.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data.",
|
||||
"devDependencies": {
|
||||
"cldr-data-downloader": "^0.3.1",
|
||||
"eslint-config-jquery": "3.0.0",
|
||||
"glob": "^7.1.2",
|
||||
"globalize-compiler": "^1.1.1",
|
||||
"grunt": "1.2.0",
|
||||
"grunt-check-dependencies": "1.0.0",
|
||||
"grunt-commitplease": "0.0.6",
|
||||
"grunt-compare-size": "0.4.2",
|
||||
"grunt-contrib-clean": "1.1.0",
|
||||
"grunt-contrib-connect": "0.8.0",
|
||||
"grunt-contrib-copy": "1.0.0",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
"grunt-contrib-requirejs": "1.0.0",
|
||||
"grunt-contrib-uglify": "3.0.1",
|
||||
"grunt-contrib-watch": "1.0.0",
|
||||
"grunt-eslint": "23.0.0",
|
||||
"grunt-git-authors": "^3.2.0",
|
||||
"grunt-mocha-test": "^0.13.2",
|
||||
"gzip-js": "0.3.2",
|
||||
"iana-tz-data": ">=2017.0.0",
|
||||
"matchdep": "1.0.1",
|
||||
"mocha": "^3.4.2",
|
||||
"qunit": "2.12.0",
|
||||
"semver": "^5.3.0",
|
||||
"zoned-date-time": "1.1.0"
|
||||
},
|
||||
"files": [
|
||||
"CONTRIBUTING.md",
|
||||
"dist/",
|
||||
"!dist/.build",
|
||||
"doc/",
|
||||
"examples/",
|
||||
"!examples/**/.tmp-globalize-webpack",
|
||||
"!examples/**/bower_components",
|
||||
"!examples/**/node_modules",
|
||||
"!examples/plain-javascript/cldrjs",
|
||||
"!examples/plain-javascript/globalize",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/globalizejs/globalize",
|
||||
"keywords": [
|
||||
"utility",
|
||||
"globalization",
|
||||
"internationalization",
|
||||
"multilingualization",
|
||||
"localization",
|
||||
"g11n",
|
||||
"i18n",
|
||||
"m17n",
|
||||
"L10n",
|
||||
"localize",
|
||||
"format",
|
||||
"parse",
|
||||
"translate",
|
||||
"strings",
|
||||
"numbers",
|
||||
"dates",
|
||||
"times",
|
||||
"calendars",
|
||||
"plural",
|
||||
"plurals",
|
||||
"pluralize",
|
||||
"cultures",
|
||||
"languages",
|
||||
"locales",
|
||||
"Unicode",
|
||||
"CLDR",
|
||||
"JSON"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./dist/node-main.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Jörn Zaefferer",
|
||||
"email": "joern.zaefferer@gmail.com",
|
||||
"url": "http://bassistance.de"
|
||||
},
|
||||
{
|
||||
"name": "Rafael Xavier de Souza",
|
||||
"email": "rxaviers@gmail.com",
|
||||
"url": "http://rafael.xavier.blog.br"
|
||||
}
|
||||
],
|
||||
"name": "globalize",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/globalizejs/globalize.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt"
|
||||
},
|
||||
"version": "1.7.0"
|
||||
}
|
||||
Reference in New Issue
Block a user