# Javascript Strings and Localization

**URL:** <https://discourse.mozilla.org/t/javascript-strings-and-localization/11217>\
**Category:** Add-ons\
**Created:** [October 1, 2016, 5:23pm UTC](https://discourse.mozilla.org/t/javascript-strings-and-localization/11217 "2016-10-01T17:23:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljayd](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/pauljayd/32/3314_2.png) [@pauljayd](https://discourse.mozilla.org/u/pauljayd)\
**Post date:** [October 1, 2016, 5:23pm UTC](https://discourse.mozilla.org/t/javascript-strings-and-localization/11217/1 "2016-10-01T17:23:22Z")

</div>

How can I localize/access Java Strings from background or content scripts?  
My addon gets the following string from a .properties file via string bundle, then JSON.parse()'s it:

```
actionsjson = [\
  {"code": "AudioFirstActive",\
                  "visual": "Audio Focus First Active",\
                  "tip": "Make first active Audio the current Tab (left)"},\

```

{…next entry…

where “visual” and “tip” can be localized.

---

<div class="post-metadata">

**Author:** ![noitidart](https://avatars.discourse-cdn.com/v4/letter/n/9f8e36/32.png) [@noitidart](https://discourse.mozilla.org/u/noitidart)\
**Post date:** [October 2, 2016, 10:52am UTC](https://discourse.mozilla.org/t/javascript-strings-and-localization/11217/2 "2016-10-02T10:52:34Z")

</div>

You have to use:

[https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/i18n](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/i18n)

This example is useful:

[https://github.com/mdn/webextensions-examples/tree/master/context-menu-demo](https://github.com/mdn/webextensions-examples/tree/master/context-menu-demo)
