Skip to content

Commit

Permalink
feat: enable Arabic, French, Turkish, Traditional Chinese translations (
Browse files Browse the repository at this point in the history
appium#1323)

* fix: do not translate language codes

* feat: enable Arabic, French, Turkish, Chinese Traditional languages

* fix: distinguish Chinese language options
  • Loading branch information
eglitise authored Feb 5, 2024
1 parent 8b2cdc0 commit da41a1a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 46 deletions.
49 changes: 27 additions & 22 deletions app/configs/app.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import settings from '../shared/settings';

const languageList = [
{name: 'Arabic', code: 'ar', original: 'العربية'},
{name: 'Chinese Simplified', code: 'zh-CN', original: '中文简体'},
{name: 'Chinese Traditional', code: 'zh-TW', original: '中文繁體'},
{name: 'English', code: 'en', original: 'English'},
{name: 'French', code: 'fr', original: 'Française'},
{name: 'German', code: 'de', original: 'Deutsch'},
{name: 'Hindi', code: 'hi', original: 'हिंदी'},
{name: 'Hungarian', code: 'hu', original: 'Magyar'},
{name: 'Italian', code: 'it', original: 'Italiano'},
{name: 'Japanese', code: 'ja', original: '日本語'},
{name: 'Kannada', code: 'kn', original: 'ಕನ್ನಡ'},
{name: 'Korean', code: 'ko', original: '한국어'},
{name: 'Malayalam', code: 'ml-IN', original: 'മലയാളം'},
{name: 'Persian', code: 'fa', original: 'فارسی'},
{name: 'Polish', code: 'pl', original: 'Polski'},
{name: 'Portuguese', code: 'pt-PT', original: 'Português'},
{name: 'Portuguese (Brazil)', code: 'pt-BR', original: 'Português (Brasil)'},
{name: 'Russian', code: 'ru', original: 'Русский'},
{name: 'Spanish', code: 'es-ES', original: 'Español'},
{name: 'Telugu', code: 'te', original: 'తెలుగు'},
{name: 'Turkish', code: 'tr', original: 'Türk'},
{name: 'Ukrainian', code: 'uk', original: 'Українська'},
];

const config = {
platform: process.platform,
languages: [
'de',
'en',
'es-ES',
'fa',
'hi',
'hu',
'it',
'ja',
'ko',
'kn',
'ml-IN',
'pa-IN',
'pl',
'pt-BR',
'pt-PT',
'ru',
'te',
'uk',
'zh-CN',
],
languages: languageList.map((language) => language.code),
fallbackLng: 'en',
namespace: 'translation',
};
Expand All @@ -42,4 +47,4 @@ function getI18NextOptions(backend) {
}

export default config;
export {getI18NextOptions};
export {languageList, getI18NextOptions};
10 changes: 5 additions & 5 deletions app/main/menus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Menu, app, dialog, shell} from 'electron';

import config from '../configs/app.config';
import config, {languageList} from '../configs/app.config';
import i18n from '../configs/i18next.config';
import {checkNewUpdates} from './auto-updater';
import {APPIUM_SESSION_EXTENSION} from './helpers';
Expand All @@ -9,11 +9,11 @@ import {launchNewSessionWindow} from './windows';
let menuTemplates = {mac: {}, other: {}};

function languageMenu() {
return config.languages.map((languageCode) => ({
label: i18n.t(languageCode),
return languageList.map((language) => ({
label: `${language.name} (${language.original})`,
type: 'radio',
checked: i18n.language === languageCode,
click: () => i18n.changeLanguage(languageCode),
checked: i18n.language === language.code,
click: () => i18n.changeLanguage(language.code),
}));
}

Expand Down
19 changes: 0 additions & 19 deletions assets/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
{
"en": "English",
"de": "Deutsch",
"ru": "Русский",
"ja": "日本語",
"zh-CN": "中文",
"ko": "한국어",
"hi": "हिंदी",
"hu": "Magyar",
"kn": "ಕನ್ನಡ",
"ml-IN": "മലയാളം",
"pa-IN": "ਪੰਜਾਬੀ",
"te": "తెలుగు",
"pt-BR": "Português (Brasil)",
"pt-PT": "Português (Portugal)",
"it": "Italiano",
"es-ES": "Español",
"pl": "Polski",
"fa": "فارسی",
"uk": "Українська",
"appiumInspector": "Appium Inspector",
"Edit": "Edit",
"Redo": "Redo",
Expand Down

0 comments on commit da41a1a

Please sign in to comment.