@konce-pt/i18n 0.11.1 → 0.12.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/dist/index.d.ts +1 -1
- package/dist/intl.js +7 -2
- package/dist/messages.d.ts +39 -2
- package/dist/messages.js +40 -2
- package/dist/types.d.ts +11 -0
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { KPT_MESSAGES_EN, KPT_MESSAGES_PL } from './messages.ts';
|
|
2
2
|
export type { KptLocale, KptMessages } from './messages.ts';
|
|
3
3
|
export { deepMerge, lookup, translate } from './translate.ts';
|
|
4
|
-
export type { DeepPartial, KptI18nConfig } from './types.ts';
|
|
4
|
+
export type { DeepPartial, KptI18nConfig, KptMessageKey } from './types.ts';
|
|
5
5
|
export { monthNames, weekdayNames } from './intl.ts';
|
package/dist/intl.js
CHANGED
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
* Pomocniki nazw dni/miesięcy wyliczane z `Intl` — sterowane bieżącym locale i18n.
|
|
3
3
|
* Dzięki temu kalendarze (`kpt-datepicker`, `kpt-date-range`) nie trzymają
|
|
4
4
|
* zaszytych tablic nazw i działają dla dowolnego języka.
|
|
5
|
+
*
|
|
6
|
+
* Daty wzorcowe powstają jako północ UTC, więc formatter też musi liczyć w UTC. Bez
|
|
7
|
+
* `timeZone: 'UTC'` formatuje w strefie przeglądarki, a na zachód od Greenwich północ UTC
|
|
8
|
+
* to jeszcze poprzedni dzień: w Nowym Jorku tydzień zaczynał się od „Sun”, a styczeń
|
|
9
|
+
* był podpisany „December”.
|
|
5
10
|
*/
|
|
6
11
|
/** Krótkie nazwy dni tygodnia, zaczynając od poniedziałku (Pn…Nd). */
|
|
7
12
|
export function weekdayNames(locale) {
|
|
8
|
-
const fmt = new Intl.DateTimeFormat(locale, { weekday: 'short' });
|
|
13
|
+
const fmt = new Intl.DateTimeFormat(locale, { weekday: 'short', timeZone: 'UTC' });
|
|
9
14
|
// 2024-01-01 (UTC) to poniedziałek.
|
|
10
15
|
return Array.from({ length: 7 }, (_, i) => fmt.format(new Date(Date.UTC(2024, 0, 1 + i))));
|
|
11
16
|
}
|
|
12
17
|
/** Pełne nazwy miesięcy (styczeń…grudzień / January…December). */
|
|
13
18
|
export function monthNames(locale) {
|
|
14
|
-
const fmt = new Intl.DateTimeFormat(locale, { month: 'long' });
|
|
19
|
+
const fmt = new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC' });
|
|
15
20
|
return Array.from({ length: 12 }, (_, i) => fmt.format(new Date(Date.UTC(2024, i, 1))));
|
|
16
21
|
}
|
package/dist/messages.d.ts
CHANGED
|
@@ -43,8 +43,11 @@ export interface KptMessages {
|
|
|
43
43
|
week: string;
|
|
44
44
|
today: string;
|
|
45
45
|
milestone: string;
|
|
46
|
+
/** Dymek przełącznika grupy; nazwą dostępną przycisku jest nazwa grupy, stan niesie aria-expanded. */
|
|
46
47
|
expandGroup: string;
|
|
47
48
|
collapseGroup: string;
|
|
49
|
+
/** Postęp w nazwie dostępnej paska. Interpolacja: {percent}. */
|
|
50
|
+
progress: string;
|
|
48
51
|
};
|
|
49
52
|
map: {
|
|
50
53
|
/** Pozycja menu po kliknięciu mapy prawym przyciskiem. */
|
|
@@ -154,8 +157,12 @@ export interface KptMessages {
|
|
|
154
157
|
dateRange: string;
|
|
155
158
|
min: string;
|
|
156
159
|
max: string;
|
|
157
|
-
/** Interpolacja: {column}.
|
|
160
|
+
/** Interpolacja: {column}. Opis edytowalnej komórki (`aria-describedby`) — nazwą zostaje jej wartość. */
|
|
158
161
|
editCell: string;
|
|
162
|
+
/** Interpolacja: {column}. Nazwa uchwytu przestawiania kolumny (strzałki ← →). */
|
|
163
|
+
moveColumn: string;
|
|
164
|
+
/** Interpolacja: {column}, {position}, {count}. Ogłoszenie po przestawieniu kolumny. */
|
|
165
|
+
columnMoved: string;
|
|
159
166
|
/** Domyślna etykieta wiersza podsumowania (input `summaryLabel` ma priorytet). */
|
|
160
167
|
total: string;
|
|
161
168
|
};
|
|
@@ -165,8 +172,14 @@ export interface KptMessages {
|
|
|
165
172
|
reject: string;
|
|
166
173
|
};
|
|
167
174
|
fileUpload: {
|
|
168
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* Interpolacja: {action} — w to miejsce trafia `hintAction` pogrubione. Zwykły tekst, bez HTML:
|
|
177
|
+
* słowniki bywają z CMS-a albo od tłumaczy, więc nie mogą wstrzykiwać znaczników.
|
|
178
|
+
*/
|
|
169
179
|
hint: string;
|
|
180
|
+
/** Pogrubiona część podpowiedzi („Kliknij”). */
|
|
181
|
+
hintAction: string;
|
|
182
|
+
/** Nazwa przycisku usunięcia; komponent dokleja nazwę pliku. */
|
|
170
183
|
remove: string;
|
|
171
184
|
};
|
|
172
185
|
chipsInput: {
|
|
@@ -203,6 +216,20 @@ export interface KptMessages {
|
|
|
203
216
|
/** Interpolacja: {start}, {end}. Komunikat po wyborze całego zakresu. */
|
|
204
217
|
picked: string;
|
|
205
218
|
};
|
|
219
|
+
chart: {
|
|
220
|
+
/** Nazwa wykresu bez `ariaLabel` i bez tytułu. */
|
|
221
|
+
label: string;
|
|
222
|
+
/** Podpis ukrytej tabeli z danymi wykresu. */
|
|
223
|
+
dataTable: string;
|
|
224
|
+
/** Nagłówek kolumny etykiet w tabeli danych. */
|
|
225
|
+
category: string;
|
|
226
|
+
};
|
|
227
|
+
clock: {
|
|
228
|
+
/** Nazwa segmentu godzin (spinbutton) i tarczy w etapie godzin. */
|
|
229
|
+
hours: string;
|
|
230
|
+
/** Nazwa segmentu minut (spinbutton) i tarczy w etapie minut. */
|
|
231
|
+
minutes: string;
|
|
232
|
+
};
|
|
206
233
|
datepicker: {
|
|
207
234
|
prevMonth: string;
|
|
208
235
|
nextMonth: string;
|
|
@@ -220,6 +247,10 @@ export interface KptMessages {
|
|
|
220
247
|
time: string;
|
|
221
248
|
/** Nazwa panelu kalendarza (dialog). */
|
|
222
249
|
dialog: string;
|
|
250
|
+
/** Litery placeholdera: rok, miesiąc, dzień (EN `YYYY`/`MM`/`DD`, PL `RRRR`/`MM`/`DD`). */
|
|
251
|
+
yearToken: string;
|
|
252
|
+
monthToken: string;
|
|
253
|
+
dayToken: string;
|
|
223
254
|
};
|
|
224
255
|
pickList: {
|
|
225
256
|
available: string;
|
|
@@ -228,10 +259,14 @@ export interface KptMessages {
|
|
|
228
259
|
moveRight: string;
|
|
229
260
|
moveLeft: string;
|
|
230
261
|
moveAllLeft: string;
|
|
262
|
+
/** Ogłoszenie po przeniesieniu. Interpolacja: {count}, {list} (nagłówek listy docelowej). */
|
|
263
|
+
moved: string;
|
|
231
264
|
};
|
|
232
265
|
orderList: {
|
|
233
266
|
up: string;
|
|
234
267
|
down: string;
|
|
268
|
+
/** Ogłoszenie po przestawieniu. Interpolacja: {position}, {total}. */
|
|
269
|
+
moved: string;
|
|
235
270
|
};
|
|
236
271
|
inputNumber: {
|
|
237
272
|
decrement: string;
|
|
@@ -511,6 +546,8 @@ export interface KptMessages {
|
|
|
511
546
|
newMessages: string;
|
|
512
547
|
unread: string;
|
|
513
548
|
empty: string;
|
|
549
|
+
/** Nazwa przewijanej historii rozmowy (`role="log"`), osiągalnej z klawiatury. */
|
|
550
|
+
history: string;
|
|
514
551
|
send: string;
|
|
515
552
|
placeholder: string;
|
|
516
553
|
attach: string;
|
package/dist/messages.js
CHANGED
|
@@ -49,6 +49,7 @@ export const KPT_MESSAGES_EN = {
|
|
|
49
49
|
milestone: 'Milestone',
|
|
50
50
|
expandGroup: 'Expand group',
|
|
51
51
|
collapseGroup: 'Collapse group',
|
|
52
|
+
progress: '{percent}% complete',
|
|
52
53
|
},
|
|
53
54
|
map: {
|
|
54
55
|
addLocation: 'Add location',
|
|
@@ -135,6 +136,8 @@ export const KPT_MESSAGES_EN = {
|
|
|
135
136
|
min: 'min',
|
|
136
137
|
max: 'max',
|
|
137
138
|
editCell: 'Edit: {column}',
|
|
139
|
+
moveColumn: 'Move column: {column}',
|
|
140
|
+
columnMoved: '{column}: position {position} of {count}',
|
|
138
141
|
total: 'Total',
|
|
139
142
|
},
|
|
140
143
|
confirm: {
|
|
@@ -143,7 +146,8 @@ export const KPT_MESSAGES_EN = {
|
|
|
143
146
|
reject: 'Cancel',
|
|
144
147
|
},
|
|
145
148
|
fileUpload: {
|
|
146
|
-
hint: '
|
|
149
|
+
hint: '{action} or drag files here',
|
|
150
|
+
hintAction: 'Click',
|
|
147
151
|
remove: 'Remove',
|
|
148
152
|
},
|
|
149
153
|
chipsInput: {
|
|
@@ -169,6 +173,15 @@ export const KPT_MESSAGES_EN = {
|
|
|
169
173
|
pickEnd: 'Start: {date}. Choose the end date.',
|
|
170
174
|
picked: 'Range: {start} – {end}',
|
|
171
175
|
},
|
|
176
|
+
chart: {
|
|
177
|
+
label: 'Chart',
|
|
178
|
+
dataTable: 'Chart data',
|
|
179
|
+
category: 'Category',
|
|
180
|
+
},
|
|
181
|
+
clock: {
|
|
182
|
+
hours: 'Hours',
|
|
183
|
+
minutes: 'Minutes',
|
|
184
|
+
},
|
|
172
185
|
datepicker: {
|
|
173
186
|
prevMonth: 'Previous month',
|
|
174
187
|
nextMonth: 'Next month',
|
|
@@ -185,6 +198,9 @@ export const KPT_MESSAGES_EN = {
|
|
|
185
198
|
month: 'Month',
|
|
186
199
|
time: 'Time',
|
|
187
200
|
dialog: 'Choose a date',
|
|
201
|
+
yearToken: 'YYYY',
|
|
202
|
+
monthToken: 'MM',
|
|
203
|
+
dayToken: 'DD',
|
|
188
204
|
},
|
|
189
205
|
pickList: {
|
|
190
206
|
available: 'Available',
|
|
@@ -193,10 +209,12 @@ export const KPT_MESSAGES_EN = {
|
|
|
193
209
|
moveRight: 'Move right',
|
|
194
210
|
moveLeft: 'Move left',
|
|
195
211
|
moveAllLeft: 'Move all left',
|
|
212
|
+
moved: 'Moved {count} to {list}',
|
|
196
213
|
},
|
|
197
214
|
orderList: {
|
|
198
215
|
up: 'Up',
|
|
199
216
|
down: 'Down',
|
|
217
|
+
moved: 'Moved to position {position} of {total}',
|
|
200
218
|
},
|
|
201
219
|
inputNumber: {
|
|
202
220
|
decrement: 'Decrease',
|
|
@@ -426,6 +444,7 @@ export const KPT_MESSAGES_EN = {
|
|
|
426
444
|
newMessages: '{count} new messages',
|
|
427
445
|
unread: 'Unread messages',
|
|
428
446
|
empty: 'No messages yet',
|
|
447
|
+
history: 'Conversation history',
|
|
429
448
|
send: 'Send',
|
|
430
449
|
placeholder: 'Write a message…',
|
|
431
450
|
attach: 'Attach a file',
|
|
@@ -482,6 +501,7 @@ export const KPT_MESSAGES_PL = {
|
|
|
482
501
|
milestone: 'Kamień milowy',
|
|
483
502
|
expandGroup: 'Rozwiń grupę',
|
|
484
503
|
collapseGroup: 'Zwiń grupę',
|
|
504
|
+
progress: 'ukończono {percent}%',
|
|
485
505
|
},
|
|
486
506
|
map: {
|
|
487
507
|
addLocation: 'Dodaj lokalizację',
|
|
@@ -568,6 +588,8 @@ export const KPT_MESSAGES_PL = {
|
|
|
568
588
|
min: 'min',
|
|
569
589
|
max: 'max',
|
|
570
590
|
editCell: 'Edytuj: {column}',
|
|
591
|
+
moveColumn: 'Przesuń kolumnę: {column}',
|
|
592
|
+
columnMoved: '{column}: pozycja {position} z {count}',
|
|
571
593
|
total: 'Razem',
|
|
572
594
|
},
|
|
573
595
|
confirm: {
|
|
@@ -576,7 +598,8 @@ export const KPT_MESSAGES_PL = {
|
|
|
576
598
|
reject: 'Anuluj',
|
|
577
599
|
},
|
|
578
600
|
fileUpload: {
|
|
579
|
-
hint: '
|
|
601
|
+
hint: '{action} lub przeciągnij pliki tutaj',
|
|
602
|
+
hintAction: 'Kliknij',
|
|
580
603
|
remove: 'Usuń',
|
|
581
604
|
},
|
|
582
605
|
chipsInput: {
|
|
@@ -602,6 +625,15 @@ export const KPT_MESSAGES_PL = {
|
|
|
602
625
|
pickEnd: 'Początek: {date}. Wybierz datę końcową.',
|
|
603
626
|
picked: 'Zakres: {start} – {end}',
|
|
604
627
|
},
|
|
628
|
+
chart: {
|
|
629
|
+
label: 'Wykres',
|
|
630
|
+
dataTable: 'Dane wykresu',
|
|
631
|
+
category: 'Kategoria',
|
|
632
|
+
},
|
|
633
|
+
clock: {
|
|
634
|
+
hours: 'Godziny',
|
|
635
|
+
minutes: 'Minuty',
|
|
636
|
+
},
|
|
605
637
|
datepicker: {
|
|
606
638
|
prevMonth: 'Poprzedni miesiąc',
|
|
607
639
|
nextMonth: 'Następny miesiąc',
|
|
@@ -618,6 +650,9 @@ export const KPT_MESSAGES_PL = {
|
|
|
618
650
|
month: 'Miesiąc',
|
|
619
651
|
time: 'Godzina',
|
|
620
652
|
dialog: 'Wybierz datę',
|
|
653
|
+
yearToken: 'RRRR',
|
|
654
|
+
monthToken: 'MM',
|
|
655
|
+
dayToken: 'DD',
|
|
621
656
|
},
|
|
622
657
|
pickList: {
|
|
623
658
|
available: 'Dostępne',
|
|
@@ -626,10 +661,12 @@ export const KPT_MESSAGES_PL = {
|
|
|
626
661
|
moveRight: 'Przenieś w prawo',
|
|
627
662
|
moveLeft: 'Przenieś w lewo',
|
|
628
663
|
moveAllLeft: 'Przenieś wszystko w lewo',
|
|
664
|
+
moved: 'Przeniesiono {count} do: {list}',
|
|
629
665
|
},
|
|
630
666
|
orderList: {
|
|
631
667
|
up: 'W górę',
|
|
632
668
|
down: 'W dół',
|
|
669
|
+
moved: 'Przeniesiono na pozycję {position} z {total}',
|
|
633
670
|
},
|
|
634
671
|
inputNumber: {
|
|
635
672
|
decrement: 'Zmniejsz',
|
|
@@ -859,6 +896,7 @@ export const KPT_MESSAGES_PL = {
|
|
|
859
896
|
newMessages: '{count} nowych wiadomości',
|
|
860
897
|
unread: 'Nieprzeczytane',
|
|
861
898
|
empty: 'Brak wiadomości',
|
|
899
|
+
history: 'Historia rozmowy',
|
|
862
900
|
send: 'Wyślij',
|
|
863
901
|
placeholder: 'Napisz wiadomość…',
|
|
864
902
|
attach: 'Dołącz plik',
|
package/dist/types.d.ts
CHANGED
|
@@ -14,3 +14,14 @@ export interface KptI18nConfig {
|
|
|
14
14
|
*/
|
|
15
15
|
messages?: Record<string, DeepPartial<KptMessages>>;
|
|
16
16
|
}
|
|
17
|
+
/** Ścieżki liści drzewa w notacji kropkowej (`'paginator.range'`); tablice napisów są liśćmi. */
|
|
18
|
+
type LeafPaths<T, Prefix extends string = ''> = {
|
|
19
|
+
[K in keyof T & string]: T[K] extends string | readonly string[] ? `${Prefix}${K}` : LeafPaths<T[K], `${Prefix}${K}.`>;
|
|
20
|
+
}[keyof T & string];
|
|
21
|
+
/**
|
|
22
|
+
* Klucz tłumaczenia słownika bazowego (`'paginator.range'`, `'common.close'`…). `t()` przyjmuje go
|
|
23
|
+
* z podpowiedziami w edytorze, ale nadal też dowolny napis — klucze składane dynamicznie i klucze
|
|
24
|
+
* własnych słowników aplikacji.
|
|
25
|
+
*/
|
|
26
|
+
export type KptMessageKey = LeafPaths<KptMessages>;
|
|
27
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konce-pt/i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Translation contract and base dictionaries (EN, PL) for Koncept UI — shared by the Angular and React ports. Pure TypeScript, zero runtime dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "konce.pt",
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -p tsconfig.build.json",
|
|
42
|
+
"test": "node --test \"src/**/*.test.ts\"",
|
|
43
|
+
"lint": "eslint .",
|
|
42
44
|
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
|
|
43
45
|
}
|
|
44
46
|
}
|