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

XML processor ignores positional index on parameters #35

Open
dalewking opened this issue Nov 29, 2023 · 0 comments
Open

XML processor ignores positional index on parameters #35

dalewking opened this issue Nov 29, 2023 · 0 comments
Labels
codegen: android-xml Codegen from Android String Resources conversion issue

Comments

@dalewking
Copy link

dalewking commented Nov 29, 2023

When specifying printf format strings you can include a parameter index to refer to which of the arguments you are referring to. For example this would include the first parameter followed by the second parameter

    <string name="foo">%1$d - %2$s</string>

This is important because not all translations will use the paramters in the same order and in some cases may use a paramter more than once. A particular translation is allowed to do something like:

    <string name="foo">%2$s - %1$d - %2$s</string>

The XML processor simply throws away the index and assumes that all translations use the parameters only once and in the same order. For the first one it will generate a function with Int and String parameters. The second one will generate parameters of String, Int, String

@DevNatan DevNatan added the codegen: android-xml Codegen from Android String Resources conversion issue label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen: android-xml Codegen from Android String Resources conversion issue
Projects
None yet
Development

No branches or pull requests

2 participants