dtext 1.0.1

Tool for text internationalization inspired from GNU gettext.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Library 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.

Example:

import std.stdio, std.opt, dtext;

void main(string[] args) 
{
  string locale;
  getopt(args,
    "l|lang", &locale);

  defaultLocale = locale;
  writeln(_("Hello, world!")); \\ or use getdtext
}

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:

  • Load localization files on demand;
  • Add ability to unload unused locales;
  • Add ability to bind texts for arbitrary values (оbjects names, descriptions).
Authors:
NCrashed - Gushcha Anton
Dependencies:
none
Versions:
1.0.1 2013-Oct-12
1.0.0 2013-Oct-10
~master 2013-Oct-12
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 223 downloads total