Module CYRILLIC title

Posted by Martin Velikov on 18-Apr-2017 05:57

Hello, 

Is there a way to write the Modules and Views names in cyrillic? I tried to add a title in the json file (in WebPageTest\meta\modules, but without any success.

Greetings,
Martin

Posted by egarcia on 18-Apr-2017 06:58

Hello Martin,

As you might have found, the module name and view name are validated. Only letters, numbers, "_" and "-" are allowed.

The name is used for the generation of the title used in the navigation panel as well as for names in JavaScript and Angular code. Changing the name in the metadata (.json files) would result on the name being used in the code generation.

Perhaps, in the future, for internationalization support, items like modules and view names that also have a title could have a title independently of the name used in JavaScript. I will suggest to have this included in the roadmap.

A possible way to provide a name in Cyrillic would be to have code to programmatically find the "title" and then replace the usage of the label in the corresponding <span> tag.

$("[title=Module1] span")[1].innerHTML = "София"

$("[title=CustomerDG] span")[0].innerHTML = "София"

You may need to customize app.js.ejs, in resources, to set the titles right after the landing-page/index.html file is loaded.

An alternative would be to change app.js.ejs to load an alternate landing-page/index.html.

Please notice that these customizations may need to be re-applied if the project structure changes in a future version.

I hope this helps,

Edsel

All Replies

Posted by egarcia on 18-Apr-2017 06:58

Hello Martin,

As you might have found, the module name and view name are validated. Only letters, numbers, "_" and "-" are allowed.

The name is used for the generation of the title used in the navigation panel as well as for names in JavaScript and Angular code. Changing the name in the metadata (.json files) would result on the name being used in the code generation.

Perhaps, in the future, for internationalization support, items like modules and view names that also have a title could have a title independently of the name used in JavaScript. I will suggest to have this included in the roadmap.

A possible way to provide a name in Cyrillic would be to have code to programmatically find the "title" and then replace the usage of the label in the corresponding <span> tag.

$("[title=Module1] span")[1].innerHTML = "София"

$("[title=CustomerDG] span")[0].innerHTML = "София"

You may need to customize app.js.ejs, in resources, to set the titles right after the landing-page/index.html file is loaded.

An alternative would be to change app.js.ejs to load an alternate landing-page/index.html.

Please notice that these customizations may need to be re-applied if the project structure changes in a future version.

I hope this helps,

Edsel

Posted by Martin Velikov on 20-Apr-2017 02:54

Thanks,

I made it this way in the OnShow:

var spans = document.getElementsByTagName("span");

                       for(var i=0;i<spans.length; i++) {

                           if(spans[i].innerHTML == "Sofia") {       //is this the "Sofia" span?

                               spans[i].innerHTML = "София";  //change to new value

                           }

                           if(spans[i].innerHTML == "Varna") {       //is this the "Varna" span?

                               spans[i].innerHTML = "Варна";  //change to new value

                           }

                       }

This thread is closed