Cannot get translation in .html file

Hi all, I am working through a node I maintain and adding i18n to the html and JS

So far, I have ...

  • replacing static text with spans - :white_check_mark:
    • <span data-i18n="mssql.node.label.connection">
  • replacing titles and placeholders - :white_check_mark:
    • <input data-i18n="[placeholder]mssql.node.label.name"> </input>
    • <div data-i18n="[placeholder]mssql.node.label.name"> </div>
  • Accessing translations in html script - :x:
    • RED._("mssql.common.query") not working

/src/mssql.html...

         var modeField = $("#node-input-modeOpt").typedInput(
                {
                    types:[
                        { value:"query", label: RED._("mssql.common.query"),  hasValue:false },
                        { value:"execute", label: RED._("mssql.common.execute_procedure"),  hasValue:false },
                        'msg', 'flow', 'global', 'env'            
                    ],
                    typeField: $("#node-input-modeOptType"),
                    default:"query"
                });

/src/en-US/mssql.json...

{
    "mssql": {
        "common": {
            "editor": "Editor",
            "query": "Query",
            "execute_procedure": "Execute Procedure"            
        },
   ...
   ...

I get this (first two items in the dropdown should be "Query" and "Execute Query" - instead, they are the path to the i18n value)...
image

File layout...

  • src
    • locales
      • en-US
        • mssql.json
      • mssql.html
      • mssql.js

False alarm - I have solved it - i missed it at the bottom of this page...

As well as the data-i18n attribute for html elements, all node definition functions (for example, oneditprepare ) can use this._() to retrieve messages.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.