Skip to content

Commit fcae93e

Browse files
committed
Migrate API model error and info messages to the i18n translation system
- to `apps/editor/src/i18n/translations/views/shared/actions/api/common.ts`, move "dictionary.error_message.FAILED_TO_FETCH_MODELS" - to `apps/editor/src/i18n/translations/views/shared/actions/api/update/interactions/edit-model-for-api-config.ts` move [Fragment] ├── apps │ └── editor │ └── src │ ├── i18n │ │ └── translations │ │ └── views │ │ └── shared │ │ └── actions │ │ ├── api │ │ │ ├── common.ts │ │ │ ├── create │ │ │ │ ├── create.ts │ │ │ │ ├── index.ts │ │ │ │ └── interactions │ │ │ │ ├── index.ts │ │ │ │ ├── initial-select-model.ts │ │ │ │ ├── initial-select-provider.ts │ │ │ │ └── verify-model.ts │ │ │ ├── index.ts │ │ │ ├── pick-reasoning-effort.ts │ │ │ ├── update │ │ │ │ ├── index.ts │ │ │ │ └── interactions │ │ │ │ ├── edit-model-for-api-config.ts │ │ │ │ ├── edit-reasoning-effort-for-api-config.ts │ │ │ │ └── index.ts │ │ │ └── upsert-provider.ts │ │ ├── index.ts │ │ └── web │ │ ├── create.ts │ │ ├── delete.ts │ │ ├── index.ts │ │ ├── pick-chatbot.ts │ │ ├── pick-model.ts │ │ └── update.ts │ └── views │ └── shared │ └── actions │ └── api │ ├── create │ │ └── interactions │ │ └── initial-select-model.ts │ └── update │ └── interactions │ └── edit-model-for-api-config.ts └── packages └── shared └── src └── constants └── dictionary.ts
1 parent 7878904 commit fcae93e

6 files changed

Lines changed: 53 additions & 12 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const translations = {
2+
'views.shared.actions.api.common.error.failed-to-fetch-models': {
3+
en: 'Failed to fetch models: {message}',
4+
pl: 'Nie udało się pobrać modeli: {message}',
5+
'zh-cn': '获取模型失败:{message}',
6+
ja: 'モデルの取得に失敗しました: {message}',
7+
'zh-tw': '獲取模型失敗:{message}',
8+
de: 'Modelle konnten nicht abgerufen werden: {message}',
9+
es: 'Error al obtener los modelos: {message}',
10+
fr: 'Échec de la récupération des modèles: {message}',
11+
'pt-br': 'Falha ao buscar os modelos: {message}',
12+
ru: 'Не удалось получить модели: {message}',
13+
ko: '모델을 가져오지 못했습니다: {message}',
14+
it: 'Impossibile recuperare i modelli: {message}',
15+
tr: 'Modeller getirilemedi: {message}',
16+
cs: 'Nepodařilo se načíst modely: {message}',
17+
hu: 'Nem sikerült letölteni a modelleket: {message}',
18+
bg: 'Неуспешно извличане на модели: {message}'
19+
}
20+
} as const

‎apps/editor/src/i18n/translations/views/shared/actions/api/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { translations as common } from './common'
12
import { translations as create } from './create'
23
import { translations as pick_reasoning_effort } from './pick-reasoning-effort'
34
import { translations as update } from './update'
45
import { translations as upsert_provider } from './upsert-provider'
56

