mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
* 🔧 chore: Add writeJSONWithPrettier utility and update locale generation scripts * 🔧 chore: Implement genRemoveDiff utility for locale diff analysis and update workflow * chore: update script * chore: revert * 🔧 chore: Refactor genDiff to improve diff analysis and streamline locale processing
20 lines
714 B
TypeScript
20 lines
714 B
TypeScript
import { consola } from 'consola';
|
|
import { colors } from 'consola/utils';
|
|
|
|
import { entryLocaleJsonFilepath, i18nConfig, srcDefaultLocales } from './const';
|
|
import { tagWhite, writeJSONWithPrettier } from './utils';
|
|
|
|
export const genDefaultLocale = () => {
|
|
consola.info(`Default locale is ${i18nConfig.entryLocale}...`);
|
|
|
|
const resources = require(srcDefaultLocales);
|
|
const data = Object.entries(resources.default);
|
|
consola.start(`Generate default locale json, found ${data.length} namespaces...`);
|
|
|
|
for (const [ns, value] of data) {
|
|
const filepath = entryLocaleJsonFilepath(`${ns}.json`);
|
|
writeJSONWithPrettier(filepath, value);
|
|
consola.success(tagWhite(ns), colors.gray(filepath));
|
|
}
|
|
};
|