|
|
[Motivation] [Design Goals/Requirements] [The Name 'Fardel'] [Structure] [Resource Names - The Programmer's View] [Locales - The Translator's View] [Fardel Resource-Scripts]
While extending some small windows applications in C++, it became apparent that Microsoft Developer Studio (version 5) didn't have particularly good multi-language support:
A quick search found several approaches for C++/Java:
Once the decision to create a language library was made, the following aims/requirements were adopted:
The name chosen for the library was 'Fardel' - an archaic word meaning bundle or burden, from an Arabic word fard(a) meaning 'camel-load'.
Components in the system are:
The idea behind multilanguage resources from a programmer's point of view is to hide the language-specific details of resources; the programmer tells the computer: "Display the 'file-not-found' error message in the local language".
Fardel provides a hierachical system of Resource Names which allows resources to be re-used in a number of projects. Resource Names have the following pattern:
Some examples of Resource Names are:
The restrictions on the module.name patterns in Fardel resource-scripts are that they contain only printable unicode characters and use no ASCII punctutation characters apart from '-' (minus) and '_' (underscore). If you intend to generate code fragments to embed the resources within a program, the each pattern should be a valid, non-reserved identifier in the target programming language(s).
From a translator's point of view, the task is to take resources - traditionally strings, but possibly also icons/images/sounds - given in one or more source languages and to produce their equivalents in a new language.
Fardel borrows the notion of a locale - a combined language-code and optional region-code - to capture the concept of a particular language. Locales are used many programming languages and operating systems. Some examples of locales are:
Local Code | Locale Description | Some example resources for the locale |
---|---|---|
"" | No particular language or local | ProductName="FooBar" ProductVersion="1.42" ProductURL="www.foobar.com" |
"de" | German - no particular region | ProductName="FüBar" greeting="Bonjour!" biscuit="Keks" scone="Teegebäck" |
"en" | English - no particular region | greeting="Hello!" scone="Scone" biscuit="Biscuit" |
"en-US" | English - USA | greeting="Hi!" biscuit="Cookie" scone="Biscuit" |
"en-GB" | English - Great Britain | |
"en-AU" | English - Australia | greeting="G'day!" biscuit="Bikkie" |
Locales can be used as a convenient way of providing defaults, with more specific language setting overriding more general settings. Using this, the resource list above becomes the following for Australian English:
Resource Name | "" (universal) locale entry | "en" locale entry | "en-AU" locale entry | result for "en-AU" locale |
---|---|---|---|---|
ProductName | "FooBar" | "FooBar" | ||
ProductVersion | "1.42" | "1.42" | ||
ProductURL | "www.foobar.com" | "www.foobar.com" | ||
greeting | "Hello!" | "G'day!" | "G'day!" | |
biscuit | "Biscuit" | "Bikkie" | "Bikkie" | |
scone | "Scone" | "Scone" |
xyz
|
|
|