Localization from JSON

how can i go about using json from an endpoint or hosted locally or whatever the case might be for localization? convert the keys into static constants ? this is what my json looks like

{
	"english": [{
		"key": "general_ok",
		"value": "Ok",
		"section": "General"
	}],
	"portugese": [{
		"key": "",
		"value": "",
		"section": ""
	}]
}

Hi @lganti,
Can you change your JSON or is it something that you cannot do? If you can change it, instead of using english, portuguese, try to use the language codes (Language and Locale IDs)

You can get that from the locale on the device. You can then read from that section accordingly.

cheers,

1 Like

There is an Accept-Language http header that works well for communicating this to the server.

Content-Language and other attributes help with saying what things are

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.