The localized tags allow you to design Miva Script programs that can display in various languages. In this way your programs can become truly international. <MvLOCALIZED> Starts the localization process. The tag can create a variable for output.
Localization allows you embed language specific prompts in your scripts. Attributes
Language IdentifiersThere are two language identifiers (current and default) that are set using two built-in functions:
The default is "en-US" for English-United States. This example sets language to German. Example:
<MvASSIGN NAME="l.ok" VALUE="{ miva_setlanguage ('de-DE') }">
The system variables s.miva_defaultlanguage retrieve the current language settings. Example:
The current language is <MvEVAL EXPR="{ s.miva_defaultlanguage }">
Localization BlocksThe <MvLOCALIZED> tag starts the localization process. The tag can create a variable for output. Example:<MvLOCALIZED NAME="l.output" ID="001" STANDARDOUTPUTLEVEL=""> Localized TextDefines the text for the language specified by the LANGUAGE attribute. HTML is allowed, but no Miva tags may exist between the <MvLOCALIZED-TEXT> and </MvLOCALIZED-TEXT> tags. You can include localized text for as many languages as you like. This examples displays the text for the previously set language. Example:<MvLOCALIZED-TEXT LANGUAGE = "en-US">Category: </MvLOCALIZED-TEXT> <MvLOCALIZED-TEXT LANGUAGE = "de-DE">Kategorie: </MvLOCALIZED-TEXT> Localized TokenCreates a "token" (or representation) which can then be displayed in localized text. Must be inside the <MvLOCALIZED> block and must precede any <MvLOCALIZED-TEXT> blocks that use the token. You can include localized text for as many languages as you like. This examples displays the text for the previously set language. Example:
<MvLOCALIZED NAME = "g.Message" ID = "MER-ADM-00224">
<MvLOCALIZED-TOKEN NAME = "store_name"
VALUE = "{ encodeentities(Stores.d.name) }">
<MvLOCALIZED-TEXT LANGUAGE = "en-US">
Database Files for Store '%store_name%' Packed.</MvLOCALIZED-TEXT>
<MvLOCALIZED-TEXT LANGUAGE = "de-DE">
Datenbankdateien f¸r Laden '%store_name%' gepackt.</MvLOCALIZED-TEXT>
</MvLOCALIZED>
Localization ExampleIn this example, a user select a language from a form. When submitted the default language is set and a message is displayed in the correct language. Example:
<form method = "get">
<select name = "Language">
<option value = "en-US">English</option>
<option value = "de-DE">German</option>
</select >
<input type = "submit">
</form>
<MvIF EXPR = "{ len( g.Language ) }">
<MvEVAL EXPR = "{ miva_setlanguage( g.Language ) }">
</MvIF>
<MvLOCALIZED>
<MvLOCALIZED-TEXT LANGUAGE = "en-US">This is the english.</MvLOCALIZED-TEXT>
<MvLOCALIZED-TEXT LANGUAGE = "de-DE">Dies ist das deutsche.</MvLOCALIZED-TEXT>
</MvLOCALIZED>
|