locale-service 0.2.1 → 0.2.3
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/lib/index.js +7 -0
- package/package.json +1 -1
- package/src/index.ts +9 -1
package/lib/index.js
CHANGED
|
@@ -34,6 +34,9 @@ function getLocaleFromResources(i) {
|
|
|
34
34
|
return lr[i];
|
|
35
35
|
}
|
|
36
36
|
function getLocale(l) {
|
|
37
|
+
if (!l) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
37
40
|
var lc = getLocaleFromResources(l);
|
|
38
41
|
if (!lc) {
|
|
39
42
|
var newId = map_1.map[l];
|
|
@@ -82,6 +85,10 @@ exports.vi = { "id": "vi-VN", "countryCode": "VN", "dateFormat": "dd/MM/yyyy", "
|
|
|
82
85
|
exports.us = { "id": "en-US", "countryCode": "US", "dateFormat": "M/d/yyyy", "firstDayOfWeek": 1, "decimalSeparator": ".", "groupSeparator": ",", "decimalDigits": 2, "currencyCode": "USD", "currencySymbol": "$", "currencyPattern": 0 };
|
|
83
86
|
exports.th = { "id": "th-TH", "countryCode": "TH", "dateFormat": "d/M/yyyy", "firstDayOfWeek": 2, "decimalSeparator": ".", "groupSeparator": ",", "decimalDigits": 2, "currencyCode": "THB", "currencySymbol": "฿", "currencyPattern": 0 };
|
|
84
87
|
exports.id = { "id": "id-ID", "countryCode": "ID", "dateFormat": "dd/MM/yyyy", "firstDayOfWeek": 2, "decimalSeparator": ",", "groupSeparator": ".", "decimalDigits": 0, "currencyCode": "IDR", "currencySymbol": "Rp", "currencyPattern": 0 };
|
|
88
|
+
exports.viLocale = exports.vi;
|
|
89
|
+
exports.usLocale = exports.us;
|
|
90
|
+
exports.thLocale = exports.th;
|
|
91
|
+
exports.idLocale = exports.id;
|
|
85
92
|
exports.usd = {
|
|
86
93
|
code: "USD",
|
|
87
94
|
symbol: "$",
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -64,7 +64,10 @@ function getLocaleFromResources(i: string): Locale|undefined {
|
|
|
64
64
|
}
|
|
65
65
|
return lr[i];
|
|
66
66
|
}
|
|
67
|
-
export function getLocale(l
|
|
67
|
+
export function getLocale(l?: string | null): Locale|undefined {
|
|
68
|
+
if (!l) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
68
71
|
let lc = getLocaleFromResources(l);
|
|
69
72
|
if (!lc) {
|
|
70
73
|
const newId = map[l];
|
|
@@ -130,6 +133,11 @@ export const us = {"id":"en-US","countryCode":"US","dateFormat":"M/d/yyyy","firs
|
|
|
130
133
|
export const th = {"id":"th-TH","countryCode":"TH","dateFormat":"d/M/yyyy","firstDayOfWeek":2,"decimalSeparator":".","groupSeparator":",","decimalDigits":2,"currencyCode":"THB","currencySymbol":"฿","currencyPattern":0}
|
|
131
134
|
export const id = {"id":"id-ID","countryCode":"ID","dateFormat":"dd/MM/yyyy","firstDayOfWeek":2,"decimalSeparator":",","groupSeparator":".","decimalDigits":0,"currencyCode":"IDR","currencySymbol":"Rp","currencyPattern":0}
|
|
132
135
|
|
|
136
|
+
export const viLocale = vi
|
|
137
|
+
export const usLocale = us
|
|
138
|
+
export const thLocale = th
|
|
139
|
+
export const idLocale = id
|
|
140
|
+
|
|
133
141
|
export const usd: Currency = {
|
|
134
142
|
code: "USD",
|
|
135
143
|
symbol: "$",
|