@pocket-trash/localizations 0.0.10 → 0.2.0

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@pocket-trash/localizations.svg)](https://www.npmjs.com/package/@pocket-trash/localizations)
4
4
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./package.json)
5
- [![CI](https://github.com/Pocket-Trash/pocket-trash-localizations/actions/workflows/ci.yml/badge.svg)](https://github.com/Pocket-Trash/pocket-trash-localizations/actions/workflows/ci.yml)
5
+ [![CI](https://github.com/Pocket-Trash/localizations/actions/workflows/ci.yml/badge.svg)](https://github.com/Pocket-Trash/localizations/actions/workflows/ci.yml)
6
6
  [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](docs/contributing.md)
7
7
 
8
8
  Shared localization utilities and translation catalogs for Pocket Trash.
@@ -153,20 +153,6 @@ const save = translations['action.save'];
153
153
  Returned catalogs are complete. If a non-English locale omits a translation,
154
154
  or has a blank string, that key falls back to the `en-US` value.
155
155
 
156
- ## Clerk Localizations
157
-
158
- Use `getClerkLocalization()` when configuring Clerk UI components.
159
-
160
- ```ts
161
- import { getClerkLocalization, resolveLocale } from '@pocket-trash/localizations';
162
-
163
- const locale = resolveLocale('es-MX');
164
- const localization = getClerkLocalization(locale);
165
- ```
166
-
167
- English returns `undefined`, so Clerk uses its default English strings. Spanish
168
- returns Clerk's `esMX` localization.
169
-
170
156
  ## Adding Translations
171
157
 
172
158
  Source locale files use nested objects:
@@ -214,7 +200,6 @@ That command:
214
200
  2. Copies the nested `en-US` shape with every value set to `''`.
215
201
  3. Adds the locale to `SupportedLocale`, `SUPPORTED_LOCALES`, `localizations`,
216
202
  and `translations`.
217
- 4. Adds a Clerk localization mapping if `@clerk/localizations` exports one.
218
203
 
219
204
  Sync missing keys into existing non-English locales:
220
205
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { esMX as clerkEsMX } from "@clerk/localizations";
2
1
  import type { TranslationKey, Translations } from "./types/localization.js";
3
2
  export { enUS } from "./localizations/en-US.js";
4
3
  export { esMX } from "./localizations/es-MX.js";
@@ -7,7 +6,6 @@ export type SupportedLocale = "en-US" | "es-MX";
7
6
  export type MessageKey = TranslationKey;
8
7
  export type Messages = Translations;
9
8
  export type LocalePreference = string | readonly string[] | null | undefined;
10
- export type ClerkLocalizationResource = typeof clerkEsMX;
11
9
  export declare const DEFAULT_LOCALE = "en-US";
12
10
  export declare const SUPPORTED_LOCALES: readonly ["en-US", "es-MX"];
13
11
  export declare const localizations: Readonly<{
@@ -25,6 +23,192 @@ export declare const localizations: Readonly<{
25
23
  locale: {
26
24
  current: string;
27
25
  };
26
+ web: {
27
+ site: {
28
+ name: string;
29
+ };
30
+ action: {
31
+ archive: string;
32
+ clearAllFilters: string;
33
+ close: string;
34
+ edit: string;
35
+ saveFlag: string;
36
+ search: string;
37
+ signIn: string;
38
+ visitProductPage: string;
39
+ };
40
+ admin: {
41
+ featureFlags: {
42
+ actions: string;
43
+ adminOnlyTargeting: string;
44
+ audience: string;
45
+ booleanControls: string;
46
+ description: string;
47
+ displayName: string;
48
+ editFlag: string;
49
+ emailUsernameOrName: string;
50
+ featureFlags: string;
51
+ flag: string;
52
+ flags: string;
53
+ globalDefaultEnabled: string;
54
+ newFlag: string;
55
+ searchUsers: string;
56
+ slugPlaceholder: string;
57
+ };
58
+ };
59
+ archive: {
60
+ closeSearch: string;
61
+ controls: string;
62
+ defaultPenDescription: string;
63
+ filterDescription: string;
64
+ filters: string;
65
+ itemCount: string;
66
+ noDescription: string;
67
+ noItems: string;
68
+ searchPlaceholder: string;
69
+ searchProducts: string;
70
+ sortLabel: string;
71
+ sortProducts: string;
72
+ sortDescription: string;
73
+ footer: {
74
+ fanMade: string;
75
+ productOwnership: string;
76
+ resourceFor: string;
77
+ suggestionsOrContact: string;
78
+ discord: string;
79
+ };
80
+ headline: {
81
+ grip: string;
82
+ mechanism: string;
83
+ pen: string;
84
+ };
85
+ lightbox: {
86
+ archived: string;
87
+ closeProductDetails: string;
88
+ nextImage: string;
89
+ previousImage: string;
90
+ released: string;
91
+ specsDescription: string;
92
+ };
93
+ filter: {
94
+ all: string;
95
+ any: string;
96
+ matchMode: string;
97
+ bodyDetails: string;
98
+ category: string;
99
+ clip: string;
100
+ finish: string;
101
+ material: string;
102
+ mechanism: string;
103
+ refill: string;
104
+ size: string;
105
+ tipNose: string;
106
+ };
107
+ sort: {
108
+ newestDrop: string;
109
+ oldestDrop: string;
110
+ priceLowToHigh: string;
111
+ priceHighToLow: string;
112
+ weightLightToHeavy: string;
113
+ weightHeavyToLight: string;
114
+ diameterThinToThick: string;
115
+ diameterThickToThin: string;
116
+ titleAToZ: string;
117
+ };
118
+ spec: {
119
+ diameter: string;
120
+ length: string;
121
+ model: string;
122
+ price: string;
123
+ weight: string;
124
+ };
125
+ state: {
126
+ archived: string;
127
+ };
128
+ };
129
+ currency: {
130
+ aud: string;
131
+ cad: string;
132
+ chf: string;
133
+ eur: string;
134
+ gbp: string;
135
+ jpy: string;
136
+ nzd: string;
137
+ usd: string;
138
+ };
139
+ error: {
140
+ expectedJsonRequestBody: string;
141
+ invalidCurrencyCode: string;
142
+ invalidDimensionUnit: string;
143
+ invalidLocale: string;
144
+ invalidLogClientKey: string;
145
+ invalidTheme: string;
146
+ invalidWeightUnit: string;
147
+ missingSetting: string;
148
+ settingsSaveFailed: string;
149
+ userSettingsObject: string;
150
+ };
151
+ navigation: {
152
+ account: string;
153
+ accountMenu: string;
154
+ betaFeatures: string;
155
+ collections: string;
156
+ language: string;
157
+ logOut: string;
158
+ user: string;
159
+ };
160
+ locale: {
161
+ enUS: string;
162
+ esMX: string;
163
+ };
164
+ page: {
165
+ betaFeatures: {
166
+ empty: string;
167
+ };
168
+ collections: {
169
+ empty: string;
170
+ };
171
+ notFound: {
172
+ description: string;
173
+ returnToArchive: string;
174
+ title: string;
175
+ unavailable: string;
176
+ };
177
+ };
178
+ settings: {
179
+ about: string;
180
+ aboutDescription: string;
181
+ currency: string;
182
+ dark: string;
183
+ dimensionUnits: string;
184
+ dimensions: string;
185
+ displayCurrency: string;
186
+ displayPreferences: string;
187
+ displayPreferencesMachinedPens: string;
188
+ grams: string;
189
+ inches: string;
190
+ language: string;
191
+ light: string;
192
+ millimeters: string;
193
+ settings: string;
194
+ system: string;
195
+ theme: string;
196
+ weight: string;
197
+ weightUnits: string;
198
+ ounces: string;
199
+ };
200
+ sidebar: {
201
+ close: string;
202
+ description: string;
203
+ sidebar: string;
204
+ toggle: string;
205
+ };
206
+ status: {
207
+ disabled: string;
208
+ enabled: string;
209
+ failedToLoad: string;
210
+ };
211
+ };
28
212
  };
29
213
  "es-MX": {
30
214
  app: {
@@ -40,6 +224,192 @@ export declare const localizations: Readonly<{
40
224
  locale: {
41
225
  current: string;
42
226
  };
227
+ web: {
228
+ site: {
229
+ name: string;
230
+ };
231
+ action: {
232
+ archive: string;
233
+ clearAllFilters: string;
234
+ close: string;
235
+ edit: string;
236
+ saveFlag: string;
237
+ search: string;
238
+ signIn: string;
239
+ visitProductPage: string;
240
+ };
241
+ admin: {
242
+ featureFlags: {
243
+ actions: string;
244
+ adminOnlyTargeting: string;
245
+ audience: string;
246
+ booleanControls: string;
247
+ description: string;
248
+ displayName: string;
249
+ editFlag: string;
250
+ emailUsernameOrName: string;
251
+ featureFlags: string;
252
+ flag: string;
253
+ flags: string;
254
+ globalDefaultEnabled: string;
255
+ newFlag: string;
256
+ searchUsers: string;
257
+ slugPlaceholder: string;
258
+ };
259
+ };
260
+ archive: {
261
+ closeSearch: string;
262
+ controls: string;
263
+ defaultPenDescription: string;
264
+ filterDescription: string;
265
+ filters: string;
266
+ itemCount: string;
267
+ noDescription: string;
268
+ noItems: string;
269
+ searchPlaceholder: string;
270
+ searchProducts: string;
271
+ sortLabel: string;
272
+ sortProducts: string;
273
+ sortDescription: string;
274
+ footer: {
275
+ fanMade: string;
276
+ productOwnership: string;
277
+ resourceFor: string;
278
+ suggestionsOrContact: string;
279
+ discord: string;
280
+ };
281
+ headline: {
282
+ grip: string;
283
+ mechanism: string;
284
+ pen: string;
285
+ };
286
+ lightbox: {
287
+ archived: string;
288
+ closeProductDetails: string;
289
+ nextImage: string;
290
+ previousImage: string;
291
+ released: string;
292
+ specsDescription: string;
293
+ };
294
+ filter: {
295
+ all: string;
296
+ any: string;
297
+ matchMode: string;
298
+ bodyDetails: string;
299
+ category: string;
300
+ clip: string;
301
+ finish: string;
302
+ material: string;
303
+ mechanism: string;
304
+ refill: string;
305
+ size: string;
306
+ tipNose: string;
307
+ };
308
+ sort: {
309
+ newestDrop: string;
310
+ oldestDrop: string;
311
+ priceLowToHigh: string;
312
+ priceHighToLow: string;
313
+ weightLightToHeavy: string;
314
+ weightHeavyToLight: string;
315
+ diameterThinToThick: string;
316
+ diameterThickToThin: string;
317
+ titleAToZ: string;
318
+ };
319
+ spec: {
320
+ diameter: string;
321
+ length: string;
322
+ model: string;
323
+ price: string;
324
+ weight: string;
325
+ };
326
+ state: {
327
+ archived: string;
328
+ };
329
+ };
330
+ currency: {
331
+ aud: string;
332
+ cad: string;
333
+ chf: string;
334
+ eur: string;
335
+ gbp: string;
336
+ jpy: string;
337
+ nzd: string;
338
+ usd: string;
339
+ };
340
+ error: {
341
+ expectedJsonRequestBody: string;
342
+ invalidCurrencyCode: string;
343
+ invalidDimensionUnit: string;
344
+ invalidLocale: string;
345
+ invalidLogClientKey: string;
346
+ invalidTheme: string;
347
+ invalidWeightUnit: string;
348
+ missingSetting: string;
349
+ settingsSaveFailed: string;
350
+ userSettingsObject: string;
351
+ };
352
+ navigation: {
353
+ account: string;
354
+ accountMenu: string;
355
+ betaFeatures: string;
356
+ collections: string;
357
+ language: string;
358
+ logOut: string;
359
+ user: string;
360
+ };
361
+ locale: {
362
+ enUS: string;
363
+ esMX: string;
364
+ };
365
+ page: {
366
+ betaFeatures: {
367
+ empty: string;
368
+ };
369
+ collections: {
370
+ empty: string;
371
+ };
372
+ notFound: {
373
+ description: string;
374
+ returnToArchive: string;
375
+ title: string;
376
+ unavailable: string;
377
+ };
378
+ };
379
+ settings: {
380
+ about: string;
381
+ aboutDescription: string;
382
+ currency: string;
383
+ dark: string;
384
+ dimensionUnits: string;
385
+ dimensions: string;
386
+ displayCurrency: string;
387
+ displayPreferences: string;
388
+ displayPreferencesMachinedPens: string;
389
+ grams: string;
390
+ inches: string;
391
+ language: string;
392
+ light: string;
393
+ millimeters: string;
394
+ settings: string;
395
+ system: string;
396
+ theme: string;
397
+ weight: string;
398
+ weightUnits: string;
399
+ ounces: string;
400
+ };
401
+ sidebar: {
402
+ close: string;
403
+ description: string;
404
+ sidebar: string;
405
+ toggle: string;
406
+ };
407
+ status: {
408
+ disabled: string;
409
+ enabled: string;
410
+ failedToLoad: string;
411
+ };
412
+ };
43
413
  };
44
414
  }>;
45
415
  export declare const translationKeys: readonly TranslationKey[];
@@ -52,11 +422,9 @@ export declare const messages: Readonly<{
52
422
  "es-MX": Readonly<Readonly<Record<TranslationKey, string>>>;
53
423
  }>;
54
424
  export declare const messageKeys: readonly TranslationKey[];
55
- export declare const clerkLocalizations: Readonly<Record<SupportedLocale, ClerkLocalizationResource | undefined>>;
56
425
  export declare function resolveLocale(...preferences: readonly LocalePreference[]): SupportedLocale;
57
426
  export declare function getTranslations(locale?: SupportedLocale | null): Translations;
58
427
  export declare const getMessages: typeof getTranslations;
59
- export declare function getClerkLocalization(locale?: SupportedLocale | null): ClerkLocalizationResource | undefined;
60
428
  export declare function formatTranslation(key: TranslationKey, values?: Readonly<Record<string, unknown>>, locale?: SupportedLocale | null): string;
61
429
  export declare const formatMessage: typeof formatTranslation;
62
430
  export declare function assertCompleteCatalogs(): true;
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { esMX as clerkEsMX } from "@clerk/localizations";
2
1
  import { enUS } from "./localizations/en-US.js";
3
2
  import { esMX } from "./localizations/es-MX.js";
4
3
  export { enUS } from "./localizations/en-US.js";
@@ -23,10 +22,6 @@ export const translations = Object.freeze({
23
22
  });
24
23
  export const messages = translations;
25
24
  export const messageKeys = translationKeys;
26
- export const clerkLocalizations = Object.freeze({
27
- "en-US": undefined,
28
- "es-MX": clerkEsMX,
29
- });
30
25
  export function resolveLocale(...preferences) {
31
26
  for (const preference of preferences.flat()) {
32
27
  for (const tag of parseLocalePreference(preference)) {
@@ -41,9 +36,6 @@ export function getTranslations(locale) {
41
36
  return translations[resolveLocale(locale)];
42
37
  }
43
38
  export const getMessages = getTranslations;
44
- export function getClerkLocalization(locale) {
45
- return clerkLocalizations[resolveLocale(locale)];
46
- }
47
39
  export function formatTranslation(key, values = {}, locale = DEFAULT_LOCALE) {
48
40
  const template = getTranslations(locale)[key] ?? translations[DEFAULT_LOCALE][key];
49
41
  if (!template)
@@ -21,4 +21,190 @@ export declare const enUS: {
21
21
  locale: {
22
22
  current: string;
23
23
  };
24
+ web: {
25
+ site: {
26
+ name: string;
27
+ };
28
+ action: {
29
+ archive: string;
30
+ clearAllFilters: string;
31
+ close: string;
32
+ edit: string;
33
+ saveFlag: string;
34
+ search: string;
35
+ signIn: string;
36
+ visitProductPage: string;
37
+ };
38
+ admin: {
39
+ featureFlags: {
40
+ actions: string;
41
+ adminOnlyTargeting: string;
42
+ audience: string;
43
+ booleanControls: string;
44
+ description: string;
45
+ displayName: string;
46
+ editFlag: string;
47
+ emailUsernameOrName: string;
48
+ featureFlags: string;
49
+ flag: string;
50
+ flags: string;
51
+ globalDefaultEnabled: string;
52
+ newFlag: string;
53
+ searchUsers: string;
54
+ slugPlaceholder: string;
55
+ };
56
+ };
57
+ archive: {
58
+ closeSearch: string;
59
+ controls: string;
60
+ defaultPenDescription: string;
61
+ filterDescription: string;
62
+ filters: string;
63
+ itemCount: string;
64
+ noDescription: string;
65
+ noItems: string;
66
+ searchPlaceholder: string;
67
+ searchProducts: string;
68
+ sortLabel: string;
69
+ sortProducts: string;
70
+ sortDescription: string;
71
+ footer: {
72
+ fanMade: string;
73
+ productOwnership: string;
74
+ resourceFor: string;
75
+ suggestionsOrContact: string;
76
+ discord: string;
77
+ };
78
+ headline: {
79
+ grip: string;
80
+ mechanism: string;
81
+ pen: string;
82
+ };
83
+ lightbox: {
84
+ archived: string;
85
+ closeProductDetails: string;
86
+ nextImage: string;
87
+ previousImage: string;
88
+ released: string;
89
+ specsDescription: string;
90
+ };
91
+ filter: {
92
+ all: string;
93
+ any: string;
94
+ matchMode: string;
95
+ bodyDetails: string;
96
+ category: string;
97
+ clip: string;
98
+ finish: string;
99
+ material: string;
100
+ mechanism: string;
101
+ refill: string;
102
+ size: string;
103
+ tipNose: string;
104
+ };
105
+ sort: {
106
+ newestDrop: string;
107
+ oldestDrop: string;
108
+ priceLowToHigh: string;
109
+ priceHighToLow: string;
110
+ weightLightToHeavy: string;
111
+ weightHeavyToLight: string;
112
+ diameterThinToThick: string;
113
+ diameterThickToThin: string;
114
+ titleAToZ: string;
115
+ };
116
+ spec: {
117
+ diameter: string;
118
+ length: string;
119
+ model: string;
120
+ price: string;
121
+ weight: string;
122
+ };
123
+ state: {
124
+ archived: string;
125
+ };
126
+ };
127
+ currency: {
128
+ aud: string;
129
+ cad: string;
130
+ chf: string;
131
+ eur: string;
132
+ gbp: string;
133
+ jpy: string;
134
+ nzd: string;
135
+ usd: string;
136
+ };
137
+ error: {
138
+ expectedJsonRequestBody: string;
139
+ invalidCurrencyCode: string;
140
+ invalidDimensionUnit: string;
141
+ invalidLocale: string;
142
+ invalidLogClientKey: string;
143
+ invalidTheme: string;
144
+ invalidWeightUnit: string;
145
+ missingSetting: string;
146
+ settingsSaveFailed: string;
147
+ userSettingsObject: string;
148
+ };
149
+ navigation: {
150
+ account: string;
151
+ accountMenu: string;
152
+ betaFeatures: string;
153
+ collections: string;
154
+ language: string;
155
+ logOut: string;
156
+ user: string;
157
+ };
158
+ locale: {
159
+ enUS: string;
160
+ esMX: string;
161
+ };
162
+ page: {
163
+ betaFeatures: {
164
+ empty: string;
165
+ };
166
+ collections: {
167
+ empty: string;
168
+ };
169
+ notFound: {
170
+ description: string;
171
+ returnToArchive: string;
172
+ title: string;
173
+ unavailable: string;
174
+ };
175
+ };
176
+ settings: {
177
+ about: string;
178
+ aboutDescription: string;
179
+ currency: string;
180
+ dark: string;
181
+ dimensionUnits: string;
182
+ dimensions: string;
183
+ displayCurrency: string;
184
+ displayPreferences: string;
185
+ displayPreferencesMachinedPens: string;
186
+ grams: string;
187
+ inches: string;
188
+ language: string;
189
+ light: string;
190
+ millimeters: string;
191
+ settings: string;
192
+ system: string;
193
+ theme: string;
194
+ weight: string;
195
+ weightUnits: string;
196
+ ounces: string;
197
+ };
198
+ sidebar: {
199
+ close: string;
200
+ description: string;
201
+ sidebar: string;
202
+ toggle: string;
203
+ };
204
+ status: {
205
+ disabled: string;
206
+ enabled: string;
207
+ failedToLoad: string;
208
+ };
209
+ };
24
210
  };