Quick note

Localization in widgets used as EPiServer gadgets or property editors

Given a language resource file like this:

<?xml version="1.0" encoding="utf-8" ?>
  <language name="English" id="en">

The node "mystuff" can be accessed in a JavaScript UI-component such as a gadget or custom editor using require and the i18n module, like this:

], function (
) {
    return declare("", [], {
        resources: resources,

The resources variable will be an object like this:

    substuff: {
        key: "value"

To instead retrieve only the "substuff" element the required module can be modified to epi/i18n!epi/cms/nls/mystuff.substuff.

To output a localized resource like "key" above in a template the following can be used:

Joel Abrahamsson

Joel Abrahamsson

I'm a passionate web developer and systems architect living in Stockholm, Sweden. I work as CTO for a large media site and enjoy developing with all technologies, especially .NET, Node.js, and ElasticSearch. Read more

More about EPiServer CMS