@@ -111,16 +111,22 @@ export async function processBuildTranslations(
111111 config,
112112 } ) ;
113113
114+ // When pluralization is enabled, we need to generate the source locale file too
115+ // because pluralization modifies the sourceText
116+ const needsSourceLocale = config . pluralization ?. enabled !== false ;
117+ const allLocales = needsSourceLocale
118+ ? [ config . sourceLocale , ...config . targetLocales ]
119+ : config . targetLocales ;
120+
114121 logger . info (
115- `Processing translations for ${ config . targetLocales . length } locale(s)...` ,
122+ `Processing translations for ${ allLocales . length } locale(s)${ needsSourceLocale ? " (including source locale for pluralization)" : "" } ...` ,
116123 ) ;
117124
118125 const stats : BuildTranslationResult [ "stats" ] = { } ;
119126 const errors : Array < { locale : string ; error : string } > = [ ] ;
120127
121128 // Translate all locales in parallel
122- // TODO (AleksandrSl 07/12/2025): We have to include the sourceLocale too.
123- const localePromises = config . targetLocales . map ( async ( locale ) => {
129+ const localePromises = allLocales . map ( async ( locale ) => {
124130 logger . info ( `Translating to ${ locale } ...` ) ;
125131
126132 const result = await translationServer ! . translateAll ( locale ) ;
@@ -191,7 +197,13 @@ async function validateCache(
191197 total : number ;
192198 } > = [ ] ;
193199
194- for ( const locale of config . targetLocales ) {
200+ // Include source locale if pluralization is enabled
201+ const needsSourceLocale = config . pluralization ?. enabled !== false ;
202+ const allLocales = needsSourceLocale
203+ ? [ config . sourceLocale , ...config . targetLocales ]
204+ : config . targetLocales ;
205+
206+ for ( const locale of allLocales ) {
195207 const cacheFilePath = getCachePath ( config , locale ) ;
196208
197209 try {
@@ -236,7 +248,13 @@ function buildCacheStats(
236248 const totalEntries = Object . keys ( metadata . entries ) . length ;
237249 const stats : BuildTranslationResult [ "stats" ] = { } ;
238250
239- for ( const locale of config . targetLocales ) {
251+ // Include source locale if pluralization is enabled
252+ const needsSourceLocale = config . pluralization ?. enabled !== false ;
253+ const allLocales = needsSourceLocale
254+ ? [ config . sourceLocale , ...config . targetLocales ]
255+ : config . targetLocales ;
256+
257+ for ( const locale of allLocales ) {
240258 stats [ locale ] = {
241259 total : totalEntries ,
242260 translated : totalEntries , // Assumed complete if validation passed
@@ -255,7 +273,13 @@ async function copyStaticFiles(
255273
256274 await fs . mkdir ( publicOutputPath , { recursive : true } ) ;
257275
258- for ( const locale of config . targetLocales ) {
276+ // Include source locale if pluralization is enabled
277+ const needsSourceLocale = config . pluralization ?. enabled !== false ;
278+ const allLocales = needsSourceLocale
279+ ? [ config . sourceLocale , ...config . targetLocales ]
280+ : config . targetLocales ;
281+
282+ for ( const locale of allLocales ) {
259283 const cacheFilePath = getCachePath ( config , locale ) ;
260284 const publicFilePath = path . join ( publicOutputPath , `${ locale } .json` ) ;
261285
0 commit comments