67
export const translations = {
8+
...common,
79
...create,
810
...pick_reasoning_effort,
911
...update,

‎apps/editor/src/i18n/translations/views/shared/actions/api/update/interactions/edit-model-for-api-config.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,27 @@ export const translations = {
1717
cs: 'Zadejte název modelu (ID)',
1818
hu: 'Adja meg a modell nevét (ID)',
1919
bg: 'Въведете име на модел (ID)'
20+
},
21+
'views.shared.actions.api.update.interactions.edit-model-for-api-config.info.models-route-not-found-manual-entry':
22+
{
23+
en: "The '/models' route was not found for {provider_name}. This might mean the provider does not support listing models. You can enter model name manually.",
24+
pl: "Nie znaleziono trasy '/models' dla dostawcy {provider_name}. Może to oznaczać, że dostawca nie obsługuje listowania modeli. Możesz wprowadzić nazwę modelu ręcznie.",
25+
'zh-cn':
26+
"未找到 {provider_name} 的 '/models' 路由。这可能意味着该提供商不支持列出模型。您可以手动输入模型名称。",
27+
ja: "{provider_name} の '/models' ルートが見つかりませんでした。これは、プロバイダーがモデルのリスト表示をサポートしていないことを意味する場合があります。モデル名を手動で入力できます。",
28+
'zh-tw':
29+
"找不到 {provider_name} 的 '/models' 路由。這可能意味著該提供商不支援列出模型。您可以手動輸入模型名稱。",
30+
de: "Die Route '/models' wurde für {provider_name} nicht gefunden. Dies könnte bedeuten, dass der Anbieter das Auflisten von Modellen nicht unterstützt. Sie können den Modellnamen manuell eingeben.",
31+
es: "No se encontró la ruta '/models' para {provider_name}. Esto podría significar que el proveedor no admite el listado de modelos. Puedes ingresar el nombre del modelo manualmente.",
32+
fr: "La route '/models' n'a pas été trouvée pour {provider_name}. Cela pourrait signifier que le fournisseur ne prend pas en charge la liste des modèles. Vous pouvez entrer le nom du modèle manuellement.",
33+
'pt-br':
34+
"A rota '/models' não foi encontrada para {provider_name}. Isso pode significar que o provedor não suporta a listagem de modelos. Você pode inserir o nome do modelo manualmente.",
35+
ru: "Маршрут '/models' не найден для {provider_name}. Это может означать, что провайдер не поддерживает список моделей. Вы можете ввести имя модели вручную.",
36+
ko: "{provider_name}에 대한 '/models' 경로를 찾을 수 없습니다. 이는 제공자가 모델 나열을 지원하지 않음을 의미할 수 있습니다. 모델 이름을 수동으로 입력할 수 있습니다.",
37+
it: "La rotta '/models' non è stata trovata per {provider_name}. Questo potrebbe significare che il provider non supporta l'elencazione dei modelli. Puoi inserire manualmente il nome del modello.",
38+
tr: "{provider_name} için '/models' rotası bulunamadı. Bu, sağlayıcının model listelemeyi desteklemediği anlamına gelebilir. Model adını manuel olarak girebilirsiniz.",
39+
cs: "Trasa '/models' nebyla pro {provider_name} nalezena. To může znamenat, že poskytovatel nepodporuje výpis modelů. Název modelu můžete zadat ručně.",
40+
hu: "A '/models' útvonal nem található a(z) {provider_name} szolgáltatóhoz. Ez azt jelentheti, hogy a szolgáltató nem támogatja a modellek listázását. A modell nevét manuálisan is megadhatja.",
41+
bg: "Маршрутът '/models' не е намерен за {provider_name}. Това може да означава, че доставчикът не поддържа списък с модели. Можете да въведете името на модела ръчно."
2042
}
2143
} as const

‎apps/editor/src/views/shared/actions/api/create/interactions/initial-select-model.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ export const initial_select_model = async (
153153
)
154154
} else {
155155
vscode.window.showErrorMessage(
156-
dictionary.error_message.FAILED_TO_FETCH_MODELS(
157-
error instanceof Error ? error.message : String(error)
158-
)
156+
t('views.shared.actions.api.common.error.failed-to-fetch-models', {
157+
message: error instanceof Error ? error.message : String(error)
158+
})
159159
)
160160
}
161161
}

‎apps/editor/src/views/shared/actions/api/update/interactions/edit-model-for-api-config.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,17 @@ export const edit_model_for_api_configuration = async (params: {
173173
error.message == MODELS_ROUTE_NOT_FOUND_ERROR
174174
) {
175175
vscode.window.showInformationMessage(
176-
dictionary.information_message.MODELS_ROUTE_NOT_FOUND_MANUAL_ENTRY(
177-
params.api_configuration.model_provider_name
176+
t(
177+
'views.shared.actions.api.update.interactions.edit-model-for-api-config.info.models-route-not-found-manual-entry',
178+
{ provider_name: params.api_configuration.model_provider_name }
178179
),
179180
{ modal: true }
180181
)
181182
} else {
182183
vscode.window.showErrorMessage(
183-
dictionary.error_message.FAILED_TO_FETCH_MODELS(
184-
error instanceof Error ? error.message : String(error)
185-
)
184+
t('views.shared.actions.api.common.error.failed-to-fetch-models', {
185+
message: error instanceof Error ? error.message : String(error)
186+
})
186187
)
187188
}
188189
}

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ export const dictionary = {
22
information_message: {
33
MODELS_ROUTE_NOT_FOUND: (provider_name: string) =>
44
`The '/models' route was not found for ${provider_name}. This might mean the provider does not support listing models.`,
5-
MODELS_ROUTE_NOT_FOUND_MANUAL_ENTRY: (provider_name: string) =>
6-
`The '/models' route was not found for ${provider_name}. This might mean the provider does not support listing models. You can enter model name manually.`,
75
NAMED_TEMPLATE_DELETED: (template_name: string) =>
86
`Template "${template_name}" has been deleted.`,
97
NO_CHANGES_FOUND_BETWEEN_BRANCHES: (branch_name: string) =>
@@ -169,8 +167,6 @@ export const dictionary = {
169167
`Could not update ${item_type}: Original ${item_type} "${name}" not found.`,
170168
ERROR_HANDLING_MESSAGE: (message: string) =>
171169
`Error handling message: ${message}.`,
172-
FAILED_TO_FETCH_MODELS: (message: string) =>
173-
`Failed to fetch models: ${message}.`,
174170
BASE_URL_NOT_FOUND_FOR_PROVIDER: (name: string) =>
175171
`Base URL not found for provider ${name}.`,
176172
MODEL_PROVIDER_NOT_FOUND_BY_NAME: (name: string) =>

0 commit comments

Comments
 (0)