Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit a5e8f99

Browse files
committed
fix: for binary bot unsupported lnguages
1 parent b3a1c5d commit a5e8f99

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

gulp/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ gulp.task(
8686
gulp.task(
8787
'pull-blockly-translations',
8888
gulp.series(done => {
89-
const blocklyLanguages = ['en', 'id', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant'];
89+
const blocklyLanguages = ['en', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant'];
9090
remoteSrc(
9191
blocklyLanguages.map(lang => `${lang}.js?_=${Date.now()}`),
9292
{

src/common/i18n.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import es from './translations/es_ES/i10n.json';
1111
import fr from './translations/fr_FR/i10n.json';
1212
import en from './translations/en/i10n.json';
1313
import ach from './translations/ach_UG/i10n.json';
14-
import id from './translations/id_ID/i10n.json';
1514

1615
export const supportedLanguages = {
1716
zh_tw: zhTw,
@@ -25,7 +24,6 @@ export const supportedLanguages = {
2524
fr,
2625
en,
2726
ach,
28-
id,
2927
};
3028

3129
const fallbackLang = en;

src/common/lang.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import BotLanding from '../indexPage/react-components/bot-landing';
1010
const elements = ['#notification-banner', '#main', '#footer', '#header'];
1111
export const getLanguage = () => {
1212
const queryLang = parseQueryString().l;
13-
const lang = queryLang in supportedLanguages ? queryLang : getStorage('lang') || 'en';
13+
const checkIsSupported = queryLang in supportedLanguages;
14+
const un_supported_languages = ['id', 'tr'];
15+
const checkLanguageNotSupported = () =>
16+
un_supported_languages.includes(queryLang) ? 'en' : getStorage('lang') || 'en';
17+
const lang = checkIsSupported ? queryLang : checkLanguageNotSupported();
1418
setStorage('lang', lang);
1519
setCookieLanguage(lang);
1620
return lang;
@@ -31,7 +35,6 @@ const addUiLang = () => {
3135
export const load = () => {
3236
if (typeof $ !== 'function') return; // Adding this check to skip unit test
3337
const lang = getLanguage();
34-
3538
$('#select_language li:not(:first)').click(function click() {
3639
const newLang = $(this).attr('class');
3740
if (

0 commit comments

Comments
 (0)