use languages' native names

This commit is contained in:
Eugene Pankov 2022-02-10 18:03:26 +01:00
parent b6a3af80fa
commit fe5193d9f1
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
7 changed files with 51 additions and 99 deletions

View file

@ -150,12 +150,6 @@ msgstr ""
msgid "Check for updates"
msgstr ""
msgid "Chinese (simplified)"
msgstr ""
msgid "Chinese (traditional)"
msgstr ""
msgid "Ciphers"
msgstr ""
@ -261,9 +255,6 @@ msgstr ""
msgid "Could not decrypt config"
msgstr ""
msgid "Croatian"
msgstr ""
msgid "Current"
msgstr ""
@ -426,9 +417,6 @@ msgstr ""
msgid "End of the line"
msgstr ""
msgid "English"
msgstr ""
msgid "Environment"
msgstr ""
@ -510,9 +498,6 @@ msgstr ""
msgid "Forwarded ports"
msgstr ""
msgid "French"
msgstr ""
msgid "From color scheme"
msgstr ""
@ -531,9 +516,6 @@ msgstr ""
msgid "Generate a pre-filled GitHub issue"
msgstr ""
msgid "German"
msgstr ""
msgid "Get"
msgstr ""
@ -618,12 +600,6 @@ msgstr ""
msgid "Invalid syntax"
msgstr ""
msgid "Italian"
msgstr ""
msgid "Japanese"
msgstr ""
msgid "Jump host"
msgstr ""
@ -900,9 +876,6 @@ msgstr ""
msgid "Plugins folder"
msgstr ""
msgid "Polish"
msgstr ""
msgid "Port"
msgstr ""
@ -1038,9 +1011,6 @@ msgstr ""
msgid "Run as administrator"
msgstr ""
msgid "Russian"
msgstr ""
msgid "SOCKS proxy"
msgstr ""
@ -1208,9 +1178,6 @@ msgstr ""
msgid "Source code"
msgstr ""
msgid "Spanish"
msgstr ""
msgid "Split"
msgstr ""

View file

@ -13,7 +13,7 @@
option([ngValue]='null', translate) Automatic
option(
[value]='lang.code',
*ngFor='let lang of locale.allLanguages'
*ngFor='let lang of allLanguages'
) {{lang.name|translate}}
.form-line

View file

@ -13,6 +13,7 @@ import { LocaleService } from '../services/locale.service'
})
export class WelcomeTabComponent extends BaseTabComponent {
enableGlobalHotkey = true
allLanguages = LocaleService.allLanguages
constructor (
public config: ConfigService,

View file

@ -82,7 +82,7 @@ const PROVIDERS = [
},
{
provide: MESSAGE_FORMAT_CONFIG,
useValue: LocaleService.allLocales,
useValue: LocaleService.allLanguages.map(x => x.code),
},
{
provide: TranslateService,

View file

@ -43,23 +43,53 @@ export class TranslateServiceWrapper extends TranslateService {
export class LocaleService {
private logger: Logger
static readonly allLocales = [
'en-US',
'da-DK',
'de-DE',
'es-ES',
'fr-FR',
'hr-HR',
'it-IT',
'ja-JP',
'pl-PL',
'ru-RU',
'zh-CN',
'zh-TW',
static allLanguages = [
{
code: 'de-DE',
name: 'Deutsch',
},
{
code: 'en-US',
name: 'English',
},
{
code: 'es-ES',
name: 'Español',
},
{
code: 'fr-FR',
name: 'Français',
},
{
code: 'hr-HR',
name: 'Hrvatski',
},
{
code: 'it-IT',
name: 'Italiano',
},
{
code: 'pl-PL',
name: 'Polski',
},
{
code: 'ru-RU',
name: 'Русский',
},
{
code: 'ja-JP',
name: '日本語',
},
{
code: 'zh-CN',
name: '中文(简体)',
},
{
code: 'zh-TW',
name: '中文 (繁體)',
},
]
readonly allLanguages: { code: string, name: string }[]
get localeChanged$ (): Observable<string> {
return this.localeChanged.pipe(distinctUntilChanged())
}
@ -80,53 +110,6 @@ export class LocaleService {
this.refresh()
})
this.allLanguages = [
{
code: 'en-US',
name: translate.instant('English'),
},
{
code: 'zh-CN',
name: translate.instant('Chinese (simplified)'),
},
{
code: 'zh-TW',
name: translate.instant('Chinese (traditional)'),
},
{
code: 'hr-HR',
name: translate.instant('Croatian'),
},
{
code: 'de-DE',
name: translate.instant('German'),
},
{
code: 'fr-FR',
name: translate.instant('French'),
},
{
code: 'ja-JP',
name: translate.instant('Japanese'),
},
{
code: 'it-IT',
name: translate.instant('Italian'),
},
{
code: 'pl-PL',
name: translate.instant('Polish'),
},
{
code: 'ru-RU',
name: translate.instant('Russian'),
},
{
code: 'es-ES',
name: translate.instant('Spanish'),
},
]
this.translate.setTranslation('en-US', {})
}
@ -134,7 +117,7 @@ export class LocaleService {
let lang = this.config.store.language
if (!lang) {
for (const systemLanguage of navigator.languages) {
if (!lang && this.allLanguages.some(x => x.code === systemLanguage)) {
if (!lang && LocaleService.allLanguages.some(x => x.code === systemLanguage)) {
lang = systemLanguage
}
}

View file

@ -73,7 +73,7 @@
option([ngValue]='null', translate) Automatic
option(
[value]='lang.code',
*ngFor='let lang of locale.allLanguages'
*ngFor='let lang of allLanguages'
) {{lang.name|translate}}
.form-line(*ngIf='platform.isShellIntegrationSupported()')

View file

@ -37,6 +37,7 @@ export class SettingsTabComponent extends BaseTabComponent {
checkingForUpdate = false
updateAvailable = false
showConfigDefaults = false
allLanguages = LocaleService.allLanguages
@HostBinding('class.pad-window-controls') padWindowControls = false
constructor (