Localization

Several mechanisms are supported for localization. At the core lies the ability to give string nodes a tag id, targeting them with tag selectors and finally adding child nodes.

// inline localization (use a tag id for the string so it can easily refactored later)
html {
   body {
      h1 {
         #message : "This is the heading in the default application locale" {
            de : "This is the german heading"
         }
      }
   }
}

// localization using a bundle and tag selectors:

bundle#main {
   #message {
      de: "This is the german heading";
   }
}

html : bundle#main {
   body {
      h1 {
         // value types support "var" nodes that derive their tag name from inherited the value type
         #message : "This is the heading in the default application locale"
      }
   }
}


In many ways, the bundle node is similar to the css node in that it has a specialized syntax where the child nodes are rules using tag selectors or nodes with same tag name.

Parameters

Localized strings have support for parameters in using the standard parameter syntax:

   #message : "Hello. You wrote this message {usermessage?}" {
      da: "Hej. Din besked var {usermessage?}"
   }

Variable expansion is performed on the string, and more complex expressions can be used, but it's considered good form to declare the parameter as a named node for use within the string. This simplifies the string that is shown to and edited by the translator.

Last edited Oct 3, 2010 at 7:43 PM by jimmeyer, version 4

Comments

No comments yet.