Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable Arabic, French, Turkish, Traditional Chinese translations #1323

Merged
merged 4 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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