nls support for app title, subtitle, links, etc

1835
2
Jump to solution
07-07-2016 06:50 AM
JosephRogan
New Contributor III

The apps I produce always need to be bilingual, English/French.  This is easy to do with custom widgets, using the nls files.  I even modified the About widget to use the nls for it's content instead of the config.

Is it possible to have the title, subtitle, and links pull from an nls file?  If not built in, has anyone modified WAB (dev edition) to do this?

Thanks!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Joseph,

  That depends on the theme you are using. If you are using the Foldable, Jewlerybox, Plateau themes then you would adjust the code in the HeaderController widgets Widget.js postCreate function i.e.

this.switchableElements.title.innerHTML =

          utils.sanitizeHTML(this.appConfig.title ? this.appConfig.title : '');

        this.switchableElements.subtitle.innerHTML =

          utils.sanitizeHTML(this.appConfig.subtitle ? this.appConfig.subtitle : '');

Links are a little more:

_createDynamicLinks function:

innerHTML: utils.sanitizeHTML(link.label),

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Joseph,

  That depends on the theme you are using. If you are using the Foldable, Jewlerybox, Plateau themes then you would adjust the code in the HeaderController widgets Widget.js postCreate function i.e.

this.switchableElements.title.innerHTML =

          utils.sanitizeHTML(this.appConfig.title ? this.appConfig.title : '');

        this.switchableElements.subtitle.innerHTML =

          utils.sanitizeHTML(this.appConfig.subtitle ? this.appConfig.subtitle : '');

Links are a little more:

_createDynamicLinks function:

innerHTML: utils.sanitizeHTML(link.label),

JosephRogan
New Contributor III

I have a custom "Banner" widget, which was based off of the HeaderController from the Foldable theme.

I'm hoping to keep it as dynamic as possible with the WABde, but I think for apps that must be bilingual I will have to override this title code each time.  I might build in some of the common Links to be replaced with nls when they are found.

Thanks for pointing me in the correct direction!

0 Kudos