diff --git a/demo/app/i18n/fr-CA.json b/demo/app/i18n/fr-CA.json new file mode 100644 index 0000000..a006b45 --- /dev/null +++ b/demo/app/i18n/fr-CA.json @@ -0,0 +1,5 @@ +{ + "hello": { + "world": "Bonjour le monde ! Hello world !" + } +} diff --git a/hooks/converter.android.ts b/hooks/converter.android.ts index e33fe0d..b05e04d 100644 --- a/hooks/converter.android.ts +++ b/hooks/converter.android.ts @@ -20,7 +20,7 @@ export class ConverterAndroid extends ConverterCommon { protected cleanObsoleteResourcesFiles(resourcesDirectory: string, languages: Languages): this { fs.readdirSync(resourcesDirectory).filter(fileName => { const match = /^values-(.+)$/.exec(fileName); - return match && !languages.has(match[1]); + return match && !languages.has(match[1].replace(/^(.+?)-r(.+?)$/, "$1-$2")); }).map(fileName => { return path.join(resourcesDirectory, fileName); }).filter(filePath => { @@ -42,7 +42,7 @@ export class ConverterAndroid extends ConverterCommon { ): this { const languageResourcesDir = path.join( this.appResourcesDirectoryPath, - `values${isDefaultLanguage ? "" : `-${language}`}` + `values${isDefaultLanguage ? "" : `-${language.replace(/^(.+?)-(.+?)$/, "$1-r$2")}`}` ); this.createDirectoryIfNeeded(languageResourcesDir); let strings = "\n\n";