generaltranslation 2.0.57 → 2.0.59
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/format/_format.js +6 -6
- package/dist/index.d.ts +16 -4
- package/dist/index.js +16 -4
- package/package.json +1 -1
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
@@ -1,7 +1,6 @@
|
|
1
1
|
import { LanguageObject } from './codes/codes';
|
2
2
|
import { Request } from './translation/_translateBundle';
|
3
3
|
import { Update } from './translation/_updateProjectDictionary';
|
4
|
-
import { _num, _datetime, _currency } from './format/_format';
|
5
4
|
/**
|
6
5
|
* Type representing the constructor parameters for the GT class.
|
7
6
|
*/
|
@@ -152,7 +151,11 @@ export declare function isSameLanguage(...codes: string[]): boolean;
|
|
152
151
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for number formatting.
|
153
152
|
* @returns {string} The formatted number.
|
154
153
|
*/
|
155
|
-
export declare
|
154
|
+
export declare function formatNum({ value, languages, options }: {
|
155
|
+
value: number;
|
156
|
+
languages?: string | string[];
|
157
|
+
options?: Intl.NumberFormatOptions;
|
158
|
+
}): string;
|
156
159
|
/**
|
157
160
|
* Formats a date according to the specified languages and options.
|
158
161
|
* @param {Object} params - The parameters for the date formatting.
|
@@ -161,7 +164,11 @@ export declare const num: typeof _num;
|
|
161
164
|
* @param {Intl.DateTimeFormatOptions} [params.options={}] - Additional options for date formatting.
|
162
165
|
* @returns {string} The formatted date.
|
163
166
|
*/
|
164
|
-
export declare
|
167
|
+
export declare function formatDateTime({ value, languages, options }: {
|
168
|
+
value: Date;
|
169
|
+
languages?: string | string[];
|
170
|
+
options?: Intl.DateTimeFormatOptions;
|
171
|
+
}): string;
|
165
172
|
/**
|
166
173
|
* Formats a currency value according to the specified languages, currency, and options.
|
167
174
|
* @param {Object} params - The parameters for the currency formatting.
|
@@ -171,4 +178,9 @@ export declare const datetime: typeof _datetime;
|
|
171
178
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
|
172
179
|
* @returns {string} The formatted currency value.
|
173
180
|
*/
|
174
|
-
export declare
|
181
|
+
export declare function formatCurrency({ value, languages, currency, options }: {
|
182
|
+
value: number;
|
183
|
+
languages?: string | string[];
|
184
|
+
currency?: string;
|
185
|
+
options?: Intl.NumberFormatOptions;
|
186
|
+
}): string;
|
package/dist/index.js
CHANGED
@@ -52,11 +52,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
52
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
53
53
|
};
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
55
|
-
exports.
|
55
|
+
exports.standardizeLanguageCode = exports.isValidLanguageCode = exports.getLanguageDirection = void 0;
|
56
56
|
exports.getLanguageObject = getLanguageObject;
|
57
57
|
exports.getLanguageCode = getLanguageCode;
|
58
58
|
exports.getLanguageName = getLanguageName;
|
59
59
|
exports.isSameLanguage = isSameLanguage;
|
60
|
+
exports.formatNum = formatNum;
|
61
|
+
exports.formatDateTime = formatDateTime;
|
62
|
+
exports.formatCurrency = formatCurrency;
|
60
63
|
// ----- IMPORTS ----- //
|
61
64
|
var codes_1 = require("./codes/codes");
|
62
65
|
var getLanguageDirection_1 = __importDefault(require("./codes/getLanguageDirection"));
|
@@ -221,7 +224,10 @@ function isSameLanguage() {
|
|
221
224
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for number formatting.
|
222
225
|
* @returns {string} The formatted number.
|
223
226
|
*/
|
224
|
-
|
227
|
+
function formatNum(_a) {
|
228
|
+
var value = _a.value, languages = _a.languages, options = _a.options;
|
229
|
+
return (0, _format_1._formatNum)({ value: value, languages: languages, options: options });
|
230
|
+
}
|
225
231
|
/**
|
226
232
|
* Formats a date according to the specified languages and options.
|
227
233
|
* @param {Object} params - The parameters for the date formatting.
|
@@ -230,7 +236,10 @@ exports.num = _format_1._num;
|
|
230
236
|
* @param {Intl.DateTimeFormatOptions} [params.options={}] - Additional options for date formatting.
|
231
237
|
* @returns {string} The formatted date.
|
232
238
|
*/
|
233
|
-
|
239
|
+
function formatDateTime(_a) {
|
240
|
+
var value = _a.value, languages = _a.languages, options = _a.options;
|
241
|
+
return (0, _format_1._formatDateTime)({ value: value, languages: languages, options: options });
|
242
|
+
}
|
234
243
|
/**
|
235
244
|
* Formats a currency value according to the specified languages, currency, and options.
|
236
245
|
* @param {Object} params - The parameters for the currency formatting.
|
@@ -240,4 +249,7 @@ exports.datetime = _format_1._datetime;
|
|
240
249
|
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
|
241
250
|
* @returns {string} The formatted currency value.
|
242
251
|
*/
|
243
|
-
|
252
|
+
function formatCurrency(_a) {
|
253
|
+
var value = _a.value, languages = _a.languages, currency = _a.currency, options = _a.options;
|
254
|
+
return (0, _format_1._formatCurrency)({ value: value, languages: languages, currency: currency, options: options });
|
255
|
+
}
|