How to set HTML5 Viewer's displaying language?
Hello,
Does there a way that the HTML5 Viewer's browser side javascript can force the viewer loaded in a specified language?
For example,
new geocortex.essentialsHtmlViewer.ViewerLoader().loadAndInitialize(...); <--- Specify what language to display
And does there a way the HTML5 viewer can change its displaying language on the fly?
Thank you in adavnce.
James
0
-
Hi James,
There is currently no way to change languages on-the-fly, as the language strings are among the first things loaded when the viewer is initialised. Changing the language would necessitate a full viewer reload. It's possible that this is something we could revisit in the next major revision of the HTML5 Viewer -- I'll raise it with the viewer team.
There is currently no way to specify a locale via the loadAndInitialize() method, although that seems like a fairly straightforward enhancement to add. I've filed an improvement and added you as a stakeholder (GVH-7346).
You can specify the language the viewer loads in using a URL parameter. This is from the viewer's Admin and Developer Guide:
locale
Specifies the language to use for the viewer. For this parameter to work, a language file for the specified language must exist
and be configured in the viewer configuration. See About Translating UI Text on page 258 for instructions.
Syntax: locale=xx-YY, where xx-YY is the language tag of the language file
The language code for xx is from the ISO 639-1 standard. The country code for YY is from the ISO 3166-1
standard.
Example: In this example, the viewer launches in Canadian French, provided the fr-CA language file exists and is configured.
http://server.domain.com/vwr/Index.html?locale=fr-CA
Note that if your viewer configuration does not also reference translated locale files in your viewer's Resources\Locales directory, the viewer will default to the invariant locale (which is en-US). See section 19 of the viewer's Admin and Dev guide for more details on translating the viewer itself.0 -
Hi Jordan,
Thank you for replying.
Definitely it will be good coverage if the loadAndInitialize() API could support more parameters.
We are using Javascript to initialize the Viewer since we need to register commands to the viewer.
How can we retrive the ViewerApplication object if we load the viewer through URL such as http://server.domain.com/vwr/Index.html?locale=fr-CA?
James0 -
Somehow I make the language switch works.
We put viewer in a dynamic inserted iFrame in our page. We give parameter "?locale=XYZ" while creating that iFrame.
Within the iFrame, we use javascript to initialize the viewer by new geocortex.essentialsHtmlViewer.ViewerLoader().loadAndInitialize();.
The the viewer presents in the language XYZ correctly.
This is little bit weird to me since it seems we initialize the viewer twice in this way.
James0 -
Hi there
In previous version of the viewer for html5 (prior to 2.5) there was an option to add the following line before the viewer.initialize(); command::
viewer.locale = "nb-NO";
This command forced the viewer to load unsing the nb-NO locale. The viewer.initialize(); command is now missing from the index.html. Does this mean that this option has been removed from the viewer? That is my understanding after reading Jordans answers.
Martin0
Please sign in to leave a comment.
Comments
4 comments