MCPcopy Index your code
hub / github.com/bytebase/bytebase / updateLocalizationFiles

Function updateLocalizationFiles

frontend/i18n.ts:180–201  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178
179// Main function to load the source file and update each target file
180async function updateLocalizationFiles() {
181 const folders = [
182 "src/locales",
183 "src/locales/dynamic",
184 "src/locales/sql-review",
185 "src/locales/subscription",
186 ];
187
188 for (const folder of folders) {
189 const sourceData = await loadJsonFile(`${folder}/${SOURCE_LANG}.json`);
190 for (const lang of TARGET_LANGS) {
191 const langFile = `${folder}/${lang}.json`;
192 const targetData = await loadJsonFile(langFile);
193 const updatedData = await addMissingKeysFromSource(
194 sourceData,
195 targetData,
196 lang.split("-")[0]
197 );
198 await saveJsonFile(langFile, updatedData);
199 }
200 }
201}
202
203updateLocalizationFiles().catch(console.error);

Callers 1

i18n.tsFile · 0.85

Calls 3

loadJsonFileFunction · 0.85
addMissingKeysFromSourceFunction · 0.85
saveJsonFileFunction · 0.85

Tested by

no test coverage detected