Skip to content

Commit

Permalink
Warn user when language will not change (#3517)
Browse files Browse the repository at this point in the history
* "DisplayOfMessage"

* "DisplayOfMessage"
  • Loading branch information
falgun143 authored Jan 5, 2024
1 parent 063466d commit c353d12
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 9 deletions.
28 changes: 19 additions & 9 deletions js/languagebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,13 @@ class LanguageBox {
* @public
* @returns {void}
*/
OnClick() {
this.activity.storage.languagePreference = this._language;
window.location.reload();
}
hide() {
const MSGPrefix =
"<a href='#' " +
"onClick='window.location.reload()'" +
"<a href='#' class='language-link' " +
"onMouseOver='this.style.opacity = 0.5'" +
"onMouseOut='this.style.opacity = 1'>";
const MSGSuffix = "</a>";
Expand All @@ -212,13 +215,20 @@ class LanguageBox {
quz: "Actualice su navegador para cambiar su preferencia de idioma.",
gug: "Actualice su navegador para cambiar su preferencia de idioma."
};

this.activity.storage.languagePreference = this._language;

if (this._language === "ja" && this.activity.storage.kanaPreference === "kana") {
this.activity.textMsg(MSGPrefix + MSG["kana"] + MSGSuffix);
} else {
this.activity.textMsg(MSGPrefix + MSG[this._language] + MSGSuffix);
if (localStorage.getItem("languagePreference") === this._language) {
this.activity.textMsg(_("Music Blocks is already set to this language."));
}
else{
if (this._language === "ja" && this.activity.storage.kanaPreference === "kana") {
this.activity.textMsg(MSGPrefix + MSG["kana"] + MSGSuffix);
} else {
this.activity.textMsg(MSGPrefix + MSG[this._language] + MSGSuffix);
}
}

const languageLinks = document.querySelectorAll('.language-link');
languageLinks.forEach(link => {
link.addEventListener('click', () => this.OnClick());
});
}
}
3 changes: 3 additions & 0 deletions po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,9 @@ msgid "Expand"
msgstr "التوسيع"

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr تم تعيين كتل الموسيقى بالفعل على هذه اللغة."

msgid "Refresh your browser to change your language preference."
msgstr "أعد فتح الصفحة لتغير لغة التطبيق"

Expand Down
5 changes: 5 additions & 0 deletions po/ayc.po
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,11 @@ msgstr ""

#: js/languagebox.js:188
#.TRANS: Actualice su navegador para cambiar su preferencia de idioma.

msgid "Music Blocks is already set to this language."
msgstr "Music Blocks ya está configurado en este idioma."


msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ msgid "Expand"
msgstr "Expandir"

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "Music Blocks ya está configurado en este idioma."

msgid "Refresh your browser to change your language preference."
msgstr "Actualice su navegador para cambiar su preferencia de idioma."

Expand Down
4 changes: 4 additions & 0 deletions po/gug.po
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,10 @@ msgstr ""

#: js/languagebox.js:188
#.TRANS: Actualice su navegador para cambiar su preferencia de idioma.
msgid "Music Blocks is already set to this language."
msgstr "Music Blocks ya está configurado en este idioma."


msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
4 changes: 4 additions & 0 deletions po/he.po
Original file line number Diff line number Diff line change
Expand Up @@ -2399,6 +2399,10 @@ msgid "Expand"
msgstr ""

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "Music Blocks כבר מוגדר לשפה זו."


msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions po/hi.po
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ msgid "Expand"
msgstr "विस्तार"

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr " म्यूजिक ब्लॉक्स पहले से ही इस भाषा पर सेट है।"

msgid "Refresh your browser to change your language preference."
msgstr "अपनी भाषा पसंद बदलने के लिए अपने ब्राउज़र को रिफ़्रेश करें।"

Expand Down
3 changes: 3 additions & 0 deletions po/ibo.po
Original file line number Diff line number Diff line change
Expand Up @@ -2401,6 +2401,9 @@ msgid "Expand"
msgstr ""

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "మ్యూజిక్ బ్లాక్స్ ఇప్పటికే ఈ భాషకు సెట్ అయింది."

msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ msgid "Expand"
msgstr "カンバスをかくだい"

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr " Music Blocksは既にこの言語に設定されています。"

msgid "Refresh your browser to change your language preference."
msgstr "言語を変えるには、ブラウザをこうしんしてください。"

Expand Down
3 changes: 3 additions & 0 deletions po/ko.po
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ msgid "Expand"
msgstr ""

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "뮤직 블록스는 이미 이 언어로 설정되어 있습니다."

msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions po/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,9 @@ msgid "Expand"
msgstr "Expandir"

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "O Music Blocks já está configurado para este idioma."

msgid "Refresh your browser to change your language preference."
msgstr "Atualize a página do seu navegador para mudar as preferências de idioma"

Expand Down
3 changes: 3 additions & 0 deletions po/quz.po
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,9 @@ msgid "Expand"
msgstr ""

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "Music Blocks ya está configurado en este idioma."

msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions po/te.po
Original file line number Diff line number Diff line change
Expand Up @@ -2399,6 +2399,9 @@ msgid "Expand"
msgstr "విస్తరించు"

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "మ్యూజిక్ బ్లాక్స్ ఇప్పటికే ఈ భాషకు సెట్ అయింది."

msgid "Refresh your browser to change your language preference."
msgstr "మీ భాషా ఇచ్చేందుకు మీ బ్రౌజర్‌ను రిఫ్రెష్ చేయండి"

Expand Down
3 changes: 3 additions & 0 deletions po/th.po
Original file line number Diff line number Diff line change
Expand Up @@ -2399,6 +2399,9 @@ msgid "Expand"
msgstr ""

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "Music Blocks ได้รับการตั้งค่าเป็นภาษานี้แล้ว"

msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions po/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,9 @@ msgid "Expand"
msgstr ""

#: js/languagebox.js:188
msgid "Music Blocks is already set to this language."
msgstr "音乐积木已设置为该语言"

msgid "Refresh your browser to change your language preference."
msgstr ""

Expand Down

0 comments on commit c353d12

Please sign in to comment.