Files
start-os/web/projects/shared/src/i18n/i18n.providers.ts
Aiden McClelland c65db31fd9 Feature/consolidate setup (#3092)
* start consolidating

* add start-cli flash-os

* combine install and setup and refactor all

* use http

* undo mock

* fix translation

* translations

* use dialogservice wrapper

* better ST messaging on setup

* only warn on update if breakages (#3097)

* finish setup wizard and ui language-keyboard feature

* fix typo

* wip: localization

* remove start-tunnel readme

* switch to posix strings for language internal

* revert mock

* translate backend strings

* fix missing about text

* help text for args

* feat: add "Add new gateway" option (#3098)

* feat: add "Add new gateway" option

* Update web/projects/ui/src/app/routes/portal/components/form/controls/select.component.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* add translation

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Matt Hill <mattnine@protonmail.com>

* fix dns selection

* keyboard keymap also

* ability to shutdown after install

* revert mock

* working setup flow + manifest localization

* (mostly) redundant localization on frontend

* version bump

* omit live medium from disk list and better space management

* ignore missing package archive on 035 migration

* fix device migration

* add i18n helper to sdk

* fix install over 0.3.5.1

* fix grub config

---------

Co-authored-by: Matt Hill <mattnine@protonmail.com>
Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
Co-authored-by: Alex Inkin <alexander@inkin.ru>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-27 14:44:41 -08:00

65 lines
1.9 KiB
TypeScript

import { forwardRef, InjectionToken, signal } from '@angular/core'
import { tuiProvide } from '@taiga-ui/cdk'
import {
TuiLanguageName,
tuiLanguageSwitcher,
TuiLanguageSwitcherService,
} from '@taiga-ui/i18n'
import { ENGLISH } from './dictionaries/en'
import { i18nService, Languages } from './i18n.service'
export type i18nKey = keyof typeof ENGLISH
export type i18n = Record<(typeof ENGLISH)[i18nKey], string>
export const I18N = new InjectionToken('', {
factory: () => signal<i18n | null>(null),
})
export const I18N_LOADER = new InjectionToken<
(lang: TuiLanguageName) => Promise<i18n>
>('')
export const I18N_STORAGE = new InjectionToken<
(lang: Languages) => Promise<void>
>('', {
factory: () => () => Promise.resolve(),
})
export const I18N_PROVIDERS = [
tuiLanguageSwitcher(async (language: TuiLanguageName): Promise<unknown> => {
switch (language) {
case 'spanish':
return import('@taiga-ui/i18n/languages/spanish')
case 'polish':
return import('@taiga-ui/i18n/languages/polish')
case 'german':
return import('@taiga-ui/i18n/languages/german')
case 'french':
return import('@taiga-ui/i18n/languages/french')
default:
return import('@taiga-ui/i18n/languages/english')
}
}),
{
provide: I18N_LOADER,
useValue: async (language: TuiLanguageName): Promise<unknown> => {
switch (language) {
case 'spanish':
return import('./dictionaries/es').then(v => v.default)
case 'polish':
return import('./dictionaries/pl').then(v => v.default)
case 'german':
return import('./dictionaries/de').then(v => v.default)
case 'french':
return import('./dictionaries/fr').then(v => v.default)
default:
return null
}
},
},
tuiProvide(
TuiLanguageSwitcherService,
forwardRef(() => i18nService),
),
]