Term Substitution

From Pointui

To support languages other than English there is a term substitution capability available through the global Terms object. The terms are defined in xml files and as a minimum Pointui will provide an xml file containing the English terms with no corresponding substitution. Typically, the xml file is called "Terms.xml" and is located in each Theme folder as well as each Applet folder. It is also possible to use multiple xml files for a single Applet for instance. An Applet could be developed to support a range of languages and provide the ability for the user to select a language, at which point the Applet could load in the xml file appropriate for the language.

NOTE: only languages compatible with the ASCII character set can be rendered at this stage in Home 2. This will be expanded in the future to include languages requiring Unicode when GDI rendering is incorporated into the Revolution Engine™.

XML File Format (Terms.xml)

The file format for Home 2 is exactly the same as previous versions of Home. Here is an example:

<terms>
	<term name="Simple Term With No Translation"></term>
	<term name="Original Term Perhaps in English">Translated Value</term>
</terms>

Each term is a new term node in the xml. If a translated value is supplied then it will override the original term value and be used instead.

The term substitution allows for more than just other languages, it also allows device specific customizations. For instance, if there are paths specific to devices then you could add a term like:

<terms>
	<term name="Slideshow.Application.Filename">\myslideshowapp.exe</term>
</terms>

To make use of this term you could use the following script code:

String appToLaunch;
appToLaunch = Terms.Get("Slideshow.Application.Filename");
Process.Start(appToLaunch);

Using Terms in Applets

To make use of terms in applets you just need to load in the xml file. Here is an example:

class SlideshowApplet : Applet
{
	void Load()
	{
		Terms.LoadFromFile("French.xml");
		Terms.LoadFromFile("CustomPaths.xml");
	}
}

The above code will load will look in the applet folder and import in all of the terms in the "French.xml" file which we would expect to contain French translations for the terms used in the applet. In addition, it would import in all of the terms in "CustomPaths.xml" - these would be applied over the top of the ones from "French.xml" - so any new terms are just added, and any terms in "CustomPaths.xml" that had already exists (been defined in "French.xml") would overwrite the previous value.