mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 16:03:20 +00:00
Fix undeclared dynamic localization key check
This commit is contained in:
@@ -34,10 +34,7 @@ export function compareExtraction(extractedCatalog, englishCatalog) {
|
||||
const dynamicDefaults = [...extracted.entries()]
|
||||
.filter(([, value]) => value.length === 0)
|
||||
.map(([key]) => key)
|
||||
const missingFromEnglish = [...extracted.entries()]
|
||||
.filter(([, value]) => value.length > 0)
|
||||
.map(([key]) => key)
|
||||
.filter((key) => !english.has(key))
|
||||
const missingFromEnglish = [...extracted.keys()].filter((key) => !english.has(key))
|
||||
const orphans = [...english.keys()].filter((key) => !extracted.has(key))
|
||||
const fallbackDrift = []
|
||||
const placeholderMismatches = []
|
||||
|
||||
@@ -25,6 +25,12 @@ describe('verify-localization-extraction', () => {
|
||||
expect(result.placeholderMismatches).toEqual([])
|
||||
})
|
||||
|
||||
it('rejects undeclared keys even when their defaults are dynamic', () => {
|
||||
const result = compareExtraction({ menu: { dynamic: '' } }, {})
|
||||
|
||||
expect(result.missingFromEnglish).toEqual(['menu.dynamic'])
|
||||
})
|
||||
|
||||
it('rejects missing English declarations and incompatible placeholders', () => {
|
||||
const result = compareExtraction(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user