mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-24 00:36:17 -04:00
Merge branch 'translate' into next
This commit is contained in:
commit
037dab1e46
22 changed files with 814 additions and 381 deletions
|
@ -1,7 +1,7 @@
|
|||
class Localization {
|
||||
constructor() {
|
||||
Localization.defaultLocale = "en";
|
||||
Localization.supportedLocales = ["ar", "de", "en", "es", "fr", "id", "it", "ja", "nb", "nl", "ro", "ru", "tr", "zh-CN"];
|
||||
Localization.supportedLocales = ["ar", "de", "en", "es", "fr", "id", "it", "ja", "nb", "nl", "ro", "ru", "tr", "zh-CN","pt-BR"];
|
||||
Localization.supportedLocalesRtl = ["ar"];
|
||||
|
||||
Localization.translations = {};
|
||||
|
|
|
@ -763,7 +763,7 @@ class LanguageSelectDialog extends Dialog {
|
|||
this.$languageSelectBtn = $('language-selector');
|
||||
this.$languageSelectBtn.addEventListener('click', _ => this.show());
|
||||
|
||||
this.$languageButtons = this.$el.querySelectorAll(".language-buttons button");
|
||||
this.$languageButtons = this.$el.querySelectorAll(".language-buttons .btn");
|
||||
this.$languageButtons.forEach($btn => {
|
||||
$btn.addEventListener("click", e => this.selectLanguage(e));
|
||||
})
|
||||
|
@ -779,22 +779,22 @@ class LanguageSelectDialog extends Dialog {
|
|||
}
|
||||
|
||||
show() {
|
||||
if (Localization.isSystemLocale()) {
|
||||
this.$languageButtons[0].focus();
|
||||
}
|
||||
else {
|
||||
let locale = Localization.getLocale();
|
||||
for (let i=0; i<this.$languageButtons.length; i++) {
|
||||
const $btn = this.$languageButtons[i];
|
||||
if ($btn.value === locale) {
|
||||
$btn.focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let locale = Localization.getLocale();
|
||||
this.currentLanguageBtn = Localization.isSystemLocale()
|
||||
? this.$languageButtons[0]
|
||||
: this.$el.querySelector(`.btn[value="${locale}"]`);
|
||||
|
||||
this.currentLanguageBtn.classList.add("current");
|
||||
|
||||
super.show();
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.currentLanguageBtn.classList.remove("current");
|
||||
|
||||
super.hide();
|
||||
}
|
||||
|
||||
selectLanguage(e) {
|
||||
e.preventDefault()
|
||||
let languageCode = e.target.value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue