@google-psat/i18n 0.14.1 → 1.2.1
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/_locales/messages/en/messages.json +147 -3
- package/dist/i18n.js +36 -82
- package/dist/index.js +1 -8
- package/dist-types/i18n.d.ts +2 -7
- package/package.json +2 -1
- package/scripts/merge-messages.cjs +0 -1
- package/tsconfig.json +3 -3
|
@@ -1589,7 +1589,7 @@
|
|
|
1589
1589
|
"message": "Attribution"
|
|
1590
1590
|
},
|
|
1591
1591
|
"trackingProtection": {
|
|
1592
|
-
"message": "
|
|
1592
|
+
"message": "Privacy Protection"
|
|
1593
1593
|
},
|
|
1594
1594
|
"bounceTracking": {
|
|
1595
1595
|
"message": "Bounce Tracking"
|
|
@@ -8187,7 +8187,7 @@
|
|
|
8187
8187
|
"message": "Enable trust in a user's authenticity to be conveyed from one context to another, to help sites combat fraud and distinguish bots from real humans—without passive tracking."
|
|
8188
8188
|
},
|
|
8189
8189
|
"antiCovertTrackingDescription": {
|
|
8190
|
-
"message": "The Privacy Sandbox initiative also includes efforts
|
|
8190
|
+
"message": "The Privacy Sandbox initiative also includes efforts focused on anti covert tracking techniques, addressing specific methods such as fingerprinting and network-level tracking."
|
|
8191
8191
|
},
|
|
8192
8192
|
"noCookiesExempted": {
|
|
8193
8193
|
"message": "No cookies were exempted by the browser."
|
|
@@ -9375,7 +9375,7 @@
|
|
|
9375
9375
|
"message": "Remembers user preferences like language, search results per page, and SafeSearch settings"
|
|
9376
9376
|
},
|
|
9377
9377
|
"OCD_Secure_YEC_description": {
|
|
9378
|
-
"message": "Serve a similar purpose for
|
|
9378
|
+
"message": "Serve a similar purpose for , including detecting and resolving problems"
|
|
9379
9379
|
},
|
|
9380
9380
|
"OCD_CGIC_description": {
|
|
9381
9381
|
"message": "Improves search results delivery by autocompleting queries based on user input"
|
|
@@ -9451,5 +9451,149 @@
|
|
|
9451
9451
|
},
|
|
9452
9452
|
"RWS_rationale_https___lucyhealth_io": {
|
|
9453
9453
|
"message": "blood sugar monitoring and management platform"
|
|
9454
|
+
},
|
|
9455
|
+
"OCD___Secure_ROLLOUT_TOKEN_description": {
|
|
9456
|
+
"message": "\tRegisters a unique ID to keep statistics of what videos from YouTube the user has seen."
|
|
9457
|
+
},
|
|
9458
|
+
"OCD_ttcsid__description": {
|
|
9459
|
+
"message": "The TikTok cookie ttcsid likely serves as a session identifier, helping to maintain user sessions and track interactions across the platform. Its purpose is probably to manage user authentication or personalize content based on activity, similar to other session-related cookies used by TikTok."
|
|
9460
|
+
},
|
|
9461
|
+
"OCD_tf_respondent_cc_description": {
|
|
9462
|
+
"message": "This cookie is used to make sure forms on the website work properly."
|
|
9463
|
+
},
|
|
9464
|
+
"OCD_attribution_user_id_description": {
|
|
9465
|
+
"message": "This cookie helps us in attributing the conversion to the correct channel"
|
|
9466
|
+
},
|
|
9467
|
+
"OCD__hp2_id_description": {
|
|
9468
|
+
"message": "Store a unique user ID, Store and track interaction."
|
|
9469
|
+
},
|
|
9470
|
+
"OCD_retention_14_months": {
|
|
9471
|
+
"message": "14 months"
|
|
9472
|
+
},
|
|
9473
|
+
"OCD__hp2_ses_props_description": {
|
|
9474
|
+
"message": "Store a unique user ID, Store and track interaction."
|
|
9475
|
+
},
|
|
9476
|
+
"OCD_pi_opt_in_description": {
|
|
9477
|
+
"message": "If tracking opt-in preferences is enabled, the cookie is set with a true or false value when the visitor opts in or out of tracking"
|
|
9478
|
+
},
|
|
9479
|
+
"OCD_Hm_lpvt__description": {
|
|
9480
|
+
"message": "Record the most recent access timestamp"
|
|
9481
|
+
},
|
|
9482
|
+
"OCD_Hm_lvt__description": {
|
|
9483
|
+
"message": "Record the first access timestamp"
|
|
9484
|
+
},
|
|
9485
|
+
"OCD_HMACCOUNT_description": {
|
|
9486
|
+
"message": "Used to send data to Baidu about the visitors device and behaviour. Tracks the visitor across devices and marketing channels."
|
|
9487
|
+
},
|
|
9488
|
+
"OCD__gtmeec_description": {
|
|
9489
|
+
"message": "Used by Meta to store user data for reuse, enabling more efficient and accurate tracking and targeting."
|
|
9490
|
+
},
|
|
9491
|
+
"OCD_FPGSID_description": {
|
|
9492
|
+
"message": "This cookie is an essential session and security cookie from Google. Its main purpose is to manage the session of a logged-in user, ensuring they remain logged in while navigating between Google services (like Gmail, Drive, YouTube) and to protect the account against unauthorized requests."
|
|
9493
|
+
},
|
|
9494
|
+
"RWS_rationale_https___oficialderma_com_br": {
|
|
9495
|
+
"message": "Segmented store that shares same user and cart with the primary store. The branding is clearly visible on the site."
|
|
9496
|
+
},
|
|
9497
|
+
"RWS_rationale_https___oficialnutri_com": {
|
|
9498
|
+
"message": "Segmented store that shares same user and cart with the primary store. The branding is clearly visible on the site."
|
|
9499
|
+
},
|
|
9500
|
+
"RWS_rationale_https___mercadooficial_com_br": {
|
|
9501
|
+
"message": "Segmented store that shares same user and cart with the primary store. The branding is clearly visible on the site."
|
|
9502
|
+
},
|
|
9503
|
+
"RWS_rationale_https___deltarune_wiki": {
|
|
9504
|
+
"message": "Sister wiki site that shares the same user database. Association clearly stated on the main page and Terms of Service."
|
|
9505
|
+
},
|
|
9506
|
+
"OCD_logglytrackingsession_description": {
|
|
9507
|
+
"message": "Used by Loggly for performance and error tracking."
|
|
9508
|
+
},
|
|
9509
|
+
"OCD_privacypillar_google_consent_description": {
|
|
9510
|
+
"message": "Information about the visitor's Google vendor choices is stored by this cookie."
|
|
9511
|
+
},
|
|
9512
|
+
"OCD_privacypillar_cookie_consent_description": {
|
|
9513
|
+
"message": "Stores the user's current consent status."
|
|
9514
|
+
},
|
|
9515
|
+
"OCD_usprivacy_description": {
|
|
9516
|
+
"message": "This cookie stores the US privacy string."
|
|
9517
|
+
},
|
|
9518
|
+
"OCD___Secure_YNID_description": {
|
|
9519
|
+
"message": "It's a YouTube cookie used to enhance user experience by storing video player preferences and aiding in secure log-ins and spam detectio"
|
|
9520
|
+
},
|
|
9521
|
+
"OCD__AspNetCore_Mvc_CookieTempDataProvider_description": {
|
|
9522
|
+
"message": "This cookie is used to keep temporary session data while you are on the site. "
|
|
9523
|
+
},
|
|
9524
|
+
"OCD_x_ms_cpim_admin_description": {
|
|
9525
|
+
"message": "Holds user membership data across tenants. The tenants a user is a member of and level of membership (Admin or User)."
|
|
9526
|
+
},
|
|
9527
|
+
"OCD_x_ms_cpim_slice_description": {
|
|
9528
|
+
"message": "Used to route requests to the appropriate production instance."
|
|
9529
|
+
},
|
|
9530
|
+
"OCD_x_ms_cpim_trans_description": {
|
|
9531
|
+
"message": "Used for tracking the transactions (number of authentication requests to Azure AD B2C) and the current transaction."
|
|
9532
|
+
},
|
|
9533
|
+
"OCD_x_ms_cpim_sso__description": {
|
|
9534
|
+
"message": "Used for maintaining the SSO session. This cookie is set as persistent, when Keep Me Signed In is enabled."
|
|
9535
|
+
},
|
|
9536
|
+
"OCD_x_ms_cpim_cache__description": {
|
|
9537
|
+
"message": "Used for maintaining the request state."
|
|
9538
|
+
},
|
|
9539
|
+
"OCD_x_ms_cpim_csrf_description": {
|
|
9540
|
+
"message": "Cross-Site Request Forgery token used for CRSF protection. For more information, read the Cross-Site request forgery token section."
|
|
9541
|
+
},
|
|
9542
|
+
"OCD_x_ms_cpim_dc_description": {
|
|
9543
|
+
"message": "Used for Azure AD B2C network routing."
|
|
9544
|
+
},
|
|
9545
|
+
"OCD_x_ms_cpim_ctx_description": {
|
|
9546
|
+
"message": "Context"
|
|
9547
|
+
},
|
|
9548
|
+
"OCD_x_ms_cpim_rp_description": {
|
|
9549
|
+
"message": "Used for storing membership data for the resource provider tenant."
|
|
9550
|
+
},
|
|
9551
|
+
"OCD_x_ms_cpim_rc_description": {
|
|
9552
|
+
"message": "Used for storing the relay cookie."
|
|
9553
|
+
},
|
|
9554
|
+
"OCD_x_ms_cpim_geo_description": {
|
|
9555
|
+
"message": "Used as a hint to determine the resource tenants home geographic location."
|
|
9556
|
+
},
|
|
9557
|
+
"OCD_Dynamics365PortalAnalytics_description": {
|
|
9558
|
+
"message": "Used to uniquely distinguish one site visitor from another without storing any personal data or user identity. This cookie is essential for delivering reliable, secure, and maintainable service functionality across multiple Power Pages features."
|
|
9559
|
+
},
|
|
9560
|
+
"OCD__shopify_essential_description": {
|
|
9561
|
+
"message": "Contains essential information for the correct functionality of a store such as session and checkout information and anti-tampering data."
|
|
9562
|
+
},
|
|
9563
|
+
"OCD__shopify_essential___description": {
|
|
9564
|
+
"message": "Contains an opaque token that is used to identify a device for all essential purposes."
|
|
9565
|
+
},
|
|
9566
|
+
"OCD___txn___description": {
|
|
9567
|
+
"message": "The __txn_ cookie is an Auth0 transaction cookie used during the login process to securely manage the authentication flow between your application and Auth0"
|
|
9568
|
+
},
|
|
9569
|
+
"OCD_igodigitalstdomain_description": {
|
|
9570
|
+
"message": "This cookie is used to capture customer behavior to improve the quality of the experience of our online customers, including enhanced browsing experiences. It expires after one hour or upon the withdrawal of your consent."
|
|
9571
|
+
},
|
|
9572
|
+
"OCD_igodigitalst___description": {
|
|
9573
|
+
"message": "This cookie is used to capture customer behavior to improve the quality of the experience of our online customers, including enhanced browsing experiences. It expires after one hour or upon the withdrawal of your consent."
|
|
9574
|
+
},
|
|
9575
|
+
"OCD_igodigitaltc2_description": {
|
|
9576
|
+
"message": "This cookie is used to capture customer behavior to improve the quality of the experience of our online customers, including enhanced browsing experiences. It expires after 10 years or upon the withdrawal of your consent."
|
|
9577
|
+
},
|
|
9578
|
+
"OCD_logglytrackingsession_description": {
|
|
9579
|
+
"message": "Used by Loggly for performance and error tracking."
|
|
9580
|
+
},
|
|
9581
|
+
"OCD___exponea_etc___description": {
|
|
9582
|
+
"message": "Exponea Bloomreach Engagement - This cookie is used to determine which products the visitor has viewed. This information is used to promote related products and optimize ad-efficiency."
|
|
9583
|
+
},
|
|
9584
|
+
"OCD___exponea_time2___description": {
|
|
9585
|
+
"message": "Exponea Bloomreach Engagement - This cookie is used to determine which products the visitor has viewed. This information is used to promote related products and optimize ad-efficiency."
|
|
9586
|
+
},
|
|
9587
|
+
"OCD__rp_uid_description": {
|
|
9588
|
+
"message": "This cookie is used to track users, and helps identify suspicious browsing and/or purchasing activity."
|
|
9589
|
+
},
|
|
9590
|
+
"OCD_aw_popup_viewed_page_description": {
|
|
9591
|
+
"message": "Used in context with the website’s pop-up questionnaires and messengering."
|
|
9592
|
+
},
|
|
9593
|
+
"OCD___Secure_next_auth_callback_url_description": {
|
|
9594
|
+
"message": "Used to store the callback URL which the user should be redirected to after login."
|
|
9595
|
+
},
|
|
9596
|
+
"OCD___Host_next_auth_csrf_token_description": {
|
|
9597
|
+
"message": "Used to help with site security in preventing Cross-Site Request Forgery attacks."
|
|
9454
9598
|
}
|
|
9455
9599
|
}
|
package/dist/i18n.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
1
|
/*
|
|
16
2
|
* Copyright 2023 Google LLC
|
|
17
3
|
*
|
|
@@ -30,17 +16,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
16
|
/**
|
|
31
17
|
* External dependencies.
|
|
32
18
|
*/
|
|
33
|
-
|
|
34
|
-
const intl_messageformat_1 = require("intl-messageformat");
|
|
35
|
-
const path_1 = __importDefault(require("path"));
|
|
19
|
+
import { IntlMessageFormat } from 'intl-messageformat';
|
|
36
20
|
/**
|
|
37
21
|
* Class representing Internationalization (i18n) functionality.
|
|
38
22
|
*/
|
|
39
23
|
class I18n {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.locale = 'en';
|
|
43
|
-
}
|
|
24
|
+
messages = {};
|
|
25
|
+
locale = 'en';
|
|
44
26
|
/**
|
|
45
27
|
* Initializes the messages object with the provided messages.
|
|
46
28
|
* @param {object} messages - The messages object containing translations.
|
|
@@ -53,8 +35,7 @@ class I18n {
|
|
|
53
35
|
* @returns {string} The locale string.
|
|
54
36
|
*/
|
|
55
37
|
getLocale() {
|
|
56
|
-
|
|
57
|
-
if (typeof chrome !== 'undefined' && ((_a = chrome === null || chrome === void 0 ? void 0 : chrome.i18n) === null || _a === void 0 ? void 0 : _a.getUILanguage)) {
|
|
38
|
+
if (typeof chrome !== 'undefined' && chrome?.i18n?.getUILanguage) {
|
|
58
39
|
return chrome.i18n.getUILanguage();
|
|
59
40
|
}
|
|
60
41
|
return this.locale;
|
|
@@ -75,7 +56,7 @@ class I18n {
|
|
|
75
56
|
if (!locale) {
|
|
76
57
|
return ['en'];
|
|
77
58
|
}
|
|
78
|
-
|
|
59
|
+
const locales = [
|
|
79
60
|
locale,
|
|
80
61
|
locale.replace(/_/g, '-'),
|
|
81
62
|
locale.replace(/-/g, '_'),
|
|
@@ -83,65 +64,38 @@ class I18n {
|
|
|
83
64
|
locale.split('_')[0],
|
|
84
65
|
'en',
|
|
85
66
|
];
|
|
67
|
+
return [...new Set(locales)];
|
|
86
68
|
}
|
|
87
69
|
/**
|
|
88
70
|
* Asynchronously loads messages data using the provided locale.
|
|
89
71
|
* @param {string} locale - The locale string.
|
|
90
72
|
* @returns {Promise<void>} A promise that resolves when messages are loaded.
|
|
91
73
|
*/
|
|
92
|
-
fetchMessages(locale) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const localeArray = this.createLocaleArray(locale);
|
|
95
|
-
let idx = 0;
|
|
96
|
-
const fetchWithRetry = () => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
let res = {};
|
|
98
|
-
if (idx >= localeArray.length) {
|
|
99
|
-
return res;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const response = yield fetch(`/_locales/${localeArray[idx]}/messages.json`);
|
|
103
|
-
if (!response.ok) {
|
|
104
|
-
throw new Error(`Failed to fetch messages for locale ${localeArray[idx]}`);
|
|
105
|
-
}
|
|
106
|
-
const data = yield response.json();
|
|
107
|
-
res = data;
|
|
108
|
-
this.locale = localeArray[idx];
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
idx++;
|
|
112
|
-
res = yield fetchWithRetry();
|
|
113
|
-
}
|
|
114
|
-
return res;
|
|
115
|
-
});
|
|
116
|
-
const result = yield fetchWithRetry();
|
|
117
|
-
return result;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Loads messages data for the CLI.
|
|
122
|
-
* @param {string} locale - The locale string.
|
|
123
|
-
*/
|
|
124
|
-
loadCLIMessagesData(locale) {
|
|
74
|
+
async fetchMessages(locale) {
|
|
125
75
|
const localeArray = this.createLocaleArray(locale);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
`../../node_modules/@google-psat/i18n/_locales/messages/${_locale}/messages.json`);
|
|
76
|
+
let idx = 0;
|
|
77
|
+
const fetchWithRetry = async () => {
|
|
78
|
+
let res = {};
|
|
79
|
+
if (idx >= localeArray.length) {
|
|
80
|
+
return res;
|
|
132
81
|
}
|
|
133
|
-
|
|
134
|
-
|
|
82
|
+
try {
|
|
83
|
+
const response = await fetch(`/_locales/${localeArray[idx]}/messages.json`);
|
|
84
|
+
if (!response.ok) {
|
|
85
|
+
throw new Error(`Failed to fetch messages for locale ${localeArray[idx]}`);
|
|
86
|
+
}
|
|
87
|
+
const data = await response.json();
|
|
88
|
+
res = data;
|
|
89
|
+
this.locale = localeArray[idx];
|
|
135
90
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}));
|
|
140
|
-
this.initMessages(messages);
|
|
141
|
-
this.locale = _locale;
|
|
142
|
-
break;
|
|
91
|
+
catch (error) {
|
|
92
|
+
idx++;
|
|
93
|
+
res = await fetchWithRetry();
|
|
143
94
|
}
|
|
144
|
-
|
|
95
|
+
return res;
|
|
96
|
+
};
|
|
97
|
+
const result = await fetchWithRetry();
|
|
98
|
+
return result;
|
|
145
99
|
}
|
|
146
100
|
/**
|
|
147
101
|
* Retrieves a translated message for a given key.
|
|
@@ -151,8 +105,7 @@ class I18n {
|
|
|
151
105
|
* @returns {string} The translated message.
|
|
152
106
|
*/
|
|
153
107
|
getMessage(key, substitutions, escapeLt) {
|
|
154
|
-
|
|
155
|
-
if (typeof chrome !== 'undefined' && ((_a = chrome === null || chrome === void 0 ? void 0 : chrome.i18n) === null || _a === void 0 ? void 0 : _a.getMessage)) {
|
|
108
|
+
if (typeof chrome !== 'undefined' && chrome?.i18n?.getMessage) {
|
|
156
109
|
try {
|
|
157
110
|
// @ts-ignore - Outdated definition.
|
|
158
111
|
const text = chrome.i18n.getMessage(key, substitutions, {
|
|
@@ -174,8 +127,7 @@ class I18n {
|
|
|
174
127
|
* @returns {string} The parsed message.
|
|
175
128
|
*/
|
|
176
129
|
_parseMessage(key, substitutions, escapeLt) {
|
|
177
|
-
|
|
178
|
-
const messageObj = (_a = this.messages) === null || _a === void 0 ? void 0 : _a[key];
|
|
130
|
+
const messageObj = this.messages?.[key];
|
|
179
131
|
if (!messageObj) {
|
|
180
132
|
return '';
|
|
181
133
|
}
|
|
@@ -185,10 +137,10 @@ class I18n {
|
|
|
185
137
|
.join('');
|
|
186
138
|
const placeholders = Object.entries(messageObj.placeholders || {}).reduce((acc, [placeholderKey, val]) => {
|
|
187
139
|
const idx = Number(val.content.substring(1)) - 1;
|
|
188
|
-
acc[placeholderKey] =
|
|
140
|
+
acc[placeholderKey] = substitutions?.[idx] || '';
|
|
189
141
|
return acc;
|
|
190
142
|
}, {});
|
|
191
|
-
return new
|
|
143
|
+
return new IntlMessageFormat(message, 'en', undefined, {
|
|
192
144
|
ignoreTag: escapeLt,
|
|
193
145
|
}).format(placeholders);
|
|
194
146
|
}
|
|
@@ -199,7 +151,8 @@ class I18n {
|
|
|
199
151
|
* @returns {string} The formatted messages.
|
|
200
152
|
*/
|
|
201
153
|
getFormattedMessages(keys) {
|
|
202
|
-
return keys
|
|
154
|
+
return keys
|
|
155
|
+
?.map((key) => {
|
|
203
156
|
const [type] = key.split('_');
|
|
204
157
|
const message = this.getMessage(key);
|
|
205
158
|
switch (type) {
|
|
@@ -210,7 +163,8 @@ class I18n {
|
|
|
210
163
|
default:
|
|
211
164
|
return message;
|
|
212
165
|
}
|
|
213
|
-
})
|
|
166
|
+
})
|
|
167
|
+
.join('');
|
|
214
168
|
}
|
|
215
169
|
}
|
|
216
|
-
|
|
170
|
+
export default new I18n();
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright 2023 Google LLC
|
|
4
3
|
*
|
|
@@ -14,10 +13,4 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.I18n = void 0;
|
|
22
|
-
var i18n_1 = require("./i18n");
|
|
23
|
-
Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return __importDefault(i18n_1).default; } });
|
|
16
|
+
export { default as I18n } from './i18n';
|
package/dist-types/i18n.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
declare class I18n {
|
|
5
5
|
private messages;
|
|
6
|
-
|
|
6
|
+
locale: string;
|
|
7
7
|
/**
|
|
8
8
|
* Initializes the messages object with the provided messages.
|
|
9
9
|
* @param {object} messages - The messages object containing translations.
|
|
@@ -35,18 +35,13 @@ declare class I18n {
|
|
|
35
35
|
* @param {string} locale - The locale string.
|
|
36
36
|
* @returns {string[]} An array of locale strings.
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
createLocaleArray(locale: string): string[];
|
|
39
39
|
/**
|
|
40
40
|
* Asynchronously loads messages data using the provided locale.
|
|
41
41
|
* @param {string} locale - The locale string.
|
|
42
42
|
* @returns {Promise<void>} A promise that resolves when messages are loaded.
|
|
43
43
|
*/
|
|
44
44
|
fetchMessages(locale: string): Promise<{}>;
|
|
45
|
-
/**
|
|
46
|
-
* Loads messages data for the CLI.
|
|
47
|
-
* @param {string} locale - The locale string.
|
|
48
|
-
*/
|
|
49
|
-
loadCLIMessagesData(locale: string): void;
|
|
50
45
|
/**
|
|
51
46
|
* Retrieves a translated message for a given key.
|
|
52
47
|
* @param {string} key - The key of the message to retrieve.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-psat/i18n",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A package that handles internationalization and localization.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist-types/index.d.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"default": "./src/index.ts"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
"type": "module",
|
|
13
14
|
"scripts": {
|
|
14
15
|
"build": "tsc --build",
|
|
15
16
|
"dev": "tsc-watch --build",
|
package/tsconfig.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"jsx": "preserve",
|
|
4
4
|
"rootDir": "src",
|
|
5
|
-
"target": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"lib": ["ESNext"],
|
|
8
8
|
"outDir": "dist",
|
|
9
9
|
"declarationDir": "dist-types",
|
|
10
10
|
"composite": true,
|