Skip to content

Commit

Permalink
Align available locales to VS Code (#14039)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Aug 29, 2024
1 parent dacccf3 commit 9b02b02
Show file tree
Hide file tree
Showing 20 changed files with 1,742 additions and 571 deletions.
21 changes: 18 additions & 3 deletions dev-packages/localization-manager/src/deepl-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export async function deepl(
*/
function coerceLanguage(parameters: DeeplParameters): void {
if (parameters.target_lang === 'ZH-CN') {
parameters.target_lang = 'ZH';
parameters.target_lang = 'ZH-HANS';
} else if (parameters.target_lang === 'ZH-TW') {
parameters.target_lang = 'ZH-HANT';
}
}

Expand Down Expand Up @@ -101,10 +103,13 @@ export type DeeplLanguage =
| 'FI'
| 'FR'
| 'HU'
| 'ID'
| 'IT'
| 'JA'
| 'KO'
| 'LT'
| 'LV'
| 'NB'
| 'NL'
| 'PL'
| 'PT-PT'
Expand All @@ -115,14 +120,24 @@ export type DeeplLanguage =
| 'SK'
| 'SL'
| 'SV'
| 'TR'
| 'UK'
| 'ZH-CN'
| 'ZH-TW'
| 'ZH-HANS'
| 'ZH-HANT'
| 'ZH';

export const supportedLanguages = [
'BG', 'CS', 'DA', 'DE', 'EL', 'EN-GB', 'EN-US', 'EN', 'ES', 'ET', 'FI', 'FR', 'HU', 'IT',
'JA', 'LT', 'LV', 'NL', 'PL', 'PT-PT', 'PT-BR', 'PT', 'RO', 'RU', 'SK', 'SL', 'SV', 'ZH-CN'
'BG', 'CS', 'DA', 'DE', 'EL', 'EN-GB', 'EN-US', 'EN', 'ES', 'ET', 'FI', 'FR', 'HU', 'ID', 'IT',
'JA', 'KO', 'LT', 'LV', 'NL', 'PL', 'PT-PT', 'PT-BR', 'PT', 'RO', 'RU', 'SK', 'SL', 'SV', 'TR', 'UK', 'ZH-CN', 'ZH-TW'
];

// From https://code.visualstudio.com/docs/getstarted/locales#_available-locales
export const defaultLanguages = [
'ZH-CN', 'ZH-TW', 'FR', 'DE', 'IT', 'ES', 'JA', 'KO', 'RU', 'PT-BR', 'TR', 'PL', 'CS', 'HU'
] as const;

export function isSupportedLanguage(language: string): language is DeeplLanguage {
return supportedLanguages.includes(language.toUpperCase());
}
Expand Down
8 changes: 5 additions & 3 deletions dev-packages/localization-manager/src/localization-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as chalk from 'chalk';
import * as fs from 'fs-extra';
import * as path from 'path';
import { Localization, sortLocalization } from './common';
import { deepl, DeeplLanguage, DeeplParameters, isSupportedLanguage, supportedLanguages } from './deepl-api';
import { deepl, DeeplLanguage, DeeplParameters, defaultLanguages, isSupportedLanguage } from './deepl-api';

export interface LocalizationOptions {
freeApi: Boolean
Expand Down Expand Up @@ -52,8 +52,10 @@ export class LocalizationManager {
languages.push(targetLanguage);
}
}
if (languages.length !== options.targetLanguages.length) {
console.log('Supported languages: ' + supportedLanguages.join(', '));
if (languages.length === 0) {
// No supported languages were found, default to all supported languages
console.log('No languages were specified, defaulting to all supported languages for VS Code');
languages.push(...defaultLanguages);
}
const existingTranslations: Map<string, Localization> = new Map();
for (const targetLanguage of languages) {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "Hostovaná instance je již spuštěna.",
"debugInstance": "Instance ladění",
"debugMode": "Použití inspect nebo inspect-brk pro ladění Node.js",
"debugPorts": {
"debugPort": "Port, který se použije pro ladění Node.js tohoto serveru"
},
"devHost": "Vývojový hostitel",
"failed": "Nepodařilo se spustit hostovanou instanci zásuvného modulu: {0}",
"hostedPlugin": "Hostovaný plugin",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "Die gehostete Instanz läuft bereits.",
"debugInstance": "Debug-Instanz",
"debugMode": "Verwendung von inspect oder inspect-brk zur Fehlersuche in Node.js",
"debugPorts": {
"debugPort": "Zu verwendender Port für das Node.js-Debugging dieses Servers"
},
"devHost": "Entwicklung Host",
"failed": "Die gehostete Plugin-Instanz konnte nicht ausgeführt werden: {0}",
"hostedPlugin": "Gehostetes Plugin",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "La instancia alojada ya está funcionando.",
"debugInstance": "Instancia de depuración",
"debugMode": "Uso de inspect o inspect-brk para la depuración de Node.js",
"debugPorts": {
"debugPort": "Puerto a usar para la depuración Node.js de este servidor"
},
"devHost": "Anfitrión del desarrollo",
"failed": "Fallo en la ejecución de la instancia del plugin alojado: {0}",
"hostedPlugin": "Plugin alojado",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "L'instance hébergée est déjà en cours d'exécution.",
"debugInstance": "Instance de débogage",
"debugMode": "Utilisation de inspect ou inspect-brk pour le débogage de Node.js",
"debugPorts": {
"debugPort": "Port à utiliser pour le débogage Node.js de ce serveur"
},
"devHost": "Hôte de développement",
"failed": "Échec de l'exécution de l'instance du plugin hébergé : {0}",
"hostedPlugin": "Plugin hébergé",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "A hosztolt példány már fut.",
"debugInstance": "Hibakeresési példány",
"debugMode": "Az inspect vagy inspect-brk használata a Node.js hibakereséshez",
"debugPorts": {
"debugPort": "A kiszolgáló Node.js hibakereséséhez használni kívánt port"
},
"devHost": "Fejlesztés Host",
"failed": "Nem sikerült futtatni a hosztolt plugin példányt: {0}",
"hostedPlugin": "Hostolt bővítmény",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.it.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "L'istanza ospitata è già in esecuzione.",
"debugInstance": "Istanza di debug",
"debugMode": "Usare inspect o inspect-brk per il debug di Node.js",
"debugPorts": {
"debugPort": "Porta da utilizzare per il debug Node.js di questo server"
},
"devHost": "Sviluppo Host",
"failed": "Impossibile eseguire l'istanza del plugin ospitato: {0}",
"hostedPlugin": "Plugin ospitato",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/i18n/nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "ホストされているインスタンスはすでに実行されています。",
"debugInstance": "デバッグインスタンス",
"debugMode": "Node.js のデバッグに inspect または inspect-brk を使用する",
"debugPorts": {
"debugPort": "このサーバーのNode.jsデバッグに使用するポート。"
},
"devHost": "開発ホスト",
"failed": "ホストされたプラグインインスタンスの実行に失敗しました。{0}",
"hostedPlugin": "ホスト型プラグイン",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/i18n/nls.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"debug.breakpoint.editCondition": "Edit Condition...",
"notebook.cell.changeToCode": "Change Cell to Code",
"notebook.cell.changeToMarkdown": "Change Cell to Mardown",
"notebook.cell.changeToMarkdown": "Change Cell to Markdown",
"notebook.cell.insertMarkdownCellAbove": "Insert Markdown Cell Above",
"notebook.cell.insertMarkdownCellBelow": "Insert Markdown Cell Below",
"terminal:new:profile": "Create New Integrated Terminal from a Profile",
Expand Down Expand Up @@ -362,6 +362,9 @@
"alreadyRunning": "Hosted instance is already running.",
"debugInstance": "Debug Instance",
"debugMode": "Using inspect or inspect-brk for Node.js debug",
"debugPorts": {
"debugPort": "Port to use for this server's Node.js debug"
},
"devHost": "Development Host",
"failed": "Failed to run hosted plugin instance: {0}",
"hostedPlugin": "Hosted Plugin",
Expand Down
Loading

0 comments on commit 9b02b02

Please sign in to comment.