# Localization from JSON

**URL:** <https://forums.kodeco.com/t/localization-from-json/88180>\
**Category:** iOS\
**Created:** [November 15, 2019, 5:13am UTC](https://forums.kodeco.com/t/localization-from-json/88180 "2019-11-15T05:13:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lganti](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lganti/32/103565_2.png) [@lganti](https://forums.kodeco.com/u/lganti)\
**Post date:** [November 15, 2019, 5:13am UTC](https://forums.kodeco.com/t/localization-from-json/88180/1 "2019-11-15T05:13:26Z")

</div>

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": ""
	}]
}

```

---

<div class="post-metadata">

**Author:** ![jayantvarma](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jayantvarma/32/111768_2.png) [@jayantvarma](https://forums.kodeco.com/u/jayantvarma)\
**Post date:** [November 15, 2019, 9:31am UTC](https://forums.kodeco.com/t/localization-from-json/88180/2 "2019-11-15T09:31:53Z")

</div>

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](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html))

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

cheers,

---

<div class="post-metadata">

**Author:** ![mj\_langford](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mj_langford/32/84596_2.png) [@mj\_langford](https://forums.kodeco.com/u/mj_langford)\
**Post date:** [November 20, 2019, 11:09pm UTC](https://forums.kodeco.com/t/localization-from-json/88180/3 "2019-11-20T23:09:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [April 29, 2020, 9:17pm UTC](https://forums.kodeco.com/t/localization-from-json/88180/4 "2020-04-29T21:17:22Z")

</div>

Closed on April 29, 2020, 9:17pm UTC

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