@@ -174,18 +174,18 @@ async function setupCleanupHandlers() {
174174 } ) ;
175175}
176176
177- function needsTranslation ( enFilePath : string , lang : string ) : boolean {
177+ async function needsTranslation ( enFilePath : string , lang : string ) : boolean {
178178 const cnFilePath = enFilePath . replace (
179- enFilePath . sep + "en" + enFilePath . sep ,
180- enFilePath . sep + ".." + enFilePath . sep + "i18n" + enFilePath . sep + "translation_output" + enFilePath . sep + lang + enFilePath . sep
179+ path . sep + "en" + path . sep ,
180+ path . sep + ".." + path . sep + "i18n" + path . sep + "translation_output" + path . sep + lang + path . sep
181181 ) ;
182182 try {
183- const cnStats = await fs . promise . stat ( cnFilePath ) ;
183+ const cnStats = await fs . promises . stat ( cnFilePath ) ;
184184 if ( ! cnStats . isFile ( ) ) {
185185 return true ;
186186 }
187187
188- const enStats = await fs . promise . stat ( enFilePath ) ;
188+ const enStats = await fs . promises . stat ( enFilePath ) ;
189189 return enStats . mtime > cnStats . mtime ;
190190 } catch ( error ) {
191191 return true ;
@@ -244,7 +244,7 @@ async function findAllXmlFiles(directory: string): Promise<string[]> {
244244 }
245245 // Find all XML files
246246 console . log ( `Scanning directory: ${ enDirPath } ` ) ;
247- filestoTranslate = await findAllXmlFiles ( enDirPath ) ;
247+ filesToTranslate = await findAllXmlFiles ( enDirPath ) ;
248248 } else {
249249 const [ , , ...xmlFiles ] = process . argv ;
250250 filesToTranslate = xmlFiles . map ( file => path . join ( __dirname , ".." , file ) ) ;
@@ -273,7 +273,7 @@ async function findAllXmlFiles(directory: string): Promise<string[]> {
273273 const results = await Promise . allSettled (
274274 batch . map ( async file => {
275275 if ( absent ) {
276- if ( ! needsTranslation ( file , lang ) ) {
276+ if ( ! ( await needsTranslation ( file , lang ) ) ) {
277277 console . log ( `Skipped translation for ${ file } to language ${ lang } (yarn trans abs)` ) ;
278278 return { file, success : true } ;
279279 }
0 commit comments