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

Android exporter: Position indexing of placeholders #10

Open
stadler opened this issue Nov 5, 2014 · 2 comments
Open

Android exporter: Position indexing of placeholders #10

stadler opened this issue Nov 5, 2014 · 2 comments

Comments

@stadler
Copy link
Collaborator

stadler commented Nov 5, 2014

We usually use trema as a single strings repository between iOS and Android apps (on same projects).
iOS uses the C printf string formatting, and Android uses something similar to Java's printf.
However Android extends this support by adding explicit position indexing for the format place holders when there are more than one. This way you can change the position of the placeholder in the localized text, but still preserver the order of the arguments.
E.g.
EN: Hello, %1$s! You have %2$d new messages.
DE: In german you might want to first show the number of messages %2$d and then greet the person by name: %1$s
In code you will have something like 'String.format(stringResource, name, messageCount)'.
Now what I did last time, I implemented support for placeholder indexing and mapped the objective-C placeholders to Android placeholders. However in future we might need some extra formatting like precision for numbers, or fix length, etc. As the Android formatter also should support these features, someone should investigate how they can be combined with the indexing of the arguments. This is not documented on the Android site.

Required skills: Android developer

@pmilosev
Copy link

pmilosev commented May 11, 2018

@stadler I realize it is almost 4 years later, but do we have the mobile scripts published ?
#17
I believe the formatters are already handled and supported in both Android and iOS since few years ago. If I remember correctly tremma supports the intersection of what was available on both platforms.

@stadler
Copy link
Collaborator Author

stadler commented May 14, 2018

Hi @pmilosev
I am not aware of those mobile scripts. Do you mean the maven, eclipse or intelliJ Plugins?
Otherwise you need to check yourself, because I am neither fully aware of all the functionality that is part of trema, as it was initiated long before I entered NCA. And note that I am no longer an NCA employee anymore.

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

No branches or pull requests

2 participants