import type { definitions } from '@inlang/database' ; type File = { path : string ; content : Record < string , string | undefined > | undefined ; } ; type AdapterExport = { files : File [ ] ; } ; /**
 * a locale can be undefined e.g.
 * "fr" does not exist in the project locales ["de", "en"]
 *
 * a key can be undefined for a specific locale because
 * "example.hello" may not exist for "de", but for "en"
 */ type AllTranslations = { [ locale ] : undefined | { [ key ] : string | undefined ; } ; } ; export function exportI18nNext ( args ) { const files = [ ] ; const allTranslations = { } ; for ( const translation of args . translations ) { if ( allTranslations [ translation . iso_code ] === undefined ) { allTranslations [ translation . iso_code ] = { } ; } allTranslations [ translation . iso_code ] ! [ translation . key_name ] = translation . text ; } for ( const iso in allTranslations ) { files . push ( { path : `./public/locales/${ iso }/translation.json` , content : allTranslations [ iso ] } ) ; } return { files : files } ; }