Tanveer singh Bhatia
Tanveer singh Bhatia

Reputation: 69

How to do localisation of dynamic string in android

I have a string <string name="time_required">%1$s %2$s</string> here %1$s is a number(example: 14) and %2$s is a string. My localisation is working properly for all other type of string resources, but the dynamic strings which contain string values like "abc", "aabc" or any strings, these are not converted into my desired language. Can someone help me out?

Upvotes: 0

Views: 411

Answers (1)

Dhaval
Dhaval

Reputation: 2874

Dynamic string values will not be converted in locale string.

Generally what you can do if dynamic strings are coming from server:

  1. You can pass device locale in header when you call API (e.g. EN)
  2. Server will response in requested language
  3. Your app will display that language.

For most cases, dynamic strings values have to come from server pre locallized.

Upvotes: 1

Related Questions