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

View file

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

View file

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

View file

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

View file

@ -43,23 +43,53 @@ export class TranslateServiceWrapper extends TranslateService {
export class LocaleService { export class LocaleService {
private logger: Logger private logger: Logger
static readonly allLocales = [ static allLanguages = [
'en-US', {
'da-DK', code: 'de-DE',
'de-DE', name: 'Deutsch',
'es-ES', },
'fr-FR', {
'hr-HR', code: 'en-US',
'it-IT', name: 'English',
'ja-JP', },
'pl-PL', {
'ru-RU', code: 'es-ES',
'zh-CN', name: 'Español',
'zh-TW', },
{
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> { get localeChanged$ (): Observable<string> {
return this.localeChanged.pipe(distinctUntilChanged()) return this.localeChanged.pipe(distinctUntilChanged())
} }
@ -80,53 +110,6 @@ export class LocaleService {
this.refresh() 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', {}) this.translate.setTranslation('en-US', {})
} }
@ -134,7 +117,7 @@ export class LocaleService {
let lang = this.config.store.language let lang = this.config.store.language
if (!lang) { if (!lang) {
for (const systemLanguage of navigator.languages) { 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 lang = systemLanguage
} }
} }

View file

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

View file

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