Language and localization

Applies to Self-Extracting, HTML Viewer, IE Browser publications.

HTML Executable provides localization support for your publications and ebooks. Explanatory field text and dialog captions can display in the language of your choice when your publication is run. This page allows you to manage the localization of your publication and to load/save language files.

img

Resource Strings

Resource strings are specific string constants used to translate the different messages and captions of the user interface’s items such as menus, buttons and titles of the windows.

Imagine you want to build a publication both in French and English. Instead of translating all texts in the different fields, finding all options, actions, etc… you just need to modify a list of strings: this is the goal of the resource string editor.

Resources strings can be invoked with the percent symbol % inserted before and after a constant: %SAbout%. These “string identifiers” take the place of string variables or literals. Publications replace each string identifier with its string value at runtime.

You can also put resource strings directly in your HTML pages (see below).

To edit a resource string, just select it in the list and the editor will appear:

img

Modify the contents of the Value field, and press Apply to save the resource string’s new value.

To add a resource string, click “Add String” and you will be prompted to enter the name for the new resource string. Its name should begin with an S, have no space nor special characters (only alpha-numeric ones) and finally it should be unique. You can then edit the value of the new resource string and press Apply to finish.

To remove a resource string, select it and click Remove. Only resource strings that you added (user resource strings) can be removed.

How to put a resource string directly into your HTML page.

This only works in HTML Viewer and IE Browser publications.

In HTML Viewer publications: put the following HTML code where you want to write the resource string:

<!--#resstring ID="[name of the resource string]" -->

Just replace the [name of the resource string] by the name of the resource string you want. For instance: SPubCopyright.

<!--#resstring ID="SPubCopyright" -->

The copyright text of the publication will be inserted in the HTML page.

In IE Browser publications: you have to use JavaScript code.

<script>

document.write(window.external.GetString('[name of the resource string]'));

</script>

If we follow the same example as above, this will lead to:

<script>

document.write(window.external.GetString('SPubCopyright'));

</script>

The result of this script is here:

Example not available in this online documentation: please run the offline help from HTML Executable to have a working example.

Strings for Dialog Boxes

These specific strings can only be used in Dialog Boxes to translate their titles and messages.

They can be invoked with the following syntax [#ID] where ID is the “string identifier”. Such IDs always begin with Y; example: [#YAbout] will be replaced by the value of “YAbout” which is “About”.

They are not available at runtime contrary to resource strings: all references to these strings are directly replaced when HTML Executable compiles the publication.

Managing these strings is exactly the same as for resource strings: see above.

About language files

You can import/export all strings from/to language files. These files are given the .hel extension. Use the Load/Save buttons to import or export language files.

Thus language files may be used in different publications. You can even share them with others.

Please update the properties of a language file if you plan to distribute it. Properties are only for informative purposes at this time, but this may change in the future. The locale number is the numeric “language identifier” of the language. Visit http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx for the list of available language identifiers.

Current strings are automatically saved in the project file, so you do not need to maintain a language file for your project.

You can specify a default language file in the Environment Options so that it is always loaded when a new project is created.

Additional resource strings

Some resource strings are automatically created by HTML Executable when compiling your publication:

  • SPubTitle contains the title of your publication.

  • SPubHomepage contains the default homepage URL.

  • SPubAuthor contains the author name.

  • SPubCopyright contains the copyright of your publication.

  • SPubEMail contains the author E-Mail.

  • SPubVersion contains the version number of your publication, as defined in the Icon / Version tab.

  • SPubProductVer contains the product version number of your publication, as defined in the Icon / Version tab.

You can use these resource strings in your HTML pages and scripts.


Copyright G.D.G. Software 2016. All rights reserved