This commit is contained in:
MichaelDvP
2022-10-31 11:10:20 +01:00
parent 1005079f71
commit ac75176292
7 changed files with 740 additions and 766 deletions

View File

@@ -1,5 +1,5 @@
{ {
"adapter": "react", "adapter": "react",
"baseLocale": "pl", "baseLocale": "pl",
"$schema": "https://unpkg.com/typesafe-i18n@5.14.0/schema/typesafe-i18n.json" "$schema": "https://unpkg.com/typesafe-i18n@5.15.0/schema/typesafe-i18n.json"
} }

File diff suppressed because it is too large Load Diff

View File

@@ -105,7 +105,7 @@ const de: Translation = {
BOARD_PROFILE: 'Platinenprofil', BOARD_PROFILE: 'Platinenprofil',
BUTTON: 'Taste', BUTTON: 'Taste',
TEMPERATURE: 'Temperatur', TEMPERATURE: 'Temperatur',
PHY_TYPE: 'Eth PHY Type', PHY_TYPE: 'Eth PHY Typ',
DISABLED: 'deaktiviert', DISABLED: 'deaktiviert',
TX_MODE: 'Tx Mode', TX_MODE: 'Tx Mode',
GENERAL_OPTIONS: 'Allgemeine Optionen', GENERAL_OPTIONS: 'Allgemeine Optionen',
@@ -177,7 +177,7 @@ const de: Translation = {
SYSTEM_VERSION_RUNNING: 'Sie verwenden die Version', SYSTEM_VERSION_RUNNING: 'Sie verwenden die Version',
SYSTEM_APPLY_FIRMWARE: 'um die neue Firmware anzuwenden', SYSTEM_APPLY_FIRMWARE: 'um die neue Firmware anzuwenden',
CLOSE: 'Schließen', CLOSE: 'Schließen',
USE: 'Verwenden', USE: 'Verwenden Sie',
FACTORY_RESET: 'Werkseinstellung', FACTORY_RESET: 'Werkseinstellung',
SYSTEM_FACTORY_TEXT: 'EMS-ESP wurde auf Werkseinstellung gesetzt und startet als Zugangspunkt neu', SYSTEM_FACTORY_TEXT: 'EMS-ESP wurde auf Werkseinstellung gesetzt und startet als Zugangspunkt neu',
SYSTEM_FACTORY_TEXT_DIALOG: 'Sind Sie sicher alle Einstellungen auf Werkseinstellung zu setzen?', SYSTEM_FACTORY_TEXT_DIALOG: 'Sind Sie sicher alle Einstellungen auf Werkseinstellung zu setzen?',
@@ -191,7 +191,7 @@ const de: Translation = {
PLATFORM: 'Platform (Platform / SDK)', PLATFORM: 'Platform (Platform / SDK)',
UPTIME: 'System Betriebszeit', UPTIME: 'System Betriebszeit',
CPU_FREQ: 'CPU Frequenz', CPU_FREQ: 'CPU Frequenz',
HEAP: 'RAM freier Speicher (Gesamt / max. Block)', HEAP: 'freier RAM Speicher (Gesamt / max. Block)',
PSRAM: 'PSRAM (Größe / Frei)', PSRAM: 'PSRAM (Größe / Frei)',
FLASH: 'Flash Speicher (Größe / Geschwindigkeit)', FLASH: 'Flash Speicher (Größe / Geschwindigkeit)',
APPSIZE: 'Programm (Genutzt / Frei)', APPSIZE: 'Programm (Genutzt / Frei)',
@@ -202,7 +202,7 @@ const de: Translation = {
DOWNLOAD_CUSTOMIZATION_TEXT: 'Herunterladen der individuellen Entitätsanpassungen', DOWNLOAD_CUSTOMIZATION_TEXT: 'Herunterladen der individuellen Entitätsanpassungen',
DOWNLOAD_SETTINGS_TEXT: DOWNLOAD_SETTINGS_TEXT:
'Herunterladen der Anwendungseinstellungen. Vorsicht beim Teilen der Einstellungen, da sie Passwörter und andere sensitive Einstellungen enthalten', 'Herunterladen der Anwendungseinstellungen. Vorsicht beim Teilen der Einstellungen, da sie Passwörter und andere sensitive Einstellungen enthalten',
UPLOAD_TEXT: 'Hochladen von neuer Firmware (.bin), Geräte- oder Entitätseinstellungen (.json)', UPLOAD_TEXT: 'Hochladen von neuer Firmware (.bin), Geräte- oder Entitätseinstellungen (.json), zur optionalen Validitätsprüfung zuerst die (.md5) Datei hochladen',
UPLOADING: 'Hochladen', UPLOADING: 'Hochladen',
UPLOAD_DROP_TEXT: 'Klicken Sie hier, oder ziehen eine Datei hierher', UPLOAD_DROP_TEXT: 'Klicken Sie hier, oder ziehen eine Datei hierher',
ERROR: 'Unerwarteter Fehler, bitter versuchen Sie es erneut', ERROR: 'Unerwarteter Fehler, bitter versuchen Sie es erneut',
@@ -259,9 +259,9 @@ const de: Translation = {
AP_PROVIDE_TEXT_3: 'Niemals', AP_PROVIDE_TEXT_3: 'Niemals',
AP_PREFERRED_CHANNEL: 'Bevorzugter Kanal', AP_PREFERRED_CHANNEL: 'Bevorzugter Kanal',
AP_HIDE_SSID: 'Verstecke SSID', AP_HIDE_SSID: 'Verstecke SSID',
AP_CLIENTS: 'AP Clients', AP_CLIENTS: 'AP-Klienten',
AP_MAX_CLIENTS: 'Max Clients', AP_MAX_CLIENTS: 'Max Anzahl AP-Klienten',
AP_LOCAL_IP: 'Local IP', AP_LOCAL_IP: 'Lokale IP',
NETWORK_SCAN: 'Suche nach WiFi Netzwerken', NETWORK_SCAN: 'Suche nach WiFi Netzwerken',
IDLE: 'Leerlauf', IDLE: 'Leerlauf',
LOST: 'Verloren', LOST: 'Verloren',
@@ -276,11 +276,11 @@ const de: Translation = {
NETWORK_LOW_BAND: 'Verwende niedrige WiFi Bandbreite', NETWORK_LOW_BAND: 'Verwende niedrige WiFi Bandbreite',
NETWORK_USE_DNS: 'Aktiviere mDNS Service', NETWORK_USE_DNS: 'Aktiviere mDNS Service',
NETWORK_ENABLE_IPV6: 'Aktiviere IPv6 Unterstützung', NETWORK_ENABLE_IPV6: 'Aktiviere IPv6 Unterstützung',
NETWORK_FIXED_IP: 'Feste IP Addresse', NETWORK_FIXED_IP: 'Feste IP Adresse',
NETWORK_GATEWAY: 'Getaway', NETWORK_GATEWAY: 'Gateway',
NETWORK_SUBNET: 'Subnet Mask', NETWORK_SUBNET: 'Subnetz Maske',
NETWORK_DNS: 'DNS Servers', NETWORK_DNS: 'DNS Server',
ADDRESS_OF: '{0} Address', ADDRESS_OF: '{0} Adresse',
ADMIN: 'Administrator', ADMIN: 'Administrator',
GUEST: 'Gast', GUEST: 'Gast',
NEW: 'Neuer', NEW: 'Neuer',

View File

@@ -203,7 +203,7 @@ const en: BaseTranslation = {
DOWNLOAD_CUSTOMIZATION_TEXT: 'Download the entity customizations', DOWNLOAD_CUSTOMIZATION_TEXT: 'Download the entity customizations',
DOWNLOAD_SETTINGS_TEXT: DOWNLOAD_SETTINGS_TEXT:
'Download the application settings. Be careful when sharing your settings as this file contains passwords and other sensitive system information', 'Download the application settings. Be careful when sharing your settings as this file contains passwords and other sensitive system information',
UPLOAD_TEXT: 'Upload a new firmware (.bin) file, settings or customizations (.json) file below', UPLOAD_TEXT: 'Upload a new firmware (.bin) file, settings or customizations (.json) file below, for optional validation upload (.md5) first',
UPLOADING: 'Uploading', UPLOADING: 'Uploading',
UPLOAD_DROP_TEXT: 'Drop file or click here', UPLOAD_DROP_TEXT: 'Drop file or click here',
ERROR: 'Unexpected Error, please try again', ERROR: 'Unexpected Error, please try again',

View File

@@ -632,7 +632,7 @@ type RootTranslation = {
*/ */
USER_CUSTOMIZATION: string USER_CUSTOMIZATION: string
/** /**
* Dodatkowe informacje * Informacje dotyczące wsparcia
*/ */
SUPPORT_INFORMATION: string SUPPORT_INFORMATION: string
/** /**
@@ -640,11 +640,11 @@ type RootTranslation = {
*/ */
CLICK_HERE: string CLICK_HERE: string
/** /**
* Skorzystaj z wiki w celu znalezienia szczegółowych instrukcji jak skonfigurować EMS-ESP * W celu znalezienia szczegółowych instrukcji jak skonfigurować EMS-ESP skorzystaj z wiki
*/ */
HELP_INFORMATION_1: string HELP_INFORMATION_1: string
/** /**
* Skorzystaj z serwera Discord w celu komunikacji na żywo ze społecznością * W celu komunikacji na żywo ze społecznością skorzystaj z serwera Discord
*/ */
HELP_INFORMATION_2: string HELP_INFORMATION_2: string
/** /**
@@ -652,7 +652,7 @@ type RootTranslation = {
*/ */
HELP_INFORMATION_3: string HELP_INFORMATION_3: string
/** /**
* gdy zgłaszasz problem, będzie on szybciej rozwiązany gdy do zgłoszenia dołączysz pełną informację o swoim systemie * zgłaszając problem, nie zapomnij dołączyć informacji o swoim systemie
*/ */
HELP_INFORMATION_4: string HELP_INFORMATION_4: string
/** /**
@@ -660,7 +660,7 @@ type RootTranslation = {
*/ */
HELP_INFORMATION_5: string HELP_INFORMATION_5: string
/** /**
* Dodatkowe informacje * Pobierz informacje
*/ */
SUPPORT_INFO: string SUPPORT_INFO: string
/** /**
@@ -673,7 +673,7 @@ type RootTranslation = {
*/ */
UPLOAD: string UPLOAD: string
/** /**
* {{P|p|}}obier{{anie|z|}} * {{P|p|P}}obier{{anie|z|z}}
*/ */
DOWNLOAD: string DOWNLOAD: string
/** /**
@@ -732,7 +732,7 @@ type RootTranslation = {
*/ */
SYSTEM_FACTORY_TEXT_DIALOG: string SYSTEM_FACTORY_TEXT_DIALOG: string
/** /**
* {{Sprawdź​ wersję|Sprawdzanie wersji|)}} * Sprawd{{​ź​|zanie|}} wersj{{​ę​|i|}}
*/ */
VERSION_CHECK: string VERSION_CHECK: string
/** /**
@@ -1743,7 +1743,7 @@ export type TranslationFunctions = {
*/ */
USER_CUSTOMIZATION: () => LocalizedString USER_CUSTOMIZATION: () => LocalizedString
/** /**
* Dodatkowe informacje * Informacje dotyczące wsparcia
*/ */
SUPPORT_INFORMATION: () => LocalizedString SUPPORT_INFORMATION: () => LocalizedString
/** /**
@@ -1751,11 +1751,11 @@ export type TranslationFunctions = {
*/ */
CLICK_HERE: () => LocalizedString CLICK_HERE: () => LocalizedString
/** /**
* Skorzystaj z wiki w celu znalezienia szczegółowych instrukcji jak skonfigurować EMS-ESP * W celu znalezienia szczegółowych instrukcji jak skonfigurować EMS-ESP skorzystaj z wiki
*/ */
HELP_INFORMATION_1: () => LocalizedString HELP_INFORMATION_1: () => LocalizedString
/** /**
* Skorzystaj z serwera Discord w celu komunikacji na żywo ze społecznością * W celu komunikacji na żywo ze społecznością skorzystaj z serwera Discord
*/ */
HELP_INFORMATION_2: () => LocalizedString HELP_INFORMATION_2: () => LocalizedString
/** /**
@@ -1763,7 +1763,7 @@ export type TranslationFunctions = {
*/ */
HELP_INFORMATION_3: () => LocalizedString HELP_INFORMATION_3: () => LocalizedString
/** /**
* gdy zgłaszasz problem, będzie on szybciej rozwiązany gdy do zgłoszenia dołączysz pełną informację o swoim systemie * zgłaszając problem, nie zapomnij dołączyć informacji o swoim systemie
*/ */
HELP_INFORMATION_4: () => LocalizedString HELP_INFORMATION_4: () => LocalizedString
/** /**
@@ -1771,7 +1771,7 @@ export type TranslationFunctions = {
*/ */
HELP_INFORMATION_5: () => LocalizedString HELP_INFORMATION_5: () => LocalizedString
/** /**
* Dodatkowe informacje * Pobierz informacje
*/ */
SUPPORT_INFO: () => LocalizedString SUPPORT_INFO: () => LocalizedString
/** /**
@@ -1783,7 +1783,7 @@ export type TranslationFunctions = {
*/ */
UPLOAD: () => LocalizedString UPLOAD: () => LocalizedString
/** /**
* {{P|p|}}obier{{anie|z|}} * {{P|p|P}}obier{{anie|z|z}}
*/ */
DOWNLOAD: (arg0: string | number | boolean) => LocalizedString DOWNLOAD: (arg0: string | number | boolean) => LocalizedString
/** /**
@@ -1840,7 +1840,7 @@ export type TranslationFunctions = {
*/ */
SYSTEM_FACTORY_TEXT_DIALOG: () => LocalizedString SYSTEM_FACTORY_TEXT_DIALOG: () => LocalizedString
/** /**
* {{Sprawdź wersję|Sprawdzanie wersji|)}} * Sprawd{{ź|zanie|}} wersj{{ę|i|}}
*/ */
VERSION_CHECK: (arg0: string | number | boolean) => LocalizedString VERSION_CHECK: (arg0: string | number | boolean) => LocalizedString
/** /**

View File

@@ -14,10 +14,10 @@ const localeTranslationLoaders = {
se: () => import('./se'), se: () => import('./se'),
} }
const updateDictionary = (locale: Locales, dictionary: Partial<Translations>) => const updateDictionary = (locale: Locales, dictionary: Partial<Translations>): Translations =>
loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary } loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary }
export const importLocaleAsync = async (locale: Locales) => export const importLocaleAsync = async (locale: Locales): Promise<Translations> =>
(await localeTranslationLoaders[locale]()).default as unknown as Translations (await localeTranslationLoaders[locale]()).default as unknown as Translations
export const loadLocaleAsync = async (locale: Locales): Promise<void> => { export const loadLocaleAsync = async (locale: Locales): Promise<void> => {

View File

@@ -3,6 +3,7 @@
import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from 'typesafe-i18n' import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from 'typesafe-i18n'
import type { LocaleDetector } from 'typesafe-i18n/detectors' import type { LocaleDetector } from 'typesafe-i18n/detectors'
import type { LocaleTranslationFunctions, TranslateByString } from 'typesafe-i18n'
import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors' import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors'
import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types' import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types'
@@ -17,21 +18,22 @@ export const locales: Locales[] = [
'se' 'se'
] ]
export const isLocale = (locale: string) => locales.includes(locale as Locales) export const isLocale = (locale: string): locale is Locales => locales.includes(locale as Locales)
export const loadedLocales = {} as Record<Locales, Translations> export const loadedLocales: Record<Locales, Translations> = {} as Record<Locales, Translations>
export const loadedFormatters = {} as Record<Locales, Formatters> export const loadedFormatters: Record<Locales, Formatters> = {} as Record<Locales, Formatters>
export const i18nString = (locale: Locales) => initI18nString<Locales, Formatters>(locale, loadedFormatters[locale]) export const i18nString = (locale: Locales): TranslateByString => initI18nString<Locales, Formatters>(locale, loadedFormatters[locale])
export const i18nObject = (locale: Locales) => export const i18nObject = (locale: Locales): TranslationFunctions =>
initI18nObject<Locales, Translations, TranslationFunctions, Formatters>( initI18nObject<Locales, Translations, TranslationFunctions, Formatters>(
locale, locale,
loadedLocales[locale], loadedLocales[locale],
loadedFormatters[locale] loadedFormatters[locale]
) )
export const i18n = () => initI18n<Locales, Translations, TranslationFunctions, Formatters>(loadedLocales, loadedFormatters) export const i18n = (): LocaleTranslationFunctions<Locales, Translations, TranslationFunctions> =>
initI18n<Locales, Translations, TranslationFunctions, Formatters>(loadedLocales, loadedFormatters)
export const detectLocale = (...detectors: LocaleDetector[]) => detectLocaleFn<Locales>(baseLocale, locales, ...detectors) export const detectLocale = (...detectors: LocaleDetector[]): Locales => detectLocaleFn<Locales>(baseLocale, locales, ...detectors)