Home > Software design >  Internationalization in Android (Java), use default values of xliff:g in layouts (XML)
Internationalization in Android (Java), use default values of xliff:g in layouts (XML)

Time:01-19

I started with internationalization in Android with i18n I guess (by default in Android Studio). But, I have a major problem. My application needed to be able to inject variables in my strings, so I took care to use as I had seen on the problems

Do you know how I can solve this problem ? And why does this happen?

I thank you in advance, and wish you a good day!

CodePudding user response:

So, I found a solution, because, I'm stupid.

From this post :

The example attribute contains an example for the translator so that he knows whether a placeholder stands for an integer, a date, a name, an organization or something completely different, which may affect grammar in the target language.

So, I just had to add these two lines in my strings.xml file:

<string name="starting_default">Start: Unknown position.</string>
<string name="end_default">Arrival: Unknown position.</string>

And reference them in the activity_layout.xml file with the @string/starting_default value.

  • Related