Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:57:58+00:00 2026-06-05T21:57:58+00:00

I have two template files: one for the form (loginFormTemplate) and one for the

  • 0

I have two template files: one for the form (loginFormTemplate) and one for the dialog (dialogTemplate). When I put them togheter I only get the i18n on my form (like ${i18n.username}, etc.), but not my dialog html it’s says ${undefined}. I have clearly defined it in my nls file. Why? Here’s my code when I construct my dialog.

        var template = lang.replace(dialogTemplate, {
            form: loginFormTemplate                
        });

        var contentWidget = new (declare(
            [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin],
            {
                templateString: template,
                i18n: i18n   
            }
        ));

I could create “variables” just like my form within the dialoTemplate and pass my i18n value, but I don’t find it quite elegant. I just want to do it once. So, instead it would be like this.

    var template = lang.replace(dialogTemplate, {
            form: loginFormTemplate,
            _ok: i18n.okLabel,
            _cancel: i18n.cancelLabel
        });

        var contentWidget = new (declare(
            [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin],
            {
                templateString: template,
                i18n: i18n   
            }
        ));

Here’s my solution with with phusick answer (my form is notated %[]):

var template = lang.replace(
                dialogTemplate,
                {form: loginFormTemplate},
                /\%\[([^\]]+)\]/g
            );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:58:01+00:00Added an answer on June 5, 2026 at 9:58 pm

    I’m not by my computer, but I guess calling ‘lang.replace’ replaces not only {form}, but also your ${i18n.*} with undefined since only ‘form’ is defined when calling ‘lang.replace’.

    Edit: You can use ‘lang.replace’ with a custom pattern to avoid conflicts between i18n and string concatenation: http://livedocs.dojotoolkit.org/dojo/_base/lang#advanced-usage

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two files the one which hosts my actual contact form and then
I have two template files. One is a twig template and another is a
I have a small problem with Smarty... I have two different template files in
i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I have a gridview that displays items details, I added two template fields one
The situation is I have two xslt files: one is called from my ASP.NET
I have two files in my src/main/resources and I want one file's body to
Inside my view.py, I have two functions, one that processes input from a form
I have two XML files to render one page in XSLT. This is because
I have an excel file (that I use as a template) with two rows.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.