Skip to content

Commit a319a7e

Browse files
committed
Localize the Edit Model Provider form
- `apps/editor/src/views/settings/frontend/forms/EditModelProviderForm/EditModelProviderForm.tsx` is missing translations - add missing translations to [Fragment], fix usage - add missing translations to [Fragment]
1 parent 0ec1c86 commit a319a7e

2 files changed

Lines changed: 193 additions & 46 deletions

File tree

‎apps/editor/src/views/settings/frontend/forms/EditModelProviderForm/EditModelProviderForm.tsx‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Input as UiInput } from '@ui/components/editor/common/Input'
66
import { Scrollable as UiScrollable } from '@ui/components/editor/common/Scrollable'
77
import { Fieldset as UiFieldset } from '@ui/components/editor/panel/Fieldset'
88
import { Toggler as UiToggler } from '@ui/components/editor/common/Toggler'
9+
import { use_translation } from '../../i18n/use-translation'
910

1011
export type ModelProviderDraft = {
1112
name: string
@@ -22,6 +23,7 @@ type Props = {
2223
}
2324

2425
export const EditModelProviderForm: React.FC<Props> = (props) => {
26+
const { t } = use_translation()
2527
const [name, set_name] = useState(props.provider.name)
2628
const [base_url, set_base_url] = useState(props.provider.base_url)
2729
const [api_key, set_api_key] = useState('')
@@ -44,28 +46,31 @@ export const EditModelProviderForm: React.FC<Props> = (props) => {
4446
<UiScrollable top_shadow>
4547
<div className={styles.form}>
4648
<UiFieldset>
47-
<UiField label="Name" html_for="name">
49+
<UiField label={t('model-providers.form.name.label')} html_for="name">
4850
<UiInput
4951
id="name"
5052
type="text"
5153
value={name}
5254
on_change={set_name}
53-
placeholder="e.g. OpenAI"
55+
placeholder={t('model-providers.form.name.placeholder')}
5456
/>
5557
</UiField>
5658

57-
<UiField label="Base URL" html_for="base_url">
59+
<UiField
60+
label={t('model-providers.form.base-url.label')}
61+
html_for="base_url"
62+
>
5863
<UiInput
5964
id="base_url"
6065
type="text"
6166
value={base_url}
6267
on_change={set_base_url}
63-
placeholder="e.g. https://api.openai.com/v1"
68+
placeholder={t('model-providers.form.base-url.placeholder')}
6469
/>
6570
</UiField>
6671

6772
<UiField
68-
label="API Key"
73+
label={t('model-providers.form.api-key.label')}
6974
html_for="api_key"
7075
action={
7176
(props.provider.api_key_mask || api_key) &&
@@ -77,7 +82,7 @@ export const EditModelProviderForm: React.FC<Props> = (props) => {
7782
set_is_api_key_cleared(true)
7883
}}
7984
>
80-
Clear
85+
{t('model-providers.form.api-key.action.clear')}
8186
</button>
8287
) : undefined
8388
}
@@ -92,20 +97,20 @@ export const EditModelProviderForm: React.FC<Props> = (props) => {
9297
}}
9398
placeholder={
9499
is_api_key_cleared
95-
? 'API Key cleared'
100+
? t('model-providers.form.api-key.placeholder.cleared')
96101
: props.provider.api_key_mask
97102
? `...${props.provider.api_key_mask.slice(-4)}`
98-
: 'Enter API Key'
103+
: t('model-providers.form.api-key.placeholder.default')
99104
}
100105
/>
101106
</UiField>
102107

