@@ -174,18 +174,18 @@ async function setupCleanupHandlers() {
174
174
} ) ;
175
175
}
176
176
177
- function needsTranslation ( enFilePath : string , lang : string ) : boolean {
177
+ async function needsTranslation ( enFilePath : string , lang : string ) : boolean {
178
178
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
181
181
) ;
182
182
try {
183
- const cnStats = await fs . promise . stat ( cnFilePath ) ;
183
+ const cnStats = await fs . promises . stat ( cnFilePath ) ;
184
184
if ( ! cnStats . isFile ( ) ) {
185
185
return true ;
186
186
}
187
187
188
- const enStats = await fs . promise . stat ( enFilePath ) ;
188
+ const enStats = await fs . promises . stat ( enFilePath ) ;
189
189
return enStats . mtime > cnStats . mtime ;
190
190
} catch ( error ) {
191
191
return true ;
@@ -244,7 +244,7 @@ async function findAllXmlFiles(directory: string): Promise<string[]> {
244
244
}
245
245
// Find all XML files
246
246
console . log ( `Scanning directory: ${ enDirPath } ` ) ;
247
- filestoTranslate = await findAllXmlFiles ( enDirPath ) ;
247
+ filesToTranslate = await findAllXmlFiles ( enDirPath ) ;
248
248
} else {
249
249
const [ , , ...xmlFiles ] = process . argv ;
250
250
filesToTranslate = xmlFiles . map ( file => path . join ( __dirname , ".." , file ) ) ;
@@ -273,7 +273,7 @@ async function findAllXmlFiles(directory: string): Promise<string[]> {
273
273
const results = await Promise . allSettled (
274
274
batch . map ( async file => {
275
275
if ( absent ) {
276
- if ( ! needsTranslation ( file , lang ) ) {
276
+ if ( ! ( await needsTranslation ( file , lang ) ) ) {
277
277
console . log ( `Skipped translation for ${ file } to language ${ lang } (yarn trans abs)` ) ;
278
278
return { file, success : true } ;
279
279
}
0 commit comments