Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set default value for all strings #552

Merged
merged 3 commits into from
May 11, 2021
Merged

Conversation

jenniferarnesen
Copy link
Contributor

@jenniferarnesen jenniferarnesen commented May 5, 2021

A default value will be set for every string. if no default value is specifically provided, then the key will be used. The end result is that the generated en.pot file contains translations for every string. This pot file is then accepted by transifex, allowing plurals to be properly translated. (after much trial and error together with Phil, we found that Transifex will not parse the imported pot file if only some of the strings have values)

d2-ui/interpretations currently uses this modified version of the extract.js script and it works as expected: https://github.com/dhis2/d2-ui/blob/master/packages/interpretations/scripts/extract.js

Would it be possible to release a beta to be tested with the DV app?

Here is an example of how plurals would look in code:

const replies = i18n.t(
            '{{count}} replies',
            {
                count: repliedBy.length,
                defaultValue: '{{count}} reply',
                defaultValue_plural: '{{count}} replies'
            });

(https://github.com/dhis2/d2-ui/blob/master/packages/interpretations/src/components/Interpretation/Replies.js#L73)

Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice find @jenniferarnesen !

@amcgee amcgee merged commit 3846fc0 into master May 11, 2021
@amcgee amcgee deleted the fix/handle-plurals-in-i18n branch May 11, 2021 06:20
dhis2-bot added a commit that referenced this pull request May 11, 2021
## [6.1.2](v6.1.1...v6.1.2) (2021-05-11)

### Bug Fixes

* set default value for all strings to support plurals ([#552](#552)) ([3846fc0](3846fc0))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 6.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants