NativeScript / NativeScript/plugins

[android][Localize] Values-(default language) not generated

Open
#369 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
206
Forks
123
Avg merge
2d 1h
Merged PRs (30d)
1

Description

Hi @NathanWalker,

There is little issue with the localize plugin, the default language not generated in his own folder because of this rule since it is the default language the hook generate the strings for res/values/strings.xml only, I think it should generate also res/values-en/strings.xml.

I suggest this :

run() {
    this.dataProvider.getLanguages().forEach((languageI18nEntries, language) => {
        // ADD THIS
        if(language === this.dataProvider.getDefaultLanguage()) {
            this.createLanguageResourcesFiles(language, false, languageI18nEntries);
        }
        this.createLanguageResourcesFiles(language, language === this.dataProvider.getDefaultLanguage(), languageI18nEntries);
    });
    if (fs.existsSync(this.appResourcesDirectoryPath) && fs.statSync(this.appResourcesDirectoryPath).isDirectory()) {
        this.cleanObsoleteResourcesFiles(this.appResourcesDirectoryPath, this.dataProvider.getLanguages());
    }
    return this;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/localize/hooks/converter.ts at the rule around line 105 and the run() entry point shown in the issue. Trace how the default language is passed to createLanguageResourcesFiles and verify the generated Android resources. Done means the default language produces both res/values/strings.xml and its language-specific res/values-en/strings.xml without breaking cleanup.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
localization, mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.