UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

226 lines (222 loc) 9.53 kB
/*! * KoliBri - The accessible HTML-Standard */ var locale_de = { error: 'Fehler', warning: 'Warnung', info: 'Hinweis', success: 'Erfolg', message: 'Nachricht', close: 'Schließen', 'form-description': 'Formular-Felder, die mit einem Sternchen (*) gekennzeichnet sind, sind Pflichtangaben.', new: 'Neu', 'no-entries': 'Es sind keine Einträge vorhanden.', 'change-order': 'Sortierung von {{colLabel}} ändern', 'action-running': 'Aktion wird ausgeführt...', 'action-done': 'Aktion abgeschlossen', pagination: 'Paginierung', 'page-first': 'Direkt zur ersten Seite', 'page-back': 'Eine Seite zurück', 'page-next': 'Eine Seite weiter', 'page-last': 'Direkt zur letzten Seite', 'entries-per-site': 'Einträge pro Seite', page: 'Seite', 'page-current': 'Seite {{page}}', 'page-selected': 'Seite {{page}} ist ausgewählt', 'page-per-site': 'Einträge pro Seite', 'nav-maximize': 'Navigation maximieren', 'nav-minimize': 'Navigation minimieren', 'logo-description': 'Logo {{orgShort}}. Bundesadler mit Flaggenstab und Schriftzug {{orgLong}}', 'open-link-in-tab': 'Öffnet in neuem Tab.', 'kolibri-logo': 'Logo von KoliBri', 'table-pagination-label': 'Paginierung für die Tabelle {{label}}', 'table-sort-order': 'Priorität {{order}}', 'avatar-alt': 'Avatar von {{name}}', 'split-button-dropdown-label-open': 'Optionen anzeigen', 'split-button-dropdown-label-close': 'Optionen schließen', 'toast-close-all': 'Alle Benachrichtigungen schließen', 'error-list': 'Fehlerliste', 'error-list-message': 'Bitte korrigieren Sie folgende Fehler:', version: 'Versionsnummer', 'table-visible-range': 'Einträge {{start}} bis {{end}} von {{total}}', 'table-selection-all': 'Alle auswählen', 'table-selection-none': 'Alle abwählen', 'table-selection-indeterminate': 'Alle auswählen bei teilweiser Auswahl', 'table-settings': 'Tabellenkonfiguration', 'table-settings-cancel': 'Abbrechen', 'table-settings-apply': 'Übernehmen', 'table-settings-show-column': 'Spalte {{column}} anzeigen', 'table-settings-column-width': 'Breite von {{column}}', 'table-settings-move-up': 'Spalte {{column}} nach oben verschieben', 'table-settings-move-down': 'Spalte {{column}} nach unten verschieben', 'table-settings-error-all-invisible': 'Mindestens eine Spalte muss sichtbar sein.', 'table-settings-column-not-hidable': 'nicht ausblendbar', dropdown: 'Auswahlliste', 'nav-label-open': 'Untermenü zu {{label}} öffnen', 'nav-label-close': 'Untermenü zu {{label}} schließen', 'close-alert': 'Benachrichtigung schließen', 'show-password': 'einblenden', 'hide-password': 'ausblenden', 'no-results-message': 'Keine Ergebnisse gefunden.', 'delete-selection': 'Auswahl entfernen', 'filename-text': 'Datei auswählen oder hier ablegen...', 'data-browse-text': 'Datei auswählen', sort: 'sortieren', 'pagination-position-top': 'oben', 'pagination-position-bottom': 'unten', 'character-limit-hint': 'Es können bis zu {{limit}} Zeichen eingegeben werden.', 'character-limit-remaining': 'Es sind noch {{remaining}} Zeichen verfügbar.', 'character-limit-exceeded': 'Es sind {{over}} Zeichen zu viel.', 'character-counter-current': '{{current}} Zeichen', 'character-counter-current-of-max': '{{current}}/{{max}} Zeichen', 'character-counter-current-of-max-aria': '{{current}} von {{max}} Zeichen', 'live-value-bounded': '{{value}} von {{max}} {{unit}}', 'live-value': '{{value}} {{unit}}', readonly: 'schreibgeschützt', 'meter-state-optimum': 'Optimal', 'meter-state-suboptimal': 'Suboptimal', 'meter-state-critical': 'Kritisch', }; var locale_en = { error: 'Error', warning: 'Warning', info: 'Note', success: 'Success', message: 'Message', close: 'Close', 'form-description': 'Form fields marked with an asterisk (*) are mandatory.', new: 'New', 'no-entries': 'No entries available.', 'change-order': 'Change order of {{colLabel}}', 'action-running': 'Action is running...', 'action-done': 'Action done', pagination: 'Pagination', 'page-first': 'Directly to the first page', 'page-back': 'One page back', 'page-next': 'One page further', 'page-last': 'Directly to the last page', 'entries-per-site': 'Entries per page', page: 'Page', 'page-current': 'Page {{page}}', 'page-selected': 'Page {{page}} is selected', 'page-per-site': 'Entries per page', 'nav-maximize': 'Maximize navigation', 'nav-minimize': 'Minimize navigation', 'logo-description': 'Logo {{orgShort}}. Federal eagle with flag staff and lettering {{orgLong}}', 'open-link-in-tab': 'Opens in new tab.', 'kolibri-logo': 'KoliBri logo', 'table-pagination-label': 'Pagination for table {{label}}', 'table-sort-order': 'Priority {{order}}', 'avatar-alt': 'Avatar of {{name}}', 'split-button-dropdown-label-open': 'Show options', 'split-button-dropdown-label-close': 'Hide options', 'toast-close-all': 'Close all notifications', 'error-list': 'Error list', 'error-list-message': 'Please correct the following errors', version: 'Version number', 'table-visible-range': 'Entries {{start}} to {{end}} of {{total}}', 'table-selection-all': 'Select all', 'table-selection-none': 'Deselect all', 'table-selection-indeterminate': 'Select all with partial selection', 'table-settings': 'Table configuration', 'table-settings-cancel': 'Cancel', 'table-settings-apply': 'Apply', 'table-settings-show-column': 'Show column {{column}}', 'table-settings-column-width': '{{column}} width', 'table-settings-move-up': 'Move {{column}} column up', 'table-settings-move-down': 'Move {{column}} column down', 'table-settings-error-all-invisible': 'At least one column must be visible.', 'table-settings-column-not-hidable': 'cannot be hidden', dropdown: 'Dropdown', 'nav-label-open': 'Submenu for {{label}} open', 'nav-label-close': 'Submenu for {{label}} close', 'close-alert': 'Close notification', 'show-password': 'Show', 'hide-password': 'Hide', 'no-results-message': 'No results found.', 'delete-selection': 'Delete selection', 'filename-text': 'Choose a file or drop it here...', 'data-browse-text': 'Browse', sort: 'sort', 'pagination-position-top': 'top', 'pagination-position-bottom': 'bottom', 'character-limit-hint': 'You can enter up to {{limit}} characters', 'character-limit-remaining': 'You have {{remaining}} characters remaining.', 'character-limit-exceeded': 'You have {{over}} characters too many.', 'character-counter-current': '{{current}} characters', 'character-counter-current-of-max': '{{current}}/{{max}} characters', 'character-counter-current-of-max-aria': '{{current}} of {{max}} characters', 'live-value-bounded': '{{value}} of {{max}} {{unit}}', 'live-value': '{{value}} {{unit}}', readonly: 'read-only', 'meter-state-optimum': 'Optimum', 'meter-state-suboptimal': 'Suboptimal', 'meter-state-critical': 'Critical', }; const mapLocaleKeys = (locale) => Object.keys(locale).reduce((a, c) => ((a[`${'kol'}-${c}`] = locale[c]), a), {}); const TRANSLATIONS = new Set([ (t) => t('en', mapLocaleKeys(locale_en)), (t) => t('de', mapLocaleKeys(locale_de)), ]); const replaceAll = function (text, search, replacement) { return text.split(search).join(replacement); }; class I18nService { constructor(initialLanguage) { this.resourceMap = new Map(); this.language = initialLanguage !== null && initialLanguage !== void 0 ? initialLanguage : 'de'; } addTranslations(translations) { if (Array.isArray(translations)) { translations = new Set(translations); } else if (typeof translations === 'function') { translations = new Set([translations]); } if (translations !== undefined) { translations.forEach((t) => t((l, t) => { let resources = this.resourceMap.get(l); if (!resources) { resources = new Map(); this.resourceMap.set(l, resources); } Object.entries(t).forEach(([k, v]) => { if (v) { resources.set(k, v); } }); return l; })); } } setLanguage(lng) { this.language = lng; } translate(key, options) { var _a; let result = (_a = this.resourceMap.get(this.language)) === null || _a === void 0 ? void 0 : _a.get(key); if (result) { if (options === null || options === void 0 ? void 0 : options.placeholders) { Object.entries(options.placeholders).forEach(([k, v]) => { result = replaceAll(result, `{{${k}}}`, v); }); } } else { result = key; } return result; } } let i18n; const getI18nInstance = () => { return i18n; }; const initializeI18n = (lng, translations = TRANSLATIONS) => { i18n = new I18nService(lng); i18n.addTranslations(translations); return i18n; }; export { getI18nInstance as g, initializeI18n as i }; //# sourceMappingURL=i18n2.js.map //# sourceMappingURL=i18n2.js.map