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

Add support for plurals #4

Open
oprisnik opened this issue Feb 4, 2015 · 7 comments
Open

Add support for plurals #4

oprisnik opened this issue Feb 4, 2015 · 7 comments

Comments

@oprisnik
Copy link

oprisnik commented Feb 4, 2015

GetLocalization also supports plurals - but your plugin currently only supports simple string resources.

https://developer.android.com/guide/topics/resources/string-resource.html#Plurals

Example:

<plurals name="points_plural">
    <item quantity="one">%d point</item>
    <item quantity="other">%d points</item>
</plurals>
@oprisnik
Copy link
Author

oprisnik commented Feb 4, 2015

You could just save the whole XML file you receive from https://api.getlocalization.com/[project-name]/api/translations/file/[master-file-name]/[language-tag]/ instead of parsing the file and only writing the entries.

@johnuopini
Copy link
Owner

@oprisnik if you download the file you cannot ensure that apostrophes are properly escaped, this is the reason why i parsed it, does getlocalization now do the sanity checks for android by its own?

@oprisnik
Copy link
Author

oprisnik commented Feb 9, 2015

Oh, I wasn't aware of this issue.
I've just checked some Italian translations and it seems to be fixed.

Example: In GetLocalization the string has been translated with "L'ultimo giocatore".
XML from GetLocalization:

 <string name="last_player">L\'ultimo giocatore</string>

At least in this case it seems to work - not sure though if this is always the case.

@johnuopini
Copy link
Owner

The parser was also converting "..." with the proper xml char as per Android guidelines so not sure if its better too keep it parsed or download the raw

@oprisnik
Copy link
Author

oprisnik commented Feb 9, 2015

Ah ok, that's nice! Maybe it's better to keep parsing then - and to also parse the plural tags accordingly (and maybe even comments).

@davidvavra
Copy link

This library seems unmaintained so I released my fork to jcenter() which fixes this issue.

https://github.com/step-up-labs/gradle-getlocalization-plugin

You can add it by:

repositories {
    jcenter()
}
dependencies {
    classpath 'io.stepuplabs.getlocalization.gradle:gradle-getlocalization-plugin:1.2.1'
}

@oprisnik
Copy link
Author

Nice, thanks @davidvavra :)

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

No branches or pull requests

3 participants