athena-ui-js 2.5.0 → 2.6.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.
@@ -1,352 +1,354 @@
1
- //i18n for Athena UI
2
- //Author: Csaba Tóth https://github.com/csabatibortoth/
3
- //LICENCE: MIT
4
- //Repository: https://github.com/csabatibortoth/athena-ui
5
-
6
- // Every text generated by Athena UI goes through translate(), so an application can switch
7
- // the language with setLocale() or override single texts with addMessages().
8
-
9
- const messages = {
10
- en: {
11
- username: "Username",
12
- password: "Password",
13
- email: "Email",
14
- confirmPassword: "Confirm password",
15
- currentPassword: "Current password",
16
- newPassword: "New password",
17
- login: "Login",
18
- register: "Register",
19
- resetPassword: "Reset password",
20
- changePassword: "Change password",
21
- rememberMe: "Remember me",
22
- ok: "OK",
23
- save: "Save",
24
- "widget.move": "Move {title}",
25
- "widget.settings": "Settings of {title}",
26
- "widget.duplicate": "Duplicate {title}",
27
- "widget.remove": "Remove {title}",
28
- "widget.copy": "{title} (copy)",
29
- "widget.titleLabel": "Title",
30
- "widget.settingsTitle": "Widget settings",
31
- "widget.unknown": "Unknown widget type \"{type}\".",
32
- "widget.failed": "This widget could not be shown.",
33
- "widget.pickedUp": "{title} picked up. Arrow keys move it, Shift with arrow keys resizes it, Enter drops it, Escape cancels.",
34
- "widget.dropped": "{title} dropped.",
35
- "widget.cancelled": "Cancelled.",
36
- "widget.blocked": "Not possible here.",
37
- "widget.position": "Column {x}, row {y}, {w} wide, {h} high.",
38
- "widget.added": "{title} added.",
39
- "widget.removed": "{title} removed.",
40
- "form.checkFields": "Check the marked fields",
41
- "code.copy": "Copy",
42
- "code.copied": "Copied",
43
- "code.copyFailed": "Copy failed",
44
- "code.diff": "Differences",
45
- "code.original": "Original",
46
- "code.modified": "Modified",
47
- "code.unchanged": "{count} unchanged lines",
48
- "code.removed": "removed",
49
- "code.added": "added",
50
- "code.noChanges": "No differences.",
51
- "code.editorLabel": "Code editor",
52
- "code.escapeHint": "Press Escape, then Tab, to leave the editor.",
53
- "code.tabLeaves": "The next Tab key leaves the editor.",
54
- "code.find": "Find",
55
- "code.replaceWith": "Replace with",
56
- "code.next": "Next match",
57
- "code.previous": "Previous match",
58
- "code.replaceOne": "Replace",
59
- "code.replaceAll": "Replace all",
60
- "code.close": "Close",
61
- "code.matchCase": "Match case",
62
- "code.useRegex": "Regular expression",
63
- "code.matches": "{current} of {total}",
64
- "code.noMatches": "No matches",
65
- "code.invalidPattern": "Invalid pattern",
66
- "code.position": "Line {line}, column {column}",
67
- "code.marker": "Line {line}: {message}",
68
- "code.suggestions": "Suggestions",
69
- "range.preset": "Range",
70
- "range.custom": "Custom",
71
- "range.last15m": "Last 15 minutes",
72
- "range.last1h": "Last hour",
73
- "range.last24h": "Last 24 hours",
74
- "range.last7d": "Last 7 days",
75
- "range.last30d": "Last 30 days",
76
- copied: "Copied",
77
- copyFailed: "Copying is not possible here.",
78
- "tone.ok": "good",
79
- "tone.warn": "warning",
80
- "tone.bad": "critical",
81
- "chart.zoomHint": "Chart plot. Plus and minus zoom, arrow keys move, 0 resets.",
82
- "chart.resetZoom": "Reset zoom",
83
- menu: "Main menu",
84
- showAsTable: "Show as table",
85
- series: "Series",
86
- time: "Time",
87
- "chart.bar": "Bar chart",
88
- "chart.line": "Line chart",
89
- "chart.area": "Area chart",
90
- "chart.sparkline": "Trend",
91
- "chart.pie": "Pie chart",
92
- "chart.donut": "Donut chart",
93
- actions: "Actions",
94
- retry: "Retry",
95
- loadMore: "Load more",
96
- theme: "Theme",
97
- mode: "Mode",
98
- typeToConfirm: "Type {text} to confirm:",
99
- textMismatch: "The text does not match.",
100
- cancel: "Cancel",
101
- close: "Close",
102
- back: "Back",
103
- next: "Next",
104
- finish: "Finish",
105
- previous: "Prev",
106
- page: "Page {page} / {pages}",
107
- filter: "Filter...",
108
- noData: "No data",
109
- loading: "Loading...",
110
- selectAll: "Select all",
111
- search: "Search...",
112
- noResults: "No results",
113
- dropFiles: "Drop files here or click to browse",
114
- "validation.required": "This field is required.",
115
- "validation.email": "Enter a valid email address.",
116
- "validation.minLength": { one: "Enter at least {min} character.", other: "Enter at least {min} characters." },
117
- "validation.maxLength": { one: "Enter at most {max} character.", other: "Enter at most {max} characters." },
118
- "validation.pattern": "The value has an invalid format.",
119
- "validation.min": "The value must be at least {min}.",
120
- "validation.max": "The value must be at most {max}.",
121
- "validation.match": "The values do not match.",
122
- "validation.invalid": "The value is invalid.",
123
- "validation.fileSize": "{name} is larger than {max}.",
124
- "validation.maxFiles": { one: "At most {max} file is accepted.", other: "At most {max} files are accepted." },
125
- "validation.url": "Enter a valid address (https://, mailto: or tel:).",
126
- "validation.dateRange": "The end date must not be before the start date.",
127
- "validation.dateMin": "The date must be {min} or later.",
128
- "validation.dateMax": "The date must be {max} or earlier.",
129
- "session.loggedOut": "You have been logged out.",
130
- dateFrom: "From",
131
- dateTo: "To",
132
- resizeColumn: "Resize column",
133
- more: "More",
134
- "rt.toolbar": "Text formatting",
135
- "rt.bold": "Bold",
136
- "rt.italic": "Italic",
137
- "rt.underline": "Underline",
138
- "rt.strike": "Strikethrough",
139
- "rt.heading2": "Heading 2",
140
- "rt.heading3": "Heading 3",
141
- "rt.quote": "Quote",
142
- "rt.bulletList": "Bulleted list",
143
- "rt.numberList": "Numbered list",
144
- "rt.link": "Link",
145
- "rt.unlink": "Remove link",
146
- "rt.clear": "Clear formatting",
147
- "rt.undo": "Undo",
148
- "rt.redo": "Redo",
149
- "rt.linkPrompt": "Link address",
150
- "rt.source": "HTML source"
151
- },
152
- hu: {
153
- username: "Felhasználónév",
154
- password: "Jelszó",
155
- email: "E-mail",
156
- confirmPassword: "Jelszó megerősítése",
157
- currentPassword: "Jelenlegi jelszó",
158
- newPassword: "Új jelszó",
159
- login: "Belépés",
160
- register: "Regisztráció",
161
- resetPassword: "Jelszó visszaállítása",
162
- changePassword: "Jelszó módosítása",
163
- rememberMe: "Emlékezz rám",
164
- ok: "OK",
165
- save: "Mentés",
166
- "widget.move": "{title} áthelyezése",
167
- "widget.settings": "{title} beállításai",
168
- "widget.duplicate": "{title} másolása",
169
- "widget.remove": "{title} eltávolítása",
170
- "widget.copy": "{title} (másolat)",
171
- "widget.titleLabel": "Cím",
172
- "widget.settingsTitle": "Widget beállításai",
173
- "widget.unknown": "Ismeretlen widgettípus: \"{type}\".",
174
- "widget.failed": "Ez a widget nem jeleníthető meg.",
175
- "widget.pickedUp": "{title} felvéve. A nyilak mozgatják, Shift és nyilak átméretezik, Enter leteszi, Escape megszakítja.",
176
- "widget.dropped": "{title} letéve.",
177
- "widget.cancelled": "Megszakítva.",
178
- "widget.blocked": "Itt nem lehetséges.",
179
- "widget.position": "{x}. oszlop, {y}. sor, {w} széles, {h} magas.",
180
- "widget.added": "{title} hozzáadva.",
181
- "widget.removed": "{title} eltávolítva.",
182
- "form.checkFields": "Ellenőrizze a megjelölt mezőket",
183
- "code.copy": "Másolás",
184
- "code.copied": "Másolva",
185
- "code.copyFailed": "A másolás nem sikerült",
186
- "code.diff": "Különbségek",
187
- "code.original": "Eredeti",
188
- "code.modified": "Módosított",
189
- "code.unchanged": "{count} változatlan sor",
190
- "code.removed": "törölve",
191
- "code.added": "hozzáadva",
192
- "code.noChanges": "Nincs különbség.",
193
- "code.editorLabel": "Kódszerkesztő",
194
- "code.escapeHint": "A szerkesztőből az Escape, majd a Tab billentyűvel lehet kilépni.",
195
- "code.tabLeaves": "A következő Tab kilép a szerkesztőből.",
196
- "code.find": "Keresés",
197
- "code.replaceWith": "Csere erre",
198
- "code.next": "Következő találat",
199
- "code.previous": "Előző találat",
200
- "code.replaceOne": "Csere",
201
- "code.replaceAll": "Összes cseréje",
202
- "code.close": "Bezárás",
203
- "code.matchCase": "Kis- és nagybetű",
204
- "code.useRegex": "Reguláris kifejezés",
205
- "code.matches": "{current} / {total}",
206
- "code.noMatches": "Nincs találat",
207
- "code.invalidPattern": "Érvénytelen minta",
208
- "code.position": "{line}. sor, {column}. oszlop",
209
- "code.marker": "{line}. sor: {message}",
210
- "code.suggestions": "Javaslatok",
211
- "range.preset": "Időszak",
212
- "range.custom": "Egyéni",
213
- "range.last15m": "Utolsó 15 perc",
214
- "range.last1h": "Utolsó óra",
215
- "range.last24h": "Utolsó 24 óra",
216
- "range.last7d": "Utolsó 7 nap",
217
- "range.last30d": "Utolsó 30 nap",
218
- copied: "Másolva",
219
- copyFailed: "A másolás itt nem lehetséges.",
220
- "tone.ok": "rendben",
221
- "tone.warn": "figyelmeztetés",
222
- "tone.bad": "kritikus",
223
- "chart.zoomHint": "A diagram területe. A plusz és a mínusz nagyít, a nyilak mozgatnak, a 0 visszaállít.",
224
- "chart.resetZoom": "Nagyítás visszaállítása",
225
- menu: "Főmenü",
226
- showAsTable: "Megjelenítés táblázatként",
227
- series: "Adatsor",
228
- time: "Idő",
229
- "chart.bar": "Oszlopdiagram",
230
- "chart.line": "Vonaldiagram",
231
- "chart.area": "Területdiagram",
232
- "chart.sparkline": "Trend",
233
- "chart.pie": "Kördiagram",
234
- "chart.donut": "Fánkdiagram",
235
- actions: "Műveletek",
236
- retry: "Újra",
237
- loadMore: "Továbbiak betöltése",
238
- theme: "Téma",
239
- mode: "Mód",
240
- typeToConfirm: "A megerősítéshez írja be: {text}",
241
- textMismatch: "A szöveg nem egyezik.",
242
- cancel: "Mégse",
243
- close: "Bezár",
244
- back: "Vissza",
245
- next: "Tovább",
246
- finish: "Befejezés",
247
- previous: "Előző",
248
- page: "{page}. oldal / {pages}",
249
- filter: "Szűrés...",
250
- noData: "Nincs adat",
251
- loading: "Betöltés...",
252
- selectAll: "Összes kijelölése",
253
- search: "Keresés...",
254
- noResults: "Nincs találat",
255
- dropFiles: "Húzza ide a fájlokat vagy kattintson a tallózáshoz",
256
- "validation.required": "A mező kitöltése kötelező.",
257
- "validation.email": "Adjon meg érvényes e-mail címet.",
258
- "validation.minLength": "Legalább {min} karakter szükséges.",
259
- "validation.maxLength": "Legfeljebb {max} karakter adható meg.",
260
- "validation.pattern": "Az érték formátuma érvénytelen.",
261
- "validation.min": "Az érték legalább {min} legyen.",
262
- "validation.max": "Az érték legfeljebb {max} lehet.",
263
- "validation.match": "Az értékek nem egyeznek.",
264
- "validation.invalid": "Érvénytelen érték.",
265
- "validation.fileSize": "{name} mérete meghaladja a {max} értéket.",
266
- "validation.maxFiles": "Legfeljebb {max} fájl fogadható el.",
267
- "validation.url": "Adjon meg érvényes címet (https://, mailto: vagy tel:).",
268
- "validation.dateRange": "A záró dátum nem lehet korábbi a kezdő dátumnál.",
269
- "validation.dateMin": "A dátum legkorábban {min} lehet.",
270
- "validation.dateMax": "A dátum legkésőbb {max} lehet.",
271
- "session.loggedOut": "Kijelentkezett.",
272
- dateFrom: "Ettől",
273
- dateTo: "Eddig",
274
- resizeColumn: "Oszlop átméretezése",
275
- more: "Továbbiak",
276
- "rt.toolbar": "Szövegformázás",
277
- "rt.bold": "Félkövér",
278
- "rt.italic": "Dőlt",
279
- "rt.underline": "Aláhúzott",
280
- "rt.strike": "Áthúzott",
281
- "rt.heading2": "2. szintű cím",
282
- "rt.heading3": "3. szintű cím",
283
- "rt.quote": "Idézet",
284
- "rt.bulletList": "Felsorolás",
285
- "rt.numberList": "Számozott lista",
286
- "rt.link": "Hivatkozás",
287
- "rt.unlink": "Hivatkozás törlése",
288
- "rt.clear": "Formázás törlése",
289
- "rt.undo": "Visszavonás",
290
- "rt.redo": "Újra",
291
- "rt.linkPrompt": "Hivatkozás címe",
292
- "rt.source": "HTML forrás"
293
- }
294
- };
295
-
296
- let locale = "en";
297
-
298
- export function setLocale(newLocale) {
299
- locale = newLocale;
300
- }
301
-
302
- export function getLocale() {
303
- return locale;
304
- }
305
-
306
- // Adds or overrides texts of a locale: addMessages("de", { login: "Anmelden" })
307
- export function addMessages(forLocale, texts) {
308
- messages[forLocale] = { ...messages[forLocale], ...texts };
309
- }
310
-
311
- // The plural category of a count in a language ("one", "other", and for some languages "zero", "two", "few", "many"), from Intl.PluralRules.
312
- function pluralCategory(count) {
313
- try {
314
- return new Intl.PluralRules(locale).select(Number(count));
315
- } catch {
316
- return "other";
317
- }
318
- }
319
-
320
- // A text of a message: a string, or an object with the plural forms ({ one: "...", other: "..." })
321
- function pick(text, params) {
322
- if (typeof text === "string" || text == null) return text;
323
- const count = params.count;
324
- const category = count == null ? "other" : pluralCategory(count);
325
- // The exact number wins ("0": "No files"), then the category, then "other"
326
- return text[String(count)] ?? text[category] ?? text.other ?? Object.values(text)[0];
327
- }
328
-
329
- /**
330
- * Looks a text up in the current locale, then in its base language ("hu-HU" -> "hu"), then in English.
331
- * Unknown keys are returned as they are.
332
- *
333
- * Placeholders: {name} is replaced from params as it is, {name:number} is formatted as a number and {name:date} as a date, in the current language (Intl).
334
- * Plural forms: a message can be an object with the forms of the language, and the form is chosen by `params.count`:
335
- *
336
- * addMessages("en", { files: { zero: "No files", one: "{count} file", other: "{count:number} files" } });
337
- * translate("files", { count: 1200 }) // "1,200 files"
338
- *
339
- * The keys are the categories of Intl.PluralRules for the language ("one", "other", and where the language has them "zero", "two", "few", "many"),
340
- * or an exact number ("0"). "other" is the fallback.
341
- */
342
- export function translate(key, params = {}) {
343
- const found = messages[locale]?.[key] ?? messages[locale.split("-")[0]]?.[key] ?? messages.en[key];
344
- const text = pick(found, params) ?? key;
345
- return text.replace(/\{(\w+)(?::(number|date))?\}/g, (match, name, format) => {
346
- const value = params[name];
347
- if (value == null) return match;
348
- if (format === "number") return new Intl.NumberFormat(locale).format(Number(value));
349
- if (format === "date") return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(value instanceof Date ? value : new Date(value));
350
- return value;
351
- });
352
- }
1
+ //i18n for Athena UI
2
+ //Author: Csaba Tóth https://github.com/csabatibortoth/
3
+ //LICENCE: MIT
4
+ //Repository: https://github.com/csabatibortoth/athena-ui
5
+
6
+ // Every text generated by Athena UI goes through translate(), so an application can switch
7
+ // the language with setLocale() or override single texts with addMessages().
8
+
9
+ const messages = {
10
+ en: {
11
+ username: "Username",
12
+ password: "Password",
13
+ email: "Email",
14
+ confirmPassword: "Confirm password",
15
+ currentPassword: "Current password",
16
+ newPassword: "New password",
17
+ login: "Login",
18
+ register: "Register",
19
+ resetPassword: "Reset password",
20
+ changePassword: "Change password",
21
+ rememberMe: "Remember me",
22
+ ok: "OK",
23
+ save: "Save",
24
+ "widget.move": "Move {title}",
25
+ "widget.settings": "Settings of {title}",
26
+ "widget.duplicate": "Duplicate {title}",
27
+ "widget.remove": "Remove {title}",
28
+ "widget.copy": "{title} (copy)",
29
+ "widget.titleLabel": "Title",
30
+ "widget.settingsTitle": "Widget settings",
31
+ "widget.unknown": "Unknown widget type \"{type}\".",
32
+ "widget.failed": "This widget could not be shown.",
33
+ "widget.pickedUp": "{title} picked up. Arrow keys move it, Shift with arrow keys resizes it, Enter drops it, Escape cancels.",
34
+ "widget.dropped": "{title} dropped.",
35
+ "widget.cancelled": "Cancelled.",
36
+ "widget.blocked": "Not possible here.",
37
+ "widget.position": "Column {x}, row {y}, {w} wide, {h} high.",
38
+ "widget.added": "{title} added.",
39
+ "widget.removed": "{title} removed.",
40
+ "form.checkFields": "Check the marked fields",
41
+ "code.copy": "Copy",
42
+ "code.copied": "Copied",
43
+ "code.copyFailed": "Copy failed",
44
+ "code.diff": "Differences",
45
+ "code.original": "Original",
46
+ "code.modified": "Modified",
47
+ "code.unchanged": "{count} unchanged lines",
48
+ "code.removed": "removed",
49
+ "code.added": "added",
50
+ "code.noChanges": "No differences.",
51
+ "code.editorLabel": "Code editor",
52
+ "code.escapeHint": "Press Escape, then Tab, to leave the editor.",
53
+ "code.tabLeaves": "The next Tab key leaves the editor.",
54
+ "code.find": "Find",
55
+ "code.replaceWith": "Replace with",
56
+ "code.next": "Next match",
57
+ "code.previous": "Previous match",
58
+ "code.replaceOne": "Replace",
59
+ "code.replaceAll": "Replace all",
60
+ "code.close": "Close",
61
+ "code.matchCase": "Match case",
62
+ "code.useRegex": "Regular expression",
63
+ "code.matches": "{current} of {total}",
64
+ "code.noMatches": "No matches",
65
+ "code.invalidPattern": "Invalid pattern",
66
+ "code.position": "Line {line}, column {column}",
67
+ "code.marker": "Line {line}: {message}",
68
+ "code.suggestions": "Suggestions",
69
+ "range.preset": "Range",
70
+ "range.custom": "Custom",
71
+ "range.last15m": "Last 15 minutes",
72
+ "range.last1h": "Last hour",
73
+ "range.last24h": "Last 24 hours",
74
+ "range.last7d": "Last 7 days",
75
+ "range.last30d": "Last 30 days",
76
+ copied: "Copied",
77
+ copyFailed: "Copying is not possible here.",
78
+ "tone.ok": "good",
79
+ "tone.warn": "warning",
80
+ "tone.bad": "critical",
81
+ "chart.zoomHint": "Chart plot. Plus and minus zoom, arrow keys move, 0 resets, Alt and an arrow key read the values.",
82
+ "chart.readHint": "Chart plot. The left and right arrow keys read the values one by one, Home and End go to the first and the last, Escape hides the tooltip.",
83
+ "chart.resetZoom": "Reset zoom",
84
+ menu: "Main menu",
85
+ showAsTable: "Show as table",
86
+ series: "Series",
87
+ time: "Time",
88
+ "chart.bar": "Bar chart",
89
+ "chart.line": "Line chart",
90
+ "chart.area": "Area chart",
91
+ "chart.sparkline": "Trend",
92
+ "chart.pie": "Pie chart",
93
+ "chart.donut": "Donut chart",
94
+ actions: "Actions",
95
+ retry: "Retry",
96
+ loadMore: "Load more",
97
+ theme: "Theme",
98
+ mode: "Mode",
99
+ typeToConfirm: "Type {text} to confirm:",
100
+ textMismatch: "The text does not match.",
101
+ cancel: "Cancel",
102
+ close: "Close",
103
+ back: "Back",
104
+ next: "Next",
105
+ finish: "Finish",
106
+ previous: "Prev",
107
+ page: "Page {page} / {pages}",
108
+ filter: "Filter...",
109
+ noData: "No data",
110
+ loading: "Loading...",
111
+ selectAll: "Select all",
112
+ search: "Search...",
113
+ noResults: "No results",
114
+ dropFiles: "Drop files here or click to browse",
115
+ "validation.required": "This field is required.",
116
+ "validation.email": "Enter a valid email address.",
117
+ "validation.minLength": { one: "Enter at least {min} character.", other: "Enter at least {min} characters." },
118
+ "validation.maxLength": { one: "Enter at most {max} character.", other: "Enter at most {max} characters." },
119
+ "validation.pattern": "The value has an invalid format.",
120
+ "validation.min": "The value must be at least {min}.",
121
+ "validation.max": "The value must be at most {max}.",
122
+ "validation.match": "The values do not match.",
123
+ "validation.invalid": "The value is invalid.",
124
+ "validation.fileSize": "{name} is larger than {max}.",
125
+ "validation.maxFiles": { one: "At most {max} file is accepted.", other: "At most {max} files are accepted." },
126
+ "validation.url": "Enter a valid address (https://, mailto: or tel:).",
127
+ "validation.dateRange": "The end date must not be before the start date.",
128
+ "validation.dateMin": "The date must be {min} or later.",
129
+ "validation.dateMax": "The date must be {max} or earlier.",
130
+ "session.loggedOut": "You have been logged out.",
131
+ dateFrom: "From",
132
+ dateTo: "To",
133
+ resizeColumn: "Resize column",
134
+ more: "More",
135
+ "rt.toolbar": "Text formatting",
136
+ "rt.bold": "Bold",
137
+ "rt.italic": "Italic",
138
+ "rt.underline": "Underline",
139
+ "rt.strike": "Strikethrough",
140
+ "rt.heading2": "Heading 2",
141
+ "rt.heading3": "Heading 3",
142
+ "rt.quote": "Quote",
143
+ "rt.bulletList": "Bulleted list",
144
+ "rt.numberList": "Numbered list",
145
+ "rt.link": "Link",
146
+ "rt.unlink": "Remove link",
147
+ "rt.clear": "Clear formatting",
148
+ "rt.undo": "Undo",
149
+ "rt.redo": "Redo",
150
+ "rt.linkPrompt": "Link address",
151
+ "rt.source": "HTML source"
152
+ },
153
+ hu: {
154
+ username: "Felhasználónév",
155
+ password: "Jelszó",
156
+ email: "E-mail",
157
+ confirmPassword: "Jelszó megerősítése",
158
+ currentPassword: "Jelenlegi jelszó",
159
+ newPassword: "Új jelszó",
160
+ login: "Belépés",
161
+ register: "Regisztráció",
162
+ resetPassword: "Jelszó visszaállítása",
163
+ changePassword: "Jelszó módosítása",
164
+ rememberMe: "Emlékezz rám",
165
+ ok: "OK",
166
+ save: "Mentés",
167
+ "widget.move": "{title} áthelyezése",
168
+ "widget.settings": "{title} beállításai",
169
+ "widget.duplicate": "{title} másolása",
170
+ "widget.remove": "{title} eltávolítása",
171
+ "widget.copy": "{title} (másolat)",
172
+ "widget.titleLabel": "Cím",
173
+ "widget.settingsTitle": "Widget beállításai",
174
+ "widget.unknown": "Ismeretlen widgettípus: \"{type}\".",
175
+ "widget.failed": "Ez a widget nem jeleníthető meg.",
176
+ "widget.pickedUp": "{title} felvéve. A nyilak mozgatják, Shift és nyilak átméretezik, Enter leteszi, Escape megszakítja.",
177
+ "widget.dropped": "{title} letéve.",
178
+ "widget.cancelled": "Megszakítva.",
179
+ "widget.blocked": "Itt nem lehetséges.",
180
+ "widget.position": "{x}. oszlop, {y}. sor, {w} széles, {h} magas.",
181
+ "widget.added": "{title} hozzáadva.",
182
+ "widget.removed": "{title} eltávolítva.",
183
+ "form.checkFields": "Ellenőrizze a megjelölt mezőket",
184
+ "code.copy": "Másolás",
185
+ "code.copied": "Másolva",
186
+ "code.copyFailed": "A másolás nem sikerült",
187
+ "code.diff": "Különbségek",
188
+ "code.original": "Eredeti",
189
+ "code.modified": "Módosított",
190
+ "code.unchanged": "{count} változatlan sor",
191
+ "code.removed": "törölve",
192
+ "code.added": "hozzáadva",
193
+ "code.noChanges": "Nincs különbség.",
194
+ "code.editorLabel": "Kódszerkesztő",
195
+ "code.escapeHint": "A szerkesztőből az Escape, majd a Tab billentyűvel lehet kilépni.",
196
+ "code.tabLeaves": "A következő Tab kilép a szerkesztőből.",
197
+ "code.find": "Keresés",
198
+ "code.replaceWith": "Csere erre",
199
+ "code.next": "Következő találat",
200
+ "code.previous": "Előző találat",
201
+ "code.replaceOne": "Csere",
202
+ "code.replaceAll": "Összes cseréje",
203
+ "code.close": "Bezárás",
204
+ "code.matchCase": "Kis- és nagybetű",
205
+ "code.useRegex": "Reguláris kifejezés",
206
+ "code.matches": "{current} / {total}",
207
+ "code.noMatches": "Nincs találat",
208
+ "code.invalidPattern": "Érvénytelen minta",
209
+ "code.position": "{line}. sor, {column}. oszlop",
210
+ "code.marker": "{line}. sor: {message}",
211
+ "code.suggestions": "Javaslatok",
212
+ "range.preset": "Időszak",
213
+ "range.custom": "Egyéni",
214
+ "range.last15m": "Utolsó 15 perc",
215
+ "range.last1h": "Utolsó óra",
216
+ "range.last24h": "Utolsó 24 óra",
217
+ "range.last7d": "Utolsó 7 nap",
218
+ "range.last30d": "Utolsó 30 nap",
219
+ copied: "Másolva",
220
+ copyFailed: "A másolás itt nem lehetséges.",
221
+ "tone.ok": "rendben",
222
+ "tone.warn": "figyelmeztetés",
223
+ "tone.bad": "kritikus",
224
+ "chart.zoomHint": "A diagram területe. A plusz és a mínusz nagyít, a nyilak mozgatnak, a 0 visszaállít, az Alt és egy nyíl az értékeket olvassa.",
225
+ "chart.readHint": "A diagram területe. A bal és a jobb nyíl egyenként olvassa az értékeket, a Home és az End az elsőre és az utolsóra ugrik, az Escape elrejti a súgót.",
226
+ "chart.resetZoom": "Nagyítás visszaállítása",
227
+ menu: "Főmenü",
228
+ showAsTable: "Megjelenítés táblázatként",
229
+ series: "Adatsor",
230
+ time: "Idő",
231
+ "chart.bar": "Oszlopdiagram",
232
+ "chart.line": "Vonaldiagram",
233
+ "chart.area": "Területdiagram",
234
+ "chart.sparkline": "Trend",
235
+ "chart.pie": "Kördiagram",
236
+ "chart.donut": "Fánkdiagram",
237
+ actions: "Műveletek",
238
+ retry: "Újra",
239
+ loadMore: "Továbbiak betöltése",
240
+ theme: "Téma",
241
+ mode: "Mód",
242
+ typeToConfirm: "A megerősítéshez írja be: {text}",
243
+ textMismatch: "A szöveg nem egyezik.",
244
+ cancel: "Mégse",
245
+ close: "Bezár",
246
+ back: "Vissza",
247
+ next: "Tovább",
248
+ finish: "Befejezés",
249
+ previous: "Előző",
250
+ page: "{page}. oldal / {pages}",
251
+ filter: "Szűrés...",
252
+ noData: "Nincs adat",
253
+ loading: "Betöltés...",
254
+ selectAll: "Összes kijelölése",
255
+ search: "Keresés...",
256
+ noResults: "Nincs találat",
257
+ dropFiles: "Húzza ide a fájlokat vagy kattintson a tallózáshoz",
258
+ "validation.required": "A mező kitöltése kötelező.",
259
+ "validation.email": "Adjon meg érvényes e-mail címet.",
260
+ "validation.minLength": "Legalább {min} karakter szükséges.",
261
+ "validation.maxLength": "Legfeljebb {max} karakter adható meg.",
262
+ "validation.pattern": "Az érték formátuma érvénytelen.",
263
+ "validation.min": "Az érték legalább {min} legyen.",
264
+ "validation.max": "Az érték legfeljebb {max} lehet.",
265
+ "validation.match": "Az értékek nem egyeznek.",
266
+ "validation.invalid": "Érvénytelen érték.",
267
+ "validation.fileSize": "{name} mérete meghaladja a {max} értéket.",
268
+ "validation.maxFiles": "Legfeljebb {max} fájl fogadható el.",
269
+ "validation.url": "Adjon meg érvényes címet (https://, mailto: vagy tel:).",
270
+ "validation.dateRange": "A záró dátum nem lehet korábbi a kezdő dátumnál.",
271
+ "validation.dateMin": "A dátum legkorábban {min} lehet.",
272
+ "validation.dateMax": "A dátum legkésőbb {max} lehet.",
273
+ "session.loggedOut": "Kijelentkezett.",
274
+ dateFrom: "Ettől",
275
+ dateTo: "Eddig",
276
+ resizeColumn: "Oszlop átméretezése",
277
+ more: "Továbbiak",
278
+ "rt.toolbar": "Szövegformázás",
279
+ "rt.bold": "Félkövér",
280
+ "rt.italic": "Dőlt",
281
+ "rt.underline": "Aláhúzott",
282
+ "rt.strike": "Áthúzott",
283
+ "rt.heading2": "2. szintű cím",
284
+ "rt.heading3": "3. szintű cím",
285
+ "rt.quote": "Idézet",
286
+ "rt.bulletList": "Felsorolás",
287
+ "rt.numberList": "Számozott lista",
288
+ "rt.link": "Hivatkozás",
289
+ "rt.unlink": "Hivatkozás törlése",
290
+ "rt.clear": "Formázás törlése",
291
+ "rt.undo": "Visszavonás",
292
+ "rt.redo": "Újra",
293
+ "rt.linkPrompt": "Hivatkozás címe",
294
+ "rt.source": "HTML forrás"
295
+ }
296
+ };
297
+
298
+ let locale = "en";
299
+
300
+ export function setLocale(newLocale) {
301
+ locale = newLocale;
302
+ }
303
+
304
+ export function getLocale() {
305
+ return locale;
306
+ }
307
+
308
+ // Adds or overrides texts of a locale: addMessages("de", { login: "Anmelden" })
309
+ export function addMessages(forLocale, texts) {
310
+ messages[forLocale] = { ...messages[forLocale], ...texts };
311
+ }
312
+
313
+ // The plural category of a count in a language ("one", "other", and for some languages "zero", "two", "few", "many"), from Intl.PluralRules.
314
+ function pluralCategory(count) {
315
+ try {
316
+ return new Intl.PluralRules(locale).select(Number(count));
317
+ } catch {
318
+ return "other";
319
+ }
320
+ }
321
+
322
+ // A text of a message: a string, or an object with the plural forms ({ one: "...", other: "..." })
323
+ function pick(text, params) {
324
+ if (typeof text === "string" || text == null) return text;
325
+ const count = params.count;
326
+ const category = count == null ? "other" : pluralCategory(count);
327
+ // The exact number wins ("0": "No files"), then the category, then "other"
328
+ return text[String(count)] ?? text[category] ?? text.other ?? Object.values(text)[0];
329
+ }
330
+
331
+ /**
332
+ * Looks a text up in the current locale, then in its base language ("hu-HU" -> "hu"), then in English.
333
+ * Unknown keys are returned as they are.
334
+ *
335
+ * Placeholders: {name} is replaced from params as it is, {name:number} is formatted as a number and {name:date} as a date, in the current language (Intl).
336
+ * Plural forms: a message can be an object with the forms of the language, and the form is chosen by `params.count`:
337
+ *
338
+ * addMessages("en", { files: { zero: "No files", one: "{count} file", other: "{count:number} files" } });
339
+ * translate("files", { count: 1200 }) // "1,200 files"
340
+ *
341
+ * The keys are the categories of Intl.PluralRules for the language ("one", "other", and where the language has them "zero", "two", "few", "many"),
342
+ * or an exact number ("0"). "other" is the fallback.
343
+ */
344
+ export function translate(key, params = {}) {
345
+ const found = messages[locale]?.[key] ?? messages[locale.split("-")[0]]?.[key] ?? messages.en[key];
346
+ const text = pick(found, params) ?? key;
347
+ return text.replace(/\{(\w+)(?::(number|date))?\}/g, (match, name, format) => {
348
+ const value = params[name];
349
+ if (value == null) return match;
350
+ if (format === "number") return new Intl.NumberFormat(locale).format(Number(value));
351
+ if (format === "date") return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(value instanceof Date ? value : new Date(value));
352
+ return value;
353
+ });
354
+ }