103108
{base_url.includes('api.anthropic.com') && (
104109
<UiField
105-
label="Extended Cache"
110+
label={t('model-providers.extended-cache.anthropic.title')}
106111
info={
107112
<>
108-
By default, automatic caching uses a 5-minute TTL. You can{' '}
113+
{t('model-providers.extended-cache.anthropic.description')}{' '}
109114
<a
110115
href="#"
111116
onClick={(e) => {
@@ -115,9 +120,8 @@ export const EditModelProviderForm: React.FC<Props> = (props) => {
115120
)
116121
}}
117122
>
118-
extend it to 1-hour
119-
</a>{' '}
120-
for all requests including the selected files.
123+
{t('model-providers.extended-cache.anthropic.learn-more')}
124+
</a>
121125
</>
122126
}
123127
>

‎apps/editor/src/views/settings/frontend/i18n/translations/model-providers.ts‎

Lines changed: 176 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,22 @@ export const model_providers = {
1919
bg: 'Настройка от предефинирани крайни точки или добавяне на персонализирана.'
2020
},
2121
'model-providers.notice.credentials': {
22-
en: 'Credentials are stored securely in the {link} on your machine.',
23-
pl: 'Dane uwierzytelniające są bezpiecznie przechowywane w {link} na twoim komputerze.',
24-
'zh-cn': '凭据安全地存储在您机器上的 {link} 中。',
25-
ja: '認証情報はマシンの {link} に安全に保存されます。',
26-
'zh-tw': '憑證安全地儲存在您機器的 {link} 中。',
27-
de: 'Anmeldedaten werden sicher im {link} auf Ihrem Computer gespeichert.',
28-
es: 'Las credenciales se almacenan de forma segura en {link} en tu máquina.',
29-
fr: 'Les identifiants sont stockés de manière sécurisée dans {link} sur votre machine.',
30-
'pt-br':
31-
'As credenciais são armazenadas com segurança no {link} em sua máquina.',
32-
ru: 'Учетные данные безопасно хранятся в {link} на вашей машине.',
33-
ko: '자격 증명은 컴퓨터의 {link}에 안전하게 저장됩니다.',
34-
it: 'Le credenziali sono archiviate in modo sicuro nel {link} sul tuo computer.',
35-
tr: 'Kimlik bilgileri bilgisayarınızdaki {link} içinde güvenli bir şekilde saklanır.',
36-
cs: 'Přihlašovací údaje jsou bezpečně uloženy v {link} na vašem počítači.',
37-
hu: 'A hitelesítő adatok biztonságosan vannak tárolva a {link} a gépén.',
38-
bg: 'Идентификационните данни се съхраняват сигурно в {link} на вашата машина.'
22+
en: 'Credentials are stored securely in the on your machine.',
23+
pl: 'Dane uwierzytelniające są bezpiecznie przechowywane w na twoim komputerze.',
24+
'zh-cn': '凭据安全地存储在您机器上的 中。',
25+
ja: '認証情報はマシンの に安全に保存されます。',
26+
'zh-tw': '憑證安全地儲存在您機器的 中。',
27+
de: 'Anmeldedaten werden sicher im auf Ihrem Computer gespeichert.',
28+
es: 'Las credenciales se almacenan de forma segura en en tu máquina.',
29+
fr: 'Les identifiants sont stockés de manière sécurisée dans sur votre machine.',
30+
'pt-br': 'As credenciais são armazenadas com segurança no em sua máquina.',
31+
ru: 'Учетные данные безопасно хранятся в на вашей машине.',
32+
ko: '자격 증명은 컴퓨터의에 안전하게 저장됩니다.',
33+
it: 'Le credenziali sono archiviate in modo sicuro nel sul tuo computer.',
34+
tr: 'Kimlik bilgileri bilgisayarınızdaki içinde güvenli bir şekilde saklanır.',
35+
cs: 'Přihlašovací údaje jsou bezpečně uloženy v na vašem počítači.',
36+
hu: 'A hitelesítő adatok biztonságosan vannak tárolva a a gépén.',
37+
bg: 'Идентификационните данни се съхраняват сигурно в на вашата машина.'
3938
},
4039
'model-providers.notice.missing': {
4140
en: 'Missing model provider.',
@@ -74,23 +73,23 @@ export const model_providers = {
7473
bg: 'Разширен кеш за Anthropic'
7574
},
7675
'model-providers.extended-cache.anthropic.description': {
77-
en: 'Enable 1-hour prompt caching for requests including context files. {link}',
78-
pl: 'Włącza 1-godzinne cache-owanie promptów gdy wysyła wybrane pliki kontekstu. {link}',
79-
'zh-cn': '对包含上下文文件的请求启用 1 小时提示缓存。{link}',
80-
ja: 'コンテキストファイルを含むリクエストの1時間のプロンプトキャッシュを有効にします。{link}',
81-
'zh-tw': '對包含上下文檔案的請求啟用 1 小時提示快取。{link}',
82-
de: 'Aktivieren Sie das 1-stündige Prompt-Caching für Anfragen, die Kontextdateien enthalten. {link}',
83-
es: 'Habilita el almacenamiento en caché de indicaciones de 1 hora para solicitudes que incluyan archivos de contexto. {link}',
84-
fr: "Activer la mise en cache des invites d'une heure pour les requêtes incluant des fichiers de contexte. {link}",
76+
en: 'Enable 1-hour prompt caching for requests including the selected files.',
77+
pl: 'Włącz 1-godzinne buforowanie promptów dla zapytań zawierających wybrane pliki.',
78+
'zh-cn': '为包含所选文件的请求启用 1 小时提示词缓存。',
79+
ja: '選択されたファイルを含むリクエストに対して、1時間のプロンプトキャッシュを有効にします。',
80+
'zh-tw': '為包含所選檔案的請求啟用 1 小時提示詞快取。',
81+
de: 'Aktivieren Sie das 1-stündige Prompt-Caching für Anfragen, die die ausgewählten Dateien enthalten.',
82+
es: 'Habilita el almacenamiento en caché de prompts de 1 hora para las solicitudes que incluyan los archivos seleccionados.',
83+
fr: 'Activez la mise en cache des prompts pendant 1 heure pour les requêtes incluant les fichiers sélectionnés.',
8584
'pt-br':
86-
'Ativar cache de prompt de 1 hora para solicitações incluindo arquivos de contexto. {link}',
87-
ru: 'Включите 1-часовое кэширование промптов для запросов, включающих файлы контекста. {link}',
88-
ko: '컨텍스트 파일이 포함된 요청에 대해 1시간 프롬프트 캐싱을 활성화합니다. {link}',
89-
it: 'Abilita la memorizzazione nella cache dei prompt di 1 ora per le richieste che includono file di contesto. {link}',
90-
tr: 'Bağlam dosyalarını içeren istekler için 1 saatlik istem önbelleğe almayı etkinleştirin. {link}',
91-
cs: 'Povolit 1hodinové ukládání do mezipaměti promptů pro požadavky obsahující soubory kontextu. {link}',
92-
hu: 'Engedélyezze az 1 órás prompt gyorsítótárazást a kontextus fájlokat tartalmazó kérésekhez. {link}',
93-
bg: 'Активиране на 1-часово кеширане на подсказки за заявки, включващи контекстни файлове. {link}'
85+
'Ative o cache de prompts de 1 hora para requisições que incluam os arquivos selecionados.',
86+
ru: 'Включить 1-часовое кэширование промптов для запросов, включающих выбранные файлы.',
87+
ko: '선택한 파일이 포함된 요청에 대해 1시간 프롬프트 캐싱을 활성화합니다.',
88+
it: 'Abilita la cache dei prompt di 1 ora per le richieste che includono i file selezionati.',
89+
tr: 'Seçili dosyaları içeren istekler için 1 saatlik istem önbelleğe almayı etkinleştirin.',
90+
cs: 'Povolit 1hodinové ukládání promptů do mezipaměti pro požadavky obsahující vybrané soubory.',
91+
hu: 'Engedélyezze az 1 órás prompt gyorsítótárazást a kiválasztott fájlokat tartalmazó kérésekhez.',
92+
bg: 'Включете 1-часово кеширане на промптове за заявки, включващи избраните файлове.'
9493
},
9594
'model-providers.extended-cache.anthropic.learn-more': {
9695
en: 'Learn more',
@@ -199,5 +198,149 @@ export const model_providers = {
199198
cs: 'poskytovatelé modelu',
200199
hu: 'modell szolgáltatók',
201200
bg: 'доставчици на модели'
201+
},
202+
'model-providers.form.name.label': {
203+
en: 'Name',
204+
pl: 'Nazwa',
205+
'zh-cn': '名称',
206+
ja: '名前',
207+
'zh-tw': '名稱',
208+
de: 'Name',
209+
es: 'Nombre',
210+
fr: 'Nom',
211+
'pt-br': 'Nome',
212+
ru: 'Название',
213+
ko: '이름',
214+
it: 'Nome',
215+
tr: 'Ad',
216+
cs: 'Název',
217+
hu: 'Név',
218+
bg: 'Име'
219+
},
220+
'model-providers.form.name.placeholder': {
221+
en: 'e.g. OpenAI',
222+
pl: 'np. OpenAI',
223+
'zh-cn': '例如 OpenAI',
224+
ja: '例:OpenAI',
225+
'zh-tw': '例如 OpenAI',
226+
de: 'z.B. OpenAI',
227+
es: 'ej. OpenAI',
228+
fr: 'ex. OpenAI',
229+
'pt-br': 'ex. OpenAI',
230+
ru: 'напр. OpenAI',
231+
ko: '예: OpenAI',
232+
it: 'es. OpenAI',
233+
tr: 'örn. OpenAI',
234+
cs: 'např. OpenAI',
235+
hu: 'pl. OpenAI',
236+
bg: 'напр. OpenAI'
237+
},
238+
'model-providers.form.base-url.label': {
239+
en: 'Base URL',
240+
pl: 'Bazowy adres URL',
241+
'zh-cn': '基础 URL',
242+
ja: 'ベース URL',
243+
'zh-tw': '基礎 URL',
244+
de: 'Basis-URL',
245+
es: 'URL base',
246+
fr: 'URL de base',
247+
'pt-br': 'URL Base',
248+
ru: 'Базовый URL',
249+
ko: '기본 URL',
250+
it: 'URL di base',
251+
tr: 'Temel URL',
252+
cs: 'Základní URL',
253+
hu: 'Alap URL',
254+
bg: 'Базов URL'
255+
},
256+
'model-providers.form.base-url.placeholder': {
257+
en: 'e.g. https://api.openai.com/v1',
258+
pl: 'np. https://api.openai.com/v1',
259+
'zh-cn': '例如 https://api.openai.com/v1',
260+
ja: '例:https://api.openai.com/v1',
261+
'zh-tw': '例如 https://api.openai.com/v1',
262+
de: 'z.B. https://api.openai.com/v1',
263+
es: 'ej. https://api.openai.com/v1',
264+
fr: 'ex. https://api.openai.com/v1',
265+
'pt-br': 'ex. https://api.openai.com/v1',
266+
ru: 'напр. https://api.openai.com/v1',
267+
ko: '예: https://api.openai.com/v1',
268+
it: 'es. https://api.openai.com/v1',
269+
tr: 'örn. https://api.openai.com/v1',
270+
cs: 'např. https://api.openai.com/v1',
271+
hu: 'pl. https://api.openai.com/v1',
272+
bg: 'напр. https://api.openai.com/v1'
273+
},
274+
'model-providers.form.api-key.label': {
275+
en: 'API Key',
276+
pl: 'Klucz API',
277+
'zh-cn': 'API 密钥',
278+
ja: 'API キー',
279+
'zh-tw': 'API 金鑰',
280+
de: 'API-Schlüssel',
281+
es: 'Clave API',
282+
fr: 'Clé API',
283+
'pt-br': 'Chave API',
284+
ru: 'API-ключ',
285+
ko: 'API 키',
286+
it: 'Chiave API',
287+
tr: 'API Anahtarı',
288+
cs: 'Klíč API',
289+
hu: 'API Kulcs',
290+
bg: 'API Ключ'
291+
},
292+
'model-providers.form.api-key.action.clear': {
293+
en: 'Clear',
294+
pl: 'Wyczyść',
295+
'zh-cn': '清除',
296+
ja: 'クリア',
297+
'zh-tw': '清除',
298+
de: 'Löschen',
299+
es: 'Borrar',
300+
fr: 'Effacer',
301+
'pt-br': 'Limpar',
302+
ru: 'Очистить',
303+
ko: '지우기',
304+
it: 'Cancella',
305+
tr: 'Temizle',
306+
cs: 'Vymazat',
307+
hu: 'Törlés',
308+
bg: 'Изчистване'
309+
},
310+
'model-providers.form.api-key.placeholder.cleared': {
311+
en: 'API Key cleared',
312+
pl: 'Klucz API wyczyszczony',
313+
'zh-cn': 'API 密钥已清除',
314+
ja: 'API キーがクリアされました',
315+
'zh-tw': 'API 金鑰已清除',
316+
de: 'API-Schlüssel gelöscht',
317+
es: 'Clave API borrada',
318+
fr: 'Clé API effacée',
319+
'pt-br': 'Chave API apagada',
320+
ru: 'API-ключ очищен',
321+
ko: 'API 키 지워짐',
322+
it: 'Chiave API cancellata',
323+
tr: 'API Anahtarı temizlendi',
324+
cs: 'Klíč API vymazán',
325+
hu: 'API Kulcs törölve',
326+
bg: 'API ключът е изчистен'
327+
},
328+
'model-providers.form.api-key.placeholder.default': {
329+
en: 'Enter API Key',
330+
pl: 'Wprowadź klucz API',
331+
'zh-cn': '输入 API 密钥',
332+
ja: 'API キーを入力',
333+
'zh-tw': '輸入 API 金鑰',
334+
de: 'API-Schlüssel eingeben',
335+
es: 'Introducir clave API',
336+
fr: 'Entrer la clé API',
337+
'pt-br': 'Inserir Chave API',
338+
ru: 'Введите API-ключ',
339+
ko: 'API 키 입력',
340+
it: 'Inserisci Chiave API',
341+
tr: 'API Anahtarı Girin',
342+
cs: 'Zadejte klíč API',
343+
hu: 'Adja meg az API Kulcsot',
344+
bg: 'Въведете API ключ'
202345
}
203346
} as const

0 commit comments

Comments
 (0)