Skip to content

Commit ccb93af

Browse files
committed
fix(i18n): use key completion for dictionary status in dashboard table
1 parent 3b95b64 commit ccb93af

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

lunaria/components.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export const TableBody = (
250250
<tr>
251251
<td>${Link(links.source(file.source.path), collapsePath(file.source.path))}</td>
252252
${locales.map(({ lang }) => {
253-
return TableContentStatus(file.localizations, lang, lunaria)
253+
return TableContentStatus(file.localizations, lang, lunaria, file.type)
254254
})}
255255
</td>
256256
</tr>`,
@@ -263,10 +263,24 @@ export const TableContentStatus = (
263263
localizations: StatusEntry['localizations'],
264264
lang: string,
265265
lunaria: LunariaInstance,
266+
fileType?: string,
266267
): string => {
267268
const localization = localizations.find(localization => localization.lang === lang)!
268269
const isMissingKeys = 'missingKeys' in localization && localization.missingKeys.length > 0
269-
const status = isMissingKeys ? 'outdated' : localization.status
270+
// For dictionary files, status is determined solely by key completion:
271+
// if there are missing keys it's "outdated", if all keys are present it's "up-to-date",
272+
// regardless of git history. This prevents variants with merge coverage (e.g. en-US, en-GB)
273+
// from showing as outdated when their keys are fully covered by the base locale.
274+
const status =
275+
fileType === 'dictionary'
276+
? isMissingKeys
277+
? 'outdated'
278+
: localization.status === 'missing'
279+
? 'missing'
280+
: 'up-to-date'
281+
: isMissingKeys
282+
? 'outdated'
283+
: localization.status
270284
const links = lunaria.gitHostingLinks()
271285
const link =
272286
status === 'missing' ? links.create(localization.path) : links.source(localization.path)

0 commit comments

Comments
 (0)