globalize-rpk 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +5 -0
- package/README.md +818 -0
- package/{globalize → dist/globalize}/currency.js +3 -3
- package/{globalize → dist/globalize}/date.js +3 -3
- package/{globalize → dist/globalize}/message.js +2 -2
- package/{globalize → dist/globalize}/number.js +3 -3
- package/{globalize → dist/globalize}/plural.js +3 -3
- package/{globalize → dist/globalize}/relative-time.js +3 -3
- package/{globalize → dist/globalize}/unit.js +0 -0
- package/dist/globalize-runtime/currency.js +183 -0
- package/dist/globalize-runtime/date.js +1657 -0
- package/dist/globalize-runtime/message.js +120 -0
- package/dist/globalize-runtime/number.js +919 -0
- package/dist/globalize-runtime/plural.js +90 -0
- package/dist/globalize-runtime/relative-time.js +120 -0
- package/dist/globalize-runtime/unit.js +132 -0
- package/{globalize → dist}/globalize-runtime.js +0 -0
- package/{globalize → dist}/globalize.js +2 -2
- package/{node-main.js → dist/node-main.js} +0 -0
- package/doc/api/core/constructor.md +28 -0
- package/doc/api/core/load.md +96 -0
- package/doc/api/core/locale.md +43 -0
- package/doc/api/currency/currency-formatter.md +196 -0
- package/doc/api/currency/currency-to-parts-formatter.md +117 -0
- package/doc/api/date/date-formatter.md +203 -0
- package/doc/api/date/date-parser.md +60 -0
- package/doc/api/date/date-to-parts-formatter.md +176 -0
- package/doc/api/date/load-iana-time-zone.md +29 -0
- package/doc/api/message/load-messages.md +105 -0
- package/doc/api/message/message-formatter.md +208 -0
- package/doc/api/number/number-formatter.md +202 -0
- package/doc/api/number/number-parser.md +130 -0
- package/doc/api/number/number-to-parts-formatter.md +140 -0
- package/doc/api/plural/plural-generator.md +84 -0
- package/doc/api/relative-time/relative-time-formatter.md +60 -0
- package/doc/api/unit/unit-formatter.md +72 -0
- package/doc/blog-post/2017-07-xx-1.3.0-announcement.md +177 -0
- package/doc/cldr.md +114 -0
- package/doc/error/e-default-locale-not-defined.md +9 -0
- package/doc/error/e-invalid-cldr.md +14 -0
- package/doc/error/e-invalid-par-type.md +12 -0
- package/doc/error/e-invalid-par-value.md +11 -0
- package/doc/error/e-missing-cldr.md +11 -0
- package/doc/error/e-missing-parameter.md +10 -0
- package/doc/error/e-missing-plural-module.md +9 -0
- package/doc/error/e-par-missing-key.md +11 -0
- package/doc/error/e-par-out-of-range.md +13 -0
- package/doc/error/e-unsupported.md +10 -0
- package/doc/migrating-from-0.x.md +64 -0
- package/examples/amd-bower/.bowerrc +7 -0
- package/examples/amd-bower/README.md +65 -0
- package/examples/amd-bower/bower.json +13 -0
- package/examples/amd-bower/index.html +46 -0
- package/examples/amd-bower/main.js +141 -0
- package/examples/amd-bower/messages/en.json +12 -0
- package/examples/amd-bower/package.json +14 -0
- package/examples/app-npm-webpack/README.md +74 -0
- package/examples/app-npm-webpack/app/index.js +89 -0
- package/examples/app-npm-webpack/index-template.html +71 -0
- package/examples/app-npm-webpack/messages/ar.json +25 -0
- package/examples/app-npm-webpack/messages/de.json +21 -0
- package/examples/app-npm-webpack/messages/en.json +21 -0
- package/examples/app-npm-webpack/messages/es.json +21 -0
- package/examples/app-npm-webpack/messages/pt.json +21 -0
- package/examples/app-npm-webpack/messages/ru.json +23 -0
- package/examples/app-npm-webpack/messages/zh.json +20 -0
- package/examples/app-npm-webpack/package.json +17 -0
- package/examples/app-npm-webpack/webpack-config.js +63 -0
- package/examples/globalize-compiler/README.md +45 -0
- package/examples/globalize-compiler/app.js +58 -0
- package/examples/globalize-compiler/development.html +121 -0
- package/examples/globalize-compiler/messages.json +12 -0
- package/examples/globalize-compiler/package.json +15 -0
- package/examples/globalize-compiler/production.html +75 -0
- package/examples/node-npm/README.md +57 -0
- package/examples/node-npm/main.js +65 -0
- package/examples/node-npm/messages/en.json +12 -0
- package/examples/node-npm/package.json +10 -0
- package/examples/plain-javascript/README.md +81 -0
- package/examples/plain-javascript/index.html +445 -0
- package/package.json +27 -4
@@ -0,0 +1,120 @@
|
|
1
|
+
/**
|
2
|
+
* Globalize Runtime v1.7.0
|
3
|
+
*
|
4
|
+
* https://github.com/globalizejs/globalize
|
5
|
+
*
|
6
|
+
* Copyright OpenJS Foundation and other contributors
|
7
|
+
* Released under the MIT license
|
8
|
+
* https://jquery.org/license
|
9
|
+
*
|
10
|
+
* Date: 2021-08-02T11:53Z
|
11
|
+
*/
|
12
|
+
/*!
|
13
|
+
* Globalize Runtime v1.7.0 2021-08-02T11:53Z Released under the MIT license
|
14
|
+
* http://git.io/TrdQbw
|
15
|
+
*/
|
16
|
+
(function( root, factory ) {
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
// UMD returnExports
|
21
|
+
if ( typeof define === "function" && define.amd ) {
|
22
|
+
|
23
|
+
// AMD
|
24
|
+
define([
|
25
|
+
"../globalize-runtime"
|
26
|
+
], factory );
|
27
|
+
} else if ( typeof exports === "object" ) {
|
28
|
+
|
29
|
+
// Node, CommonJS
|
30
|
+
module.exports = factory( require( "../globalize-runtime" ) );
|
31
|
+
} else {
|
32
|
+
|
33
|
+
// Extend global
|
34
|
+
factory( root.Globalize );
|
35
|
+
}
|
36
|
+
}(this, function( Globalize ) {
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
var runtimeKey = Globalize._runtimeKey,
|
41
|
+
validateParameterType = Globalize._validateParameterType;
|
42
|
+
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Function inspired by jQuery Core, but reduced to our use case.
|
46
|
+
*/
|
47
|
+
var isPlainObject = function( obj ) {
|
48
|
+
return obj !== null && "" + obj === "[object Object]";
|
49
|
+
};
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
var validateParameterTypeMessageVariables = function( value, name ) {
|
55
|
+
validateParameterType(
|
56
|
+
value,
|
57
|
+
name,
|
58
|
+
value === undefined || isPlainObject( value ) || Array.isArray( value ),
|
59
|
+
"Array or Plain Object"
|
60
|
+
);
|
61
|
+
};
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
var messageFormatterFn = function( formatter ) {
|
67
|
+
return function messageFormatter( variables ) {
|
68
|
+
if ( typeof variables === "number" || typeof variables === "string" ) {
|
69
|
+
variables = [].slice.call( arguments, 0 );
|
70
|
+
}
|
71
|
+
validateParameterTypeMessageVariables( variables, "variables" );
|
72
|
+
return formatter( variables );
|
73
|
+
};
|
74
|
+
};
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
Globalize._messageFormatterFn = messageFormatterFn;
|
80
|
+
/* eslint-disable */
|
81
|
+
Globalize._messageFormat = (function() {
|
82
|
+
var number = function(value, offset) {
|
83
|
+
if (isNaN(value)) throw new Error("'" + value + "' isn't a number.");
|
84
|
+
return value - (offset || 0);
|
85
|
+
};
|
86
|
+
var plural = function(value, offset, lcfunc, data, isOrdinal) {
|
87
|
+
if ({}.hasOwnProperty.call(data, value)) return data[value]();
|
88
|
+
if (offset) value -= offset;
|
89
|
+
var key = lcfunc(value, isOrdinal);
|
90
|
+
if (key in data) return data[key]();
|
91
|
+
return data.other();
|
92
|
+
};
|
93
|
+
var select = function(value, data) {
|
94
|
+
if ({}.hasOwnProperty.call(data, value)) return data[value]();
|
95
|
+
return data.other()
|
96
|
+
};
|
97
|
+
|
98
|
+
return {number: number, plural: plural, select: select};
|
99
|
+
}());
|
100
|
+
/* eslint-enable */
|
101
|
+
Globalize._validateParameterTypeMessageVariables = validateParameterTypeMessageVariables;
|
102
|
+
|
103
|
+
Globalize.messageFormatter =
|
104
|
+
Globalize.prototype.messageFormatter = function( /* path */ ) {
|
105
|
+
return Globalize[
|
106
|
+
runtimeKey( "messageFormatter", this._locale, [].slice.call( arguments, 0 ) )
|
107
|
+
];
|
108
|
+
};
|
109
|
+
|
110
|
+
Globalize.formatMessage =
|
111
|
+
Globalize.prototype.formatMessage = function( path /* , variables */ ) {
|
112
|
+
return this.messageFormatter( path ).apply( {}, [].slice.call( arguments, 1 ) );
|
113
|
+
};
|
114
|
+
|
115
|
+
return Globalize;
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
}));
|