Skip to content

Commit fab4ad4

Browse files
committed
Migrate token crunching message to i18n localization system
- move CRUNCHING_TOKEN_COUNTS to i18n (`apps/editor/src/i18n/translations/context.ts`) ├── apps │ └── editor │ └── src │ ├── context │ │ └── providers │ │ └── workspace │ │ └── modules │ │ └── token-calculator.ts │ └── i18n │ ├── index.ts │ └── translations │ ├── common.ts │ ├── context.ts │ └── misc.ts └── packages └── shared └── src └── constants └── dictionary.ts
1 parent a24da59 commit fab4ad4

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎apps/editor/src/context/providers/workspace/modules/token-calculator.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as vscode from 'vscode'
22
import * as fs from 'fs'
33
import * as path from 'path'
4-
import { dictionary } from '@shared/constants/dictionary'
54
import { Logger } from '@shared/utils/logger'
5+
import { t } from '@/i18n'
66
import type { IWorkspaceProvider } from '../workspace-provider'
77
import { shrink_file } from '@/context/utils/shrink-file'
88
import { is_binary_file } from '@/utils/is-binary'
@@ -264,7 +264,7 @@ export class TokenCalculator implements vscode.Disposable {
264264
return vscode.window.withProgress(
265265
{
266266
location: vscode.ProgressLocation.Notification,
267-
title: dictionary.information_message.CRUNCHING_TOKEN_COUNTS,
267+
title: t('context.crunching-token-counts'),
268268
cancellable: false
269269
},
270270
async (progress) => {
@@ -736,7 +736,7 @@ export class TokenCalculator implements vscode.Disposable {
736736
return vscode.window.withProgress(
737737
{
738738
location: vscode.ProgressLocation.Notification,
739-
title: dictionary.information_message.CRUNCHING_TOKEN_COUNTS,
739+
title: t('context.crunching-token-counts'),
740740
cancellable: false
741741
},
742742
async (progress) => {

‎apps/editor/src/i18n/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from 'vscode'
22
import { translations as commands } from './translations/commands'
33
import { translations as common } from './translations/common'
4+
import { translations as context } from './translations/context'
45
import { translations as features } from './translations/features'
56
import { translations as utils } from './translations/utils'
67
import { translations as views } from './translations/views'
@@ -11,6 +12,7 @@ export type TranslationKey = keyof typeof translations
1112
const translations = {
1213
...commands,
1314
...common,
15+
...context,
1416
...features,
1517
...utils,
1618
...views,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const translations = {
2+
'context.crunching-token-counts': {
3+
en: 'Please wait, crunching token counts...',
4+
pl: 'Proszę czekać, przeliczanie tokenów...',
5+
'zh-cn': '请稍候,正在计算 token 数量...',
6+
ja: 'お待ちください。トークン数を計算中...',
7+
'zh-tw': '請稍候,正在計算 token 數量...',
8+
de: 'Bitte warten, Token-Anzahl wird berechnet...',
9+
es: 'Por favor, espere, calculando cantidad de tokens...',
10+
fr: 'Veuillez patienter, calcul du nombre de tokens...',
11+
'pt-br': 'Por favor, aguarde, calculando contagem de tokens...',
12+
ru: 'Пожалуйста, подождите, идет подсчет токенов...',
13+
ko: '잠시만 기다려주세요, 토큰 수를 계산하는 중입니다...',
14+
it: 'Attendere, calcolo del conteggio dei token in corso...',
15+
tr: 'Lütfen bekleyin, token sayıları hesaplanıyor...',
16+
cs: 'Čekejte prosím, počítám tokeny...',
17+
hu: 'Kérem várjon, a tokenek számolása folyamatban...',
18+
bg: 'Моля, изчакайте, изчисляване на броя токени...'
19+
}
20+
} as const

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const dictionary = {
3333
`${count} file${count == 1 ? '' : 's'} remain${
3434
count == 1 ? 's' : ''
3535
} checked.`,
36-
CRUNCHING_TOKEN_COUNTS: 'Please wait, crunching token counts...',
3736
TEMPLATE_RESTORED: 'Template has been restored.',
3837
UNNAMED_TEMPLATE_DELETED: 'Unnamed template has been deleted.'
3938
},

0 commit comments

Comments
 (0)