Skip to content

Commit

Permalink
Fix #34: Add region support for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
lfabreges committed May 7, 2018
1 parent ec953a6 commit d059895
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions demo/app/i18n/fr-CA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hello": {
"world": "Bonjour le monde ! Hello world !"
}
}
4 changes: 2 additions & 2 deletions hooks/converter.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n";
Expand Down

0 comments on commit d059895

Please sign in to comment.