Short name for getdtext
Setups current locale name. If empty string is passed to getdtext then default locale will be taken. *
Returns current locale name. If empty string is passed to getdtext then default locale will be taken.
Returns translated string s for specified locale. If locale is empty default locale will be taken. If locale name is equal to base locale s string is returned without modification. * Localization strings are taken from special files previosly loaded into memory. * If string s isn't persists in locale strings it will be put into fuzzy text map. Fuzzy strings is saved in separate file for each locale to be translated later. *
Manuall loads localization file with name. May be usefull to load localization during program execution. *
Special locale that doesn't have own locale file. System won't create additional information (fuzzy file or locale map).
File extention which will be searched in current directory to load locale information.
1 import std.stdio, std.opt, dtext; 2 * 3 void main(string[] args) 4 { 5 string locale; 6 getopt(args, 7 "l|lang", &locale); 8 * 9 defaultLocale = locale; 10 * 11 writeln(_("Hello, world!")); \\ or use getdtext instead _ 12 }
* If text for translation cannot be found in specified locale name, the text will be saved and written down to a special fuzzy texts file at program shutdown. That should help to add new localization fast and without program recompilation. * TODO: <ul> <li>Load localization files on demand;</li> <li>Add ability to unload unused locales.</li> </ul>
Module provides functions to handle localization. Translated string is searched in special files with .lang extention by exact matching with original string. * Lang files are loaded in memory at program start up from current directory. Additional localizations can be loaded with loadLocaleFile function. *