netceteragroup / trema-core

Trema foundation
MIT License
4 stars 2 forks source link

Android exporter: Position indexing of placeholders #10

Open stadler opened 10 years ago

stadler commented 10 years ago

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 commented 6 years ago

@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 commented 6 years ago

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.