2026-01-04 23:31:07 +02:00
import { LOCALES } from "../../packages/commons/src/lib/i18n" ;
import { getLanguageStats } from "./utils" ;
async function main() {
2026-02-06 19:38:24 +02:00
const project = "client" ;
const languageStats = await getLanguageStats ( project ) ;
const localesWithCoverage = languageStats . results
2026-01-04 23:31:07 +02:00
. filter ( language = > language . translated_percent > 50 )
2026-02-06 19:38:24 +02:00
for ( const localeData of localesWithCoverage ) {
const { language_code : localeId , translated_percent : percentage , language } = localeData ;
2026-01-04 23:31:07 +02:00
const locale = LOCALES . find ( l = > l . id === localeId ) ;
if ( ! locale ) {
2026-02-06 19:38:24 +02:00
console . error ( ` ❌ Language ${ language . name } ( ${ localeId } ) has a coverage of ${ percentage } % in ' ${ project } ', but it is not supported by the application. ` ) ;
2026-01-04 23:31:07 +02:00
process . exit ( 1 ) ;
}
}
2026-02-06 19:38:24 +02:00
console . log ( "✅ Translation coverage check passed." ) ;
2026-01-04 23:31:07 +02:00
}
main ( ) ;