generaltranslation 2.0.58 → 2.0.60
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/dist/format/_format.js
CHANGED
|
@@ -11,9 +11,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
14
|
+
exports._formatNum = _formatNum;
|
|
15
|
+
exports._formatDateTime = _formatDateTime;
|
|
16
|
+
exports._formatCurrency = _formatCurrency;
|
|
17
17
|
/**
|
|
18
18
|
* Formats a number according to the specified languages and options.
|
|
19
19
|
*
|
|
@@ -25,7 +25,7 @@ exports._currency = _currency;
|
|
|
25
25
|
* @returns {string} The formatted number.
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
28
|
-
function
|
|
28
|
+
function _formatNum(_a) {
|
|
29
29
|
var value = _a.value, _b = _a.languages, languages = _b === void 0 ? ['en'] : _b, _c = _a.options, options = _c === void 0 ? {} : _c;
|
|
30
30
|
return new Intl.NumberFormat(languages, __assign({ numberingSystem: 'latn' }, options)).format(value);
|
|
31
31
|
}
|
|
@@ -40,7 +40,7 @@ function _num(_a) {
|
|
|
40
40
|
* @returns {string} The formatted date.
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
|
-
function
|
|
43
|
+
function _formatDateTime(_a) {
|
|
44
44
|
var value = _a.value, _b = _a.languages, languages = _b === void 0 ? ['en'] : _b, _c = _a.options, options = _c === void 0 ? {} : _c;
|
|
45
45
|
return new Intl.DateTimeFormat(languages, __assign({ calendar: "gregory", numberingSystem: "latn" }, options)).format(value);
|
|
46
46
|
}
|
|
@@ -56,7 +56,7 @@ function _datetime(_a) {
|
|
|
56
56
|
* @returns {string} The formatted currency value.
|
|
57
57
|
* @internal
|
|
58
58
|
*/
|
|
59
|
-
function
|
|
59
|
+
function _formatCurrency(_a) {
|
|
60
60
|
var value = _a.value, _b = _a.languages, languages = _b === void 0 ? ['en'] : _b, _c = _a.currency, currency = _c === void 0 ? 'USD' : _c, _d = _a.options, options = _d === void 0 ? {} : _d;
|
|
61
61
|
return new Intl.NumberFormat(languages, __assign({ style: 'currency', currency: currency, numberingSystem: 'latn' }, options)).format(value);
|
|
62
62
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -151,7 +151,7 @@ export declare function isSameLanguage(...codes: string[]): boolean;
|
|
|
151
151
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for number formatting.
|
|
152
152
|
* @returns {string} The formatted number.
|
|
153
153
|
*/
|
|
154
|
-
export declare function
|
|
154
|
+
export declare function formatNum({ value, languages, options }: {
|
|
155
155
|
value: number;
|
|
156
156
|
languages?: string | string[];
|
|
157
157
|
options?: Intl.NumberFormatOptions;
|
|
@@ -164,7 +164,7 @@ export declare function num({ value, languages, options }: {
|
|
|
164
164
|
* @param {Intl.DateTimeFormatOptions} [params.options={}] - Additional options for date formatting.
|
|
165
165
|
* @returns {string} The formatted date.
|
|
166
166
|
*/
|
|
167
|
-
export declare function
|
|
167
|
+
export declare function formatDateTime({ value, languages, options }: {
|
|
168
168
|
value: Date;
|
|
169
169
|
languages?: string | string[];
|
|
170
170
|
options?: Intl.DateTimeFormatOptions;
|
|
@@ -178,7 +178,7 @@ export declare function datetime({ value, languages, options }: {
|
|
|
178
178
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
|
|
179
179
|
* @returns {string} The formatted currency value.
|
|
180
180
|
*/
|
|
181
|
-
export declare function
|
|
181
|
+
export declare function formatCurrency({ value, languages, currency, options }: {
|
|
182
182
|
value: number;
|
|
183
183
|
languages?: string | string[];
|
|
184
184
|
currency?: string;
|
package/dist/index.js
CHANGED
|
@@ -57,9 +57,9 @@ exports.getLanguageObject = getLanguageObject;
|
|
|
57
57
|
exports.getLanguageCode = getLanguageCode;
|
|
58
58
|
exports.getLanguageName = getLanguageName;
|
|
59
59
|
exports.isSameLanguage = isSameLanguage;
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
60
|
+
exports.formatNum = formatNum;
|
|
61
|
+
exports.formatDateTime = formatDateTime;
|
|
62
|
+
exports.formatCurrency = formatCurrency;
|
|
63
63
|
// ----- IMPORTS ----- //
|
|
64
64
|
var codes_1 = require("./codes/codes");
|
|
65
65
|
var getLanguageDirection_1 = __importDefault(require("./codes/getLanguageDirection"));
|
|
@@ -224,9 +224,9 @@ function isSameLanguage() {
|
|
|
224
224
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for number formatting.
|
|
225
225
|
* @returns {string} The formatted number.
|
|
226
226
|
*/
|
|
227
|
-
function
|
|
227
|
+
function formatNum(_a) {
|
|
228
228
|
var value = _a.value, languages = _a.languages, options = _a.options;
|
|
229
|
-
return (0, _format_1.
|
|
229
|
+
return (0, _format_1._formatNum)({ value: value, languages: languages, options: options });
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
232
|
* Formats a date according to the specified languages and options.
|
|
@@ -236,9 +236,9 @@ function num(_a) {
|
|
|
236
236
|
* @param {Intl.DateTimeFormatOptions} [params.options={}] - Additional options for date formatting.
|
|
237
237
|
* @returns {string} The formatted date.
|
|
238
238
|
*/
|
|
239
|
-
function
|
|
239
|
+
function formatDateTime(_a) {
|
|
240
240
|
var value = _a.value, languages = _a.languages, options = _a.options;
|
|
241
|
-
return (0, _format_1.
|
|
241
|
+
return (0, _format_1._formatDateTime)({ value: value, languages: languages, options: options });
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* Formats a currency value according to the specified languages, currency, and options.
|
|
@@ -249,7 +249,7 @@ function datetime(_a) {
|
|
|
249
249
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
|
|
250
250
|
* @returns {string} The formatted currency value.
|
|
251
251
|
*/
|
|
252
|
-
function
|
|
252
|
+
function formatCurrency(_a) {
|
|
253
253
|
var value = _a.value, languages = _a.languages, currency = _a.currency, options = _a.options;
|
|
254
|
-
return (0, _format_1.
|
|
254
|
+
return (0, _format_1._formatCurrency)({ value: value, languages: languages, currency: currency, options: options });
|
|
255
255
|
}
|