fix language select (#2238)

This commit is contained in:
Utku 2024-03-23 19:30:26 -04:00 committed by GitHub
parent 1baa5966d7
commit d52b720a12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 25 deletions

View file

@ -1,4 +1,3 @@
import clsx from 'clsx';
import { Controller, FormProvider } from 'react-hook-form';
import {
useBridgeMutation,
@ -19,11 +18,7 @@ import Setting from '../Setting';
const NodePill = tw.div`px-1.5 py-[2px] rounded text-xs font-medium bg-app-selected`;
const NodeSettingLabel = tw.div`mb-1 text-xs font-medium`;
// https://doc.rust-lang.org/std/u16/index.html
const u16 = z.number().min(0).max(65_535);
// Unsorted list of languages available in the app.
// Make sure to add new languages to this list and to `project.inlang/settings.json`
const LANGUAGE_OPTIONS = [
{ value: 'en', label: 'English' },
{ value: 'de', label: 'Deutsch' },
@ -33,8 +28,8 @@ const LANGUAGE_OPTIONS = [
{ value: 'nl', label: 'Nederlands' },
{ value: 'by', label: 'Беларуская' },
{ value: 'ru', label: 'Русский' },
{ value: 'zh-CN', label: '中文(简体)' },
{ value: 'zh-TW', label: '中文(繁體)' },
{ value: 'zh_CN', label: '中文(简体)' },
{ value: 'zh_TW', label: '中文(繁體)' },
{ value: 'it', label: 'Italiano' },
{ value: 'ja', label: '日本語' }
];
@ -214,9 +209,9 @@ export const Component = () => {
<Select
value={i18n.resolvedLanguage || i18n.language || 'en'}
onChange={(e) => {
i18n.changeLanguage(e);
// add "i18nextLng" key to localStorage and set it to the selected language
localStorage.setItem('i18nextLng', e);
i18n.changeLanguage(e);
}}
containerClassName="h-[30px] whitespace-nowrap"
>

View file

@ -1,17 +0,0 @@
{
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": ["en", "de", "tr", "es", "fr", "nl", "it", "by", "ru", "zh-CN", "zh-TW", "ja"],
"modules": [
"https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@1/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js"
],
"plugin.inlang.i18next": {
"pathPattern": "./interface/locales/{languageTag}/common.json"
},
"plugin.inlang.standardLintRules": {
"identicalPattern": "off"
}
}