Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lunaria/prepare-json-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function mergeLocale(locale: LocaleObject): Promise<void> {

await fs.writeFile(
path.resolve(`${destFolder}/${locale.code}.json`),
JSON.stringify(source, null, 2),
`${JSON.stringify(source, null, 2)}\n`,
'utf-8',
)
}
12 changes: 12 additions & 0 deletions scripts/compare-translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ const processLocale = async (
): Promise<SyncStats> => {
const filePath = join(LOCALES_DIRECTORY, localeFile)
const localeInfo = checkJsonName(filePath)

// prevent updating wrong locale file:
// - language locale files at countries allowed: e.g. es.json
// - country locale file forbidden: e.g. es-ES.json
// - target locale file forbidden: e.g. es-419.json
if (fix && localeInfo.mergeLocale) {
console.error(
`${COLORS.red}Error: Locale "${localeInfo.locale}" cannot be fixed, fix the ${localeInfo.lang} locale instead!.${COLORS.reset}`,
)
process.exit(1)
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const targetContent = await loadJson(localeInfo)

const stats: SyncStats = {
Expand Down
Loading