Skip to content

Commit 7878904

Browse files
committed
Internationalize git error and information messages
- move NOTHING_TO_COMMIT to i18n - move GIT_EXTENSION_NOT_FOUND to i18n (common) - suggest and apply better copy for [Fragment] (don't use word 'extension') - add missing translations to [Fragment] ├── apps │ └── editor │ └── src │ ├── commands │ │ └── select-unstaged-files-command.ts │ ├── i18n │ │ └── translations │ │ ├── common.ts │ │ └── utils │ │ ├── git-repository-utils.ts │ │ ├── index.ts │ │ └── show-parent-folder-quick-pick.ts │ └── utils │ ├── git-repository-utils.ts │ └── show-parent-folder-quick-pick.ts └── packages └── shared └── src └── constants └── dictionary.ts
1 parent 44d5a21 commit 7878904

6 files changed

Lines changed: 45 additions & 9 deletions

File tree

‎apps/editor/src/commands/select-unstaged-files-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const select_unstaged_files_command = (
2020
vscode.extensions.getExtension('vscode.git')?.exports
2121
if (!git_extension) {
2222
vscode.window.showErrorMessage(
23-
dictionary.error_message.GIT_EXTENSION_NOT_FOUND
23+
t('common.error.git-integration-missing')
2424
)
2525
return
2626
}

‎apps/editor/src/i18n/translations/common.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,24 @@ export const translations = {
395395
hu: 'Visszavonás',
396396
bg: 'Отмяна'
397397
},
398+
'common.error.git-integration-missing': {
399+
en: "Editor's Git integration hasn't loaded yet.",
400+
pl: 'Integracja Gita w edytorze jeszcze się nie załadowała.',
401+
'zh-cn': '编辑器的 Git 集成尚未加载。',
402+
ja: 'エディタの Git 統合がまだ読み込まれていません。',
403+
'zh-tw': '編輯器的 Git 整合尚未載入。',
404+
de: 'Die Git-Integration des Editors wurde noch nicht geladen.',
405+
es: 'La integración de Git del editor aún no se ha cargado.',
406+
fr: "L'intégration Git de l'éditeur n'a pas encore été chargée.",
407+
'pt-br': 'A integração do Git do editor ainda não foi carregada.',
408+
ru: 'Интеграция Git редактора еще не загружена.',
409+
ko: '편집기의 Git 통합이 아직 로드되지 않았습니다.',
410+
it: "L'integrazione Git dell'editor non è ancora stata caricata.",
411+
tr: 'Düzenleyicinin Git entegrasyonu henüz yüklenmedi.',
412+
cs: 'Integrace Gitu v editoru ještě nebyla načtena.',
413+
hu: 'A szerkesztő Git-integrációja még nem töltött be.',
414+
bg: 'Git интеграцията на редактора все още не е заредена.'
415+
},
398416
'common.error.api-provider-not-found': {
399417
en: 'API provider for the selected API tool configuration was not found.',
400418
pl: 'Nie znaleziono dostawcy API dla wybranej konfiguracji narzędzia API.',
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const translations = {
2+
'utils.git-repository-utils.nothing-to-commit': {
3+
en: 'Nothing to commit.',
4+
pl: 'Brak zmian do zatwierdzenia.',
5+
'zh-cn': '没有要提交的更改。',
6+
ja: 'コミットする変更はありません。',
7+
'zh-tw': '沒有要提交的變更。',
8+
de: 'Nichts zum Committen.',
9+
es: 'Nada que confirmar.',
10+
fr: 'Rien à valider.',
11+
'pt-br': 'Nada para comitar.',
12+
ru: 'Нет изменений для фиксации.',
13+
ko: '커밋할 내용이 없습니다.',
14+
it: 'Niente di cui eseguire il commit.',
15+
tr: 'İşlenecek bir şey yok.',
16+
cs: 'Nic k zápisu.',
17+
hu: 'Nincs mit kommitálni.',
18+
bg: 'Няма нищо за комитване.'
19+
}
20+
} as const
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { translations as show_parent_folder_quick_pick } from './show-parent-folder-quick-pick'
2+
import { translations as git_repository_utils } from './git-repository-utils'
23

34
export const translations = {
4-
...show_parent_folder_quick_pick
5+
...show_parent_folder_quick_pick,
6+
...git_repository_utils
57
}

‎apps/editor/src/utils/git-repository-utils.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ export type GitRepository = {
2424
const get_all_git_repositories = (): GitRepository[] | null => {
2525
const git_extension = vscode.extensions.getExtension('vscode.git')
2626
if (!git_extension) {
27-
vscode.window.showErrorMessage(
28-
dictionary.error_message.GIT_EXTENSION_NOT_FOUND
29-
)
27+
vscode.window.showErrorMessage(t('common.error.git-integration-missing'))
3028
return null
3129
}
3230

@@ -109,7 +107,7 @@ export const get_repository_for_commit = async (
109107

110108
if (repositories_with_changes.length == 0) {
111109
vscode.window.showInformationMessage(
112-
dictionary.information_message.NO_CHANGES_TO_COMMIT
110+
t('utils.git-repository-utils.nothing-to-commit')
113111
)
114112
return null
115113
}
@@ -367,7 +365,7 @@ export const prepare_staged_changes = async (params: {
367365

368366
if (!diff || diff.length == 0) {
369367
vscode.window.showInformationMessage(
370-
dictionary.information_message.NO_CHANGES_TO_COMMIT
368+
t('utils.git-repository-utils.nothing-to-commit')
371369
)
372370
return null
373371
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const dictionary = {
22
information_message: {
3-
NO_CHANGES_TO_COMMIT: 'No changes to commit.',
43
MODELS_ROUTE_NOT_FOUND: (provider_name: string) =>
54
`The '/models' route was not found for ${provider_name}. This might mean the provider does not support listing models.`,
65
MODELS_ROUTE_NOT_FOUND_MANUAL_ENTRY: (provider_name: string) =>
@@ -133,7 +132,6 @@ export const dictionary = {
133132
NO_WORKSPACE_FOLDERS_FOUND: 'No workspace folders found.',
134133
FAILED_TO_GET_GIT_BRANCHES:
135134
'Failed to get Git branches. Make sure you are in a Git repository.',
136-
GIT_EXTENSION_NOT_FOUND: 'Git extension not found.',
137135
NO_GIT_REPOSITORY_FOUND: 'No Git repository found.',
138136
RESPONSE_TEXT_MISSING: 'Response text to apply is missing.',
139137
API_RATE_LIMIT_EXCEEDED: 'API request failed. Rate limit exceeded.',

0 commit comments

Comments
 (0)