Skip to content

Android exporter: Position indexing of placeholders #10

@stadler

Description

@stadler

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions