Langpack Source update with fix for hashed strings (#24400)

* Initial update to german vscode

* more cleanup for vscode git german.

* added working alias replacer, need to add all string entities

* added aliased bundle strings

* added extension files, need to update package and readme

* added update to changelog, and restored vscode extensions

* added comments
This commit is contained in:
Alex Ma
2023-09-14 10:10:49 -07:00
committed by GitHub
parent d9b5d71148
commit 523dd8ad4b
614 changed files with 193655 additions and 168544 deletions

View File

@@ -16,6 +16,7 @@ import * as fancyLog from 'fancy-log';
import * as ansiColors from 'ansi-colors';
import * as iconv from '@vscode/iconv-lite-umd';
import { l10nJsonFormat, getL10nXlf, l10nJsonDetails, getL10nFilesFromXlf, getL10nJson } from '@vscode/l10n-dev';
import { aliasStrings } from './vscodeLocStringAlias'; // {{SQL CARBON EDIT}} - Needed to store aliased strings.
function log(message: any, ...rest: any[]): void {
fancyLog(ansiColors.green('[i18n]'), message, ...rest);
@@ -904,6 +905,28 @@ export function createI18nFile(name: string, messages: any): File { // {{SQL CAR
'Do not edit this file. It is machine generated.'
];
for (const key of Object.keys(messages)) {
// {{SQL CARBON EDIT}} - Temporarily used to handle aliased ids from vscode-translations-export - https://github.com/microsoft/azuredatastudio/issues/24411
let areaList = messages['contents'];
if (name.startsWith('extensions/') && key.startsWith('contents') && areaList) {
for (const areaKey of Object.keys(areaList)) {
let stringList = messages['contents'][areaKey];
for (const stringKey of Object.keys(stringList)) {
let shortName = name.substring(11); //remove 'extensions/' (size 11) from name to get extension name by itself.
let keyAlias = aliasStrings as StringMap<StringMap<string>>
// '++CODE++' comes from @vscode/l10n-dev/dist/main.js#L358 which replaces any id that is the same as the string message.
if (stringKey.startsWith('++CODE++') && keyAlias[shortName]) {
let shortBundleKey = stringKey.substring(8); //remove '++CODE++' (size 8) and only use hash to lookup.
let aliasKey = keyAlias[shortName][shortBundleKey];
if (aliasKey) {
let originalMessage = messages['contents'][areaKey][stringKey];
messages['contents'][areaKey][stringKey] = undefined;
messages['contents'][areaKey][aliasKey] = originalMessage;
}
}
}
}
}
// {{SQL CARBON EDIT}} - End
result[key] = messages[key];
}