Available languages

Getting translations

The methods are static so they can be called directly, without object instantiation.<br />
For convenience only, I'll be using variables to keep the Singleton instances:

$xmltrans=XT\XMLTrans::init();$xmlconfig=XT\XMLConfig::init();

Setting up the current language

$xmlconfig::set_current_lang('en');

Getting translations for different keys

$xmltrans::get_text('one');$xmltrans::get_text('note')

Note that all the operations are against the current selected language. If you need translation from
another language, you have to switch the language (see setting up the current language above).

Administration

Creating a new language file

This will create a new bg.xml file. Then, add more keys to it or check the syncronization chapter.

$xmltrans::create_lang_file('bg');

Adding a new key

The first step is option but ensures that you have selected the proper language to work on.

$xmlconfig::set_current_lang('en');$xmltrans::add_key('newkey','This is a new key');

Updating a key

Again, make sure you have selected the correct language.

$xmlconfig::set_current_lang('en');$xmltrans::update_key('newkey','This is the new value for key');

Deleting a key

$xmlconfig::set_current_lang('en');$xmltrans::delete_key('newkey');

Syncronize the language files

One of the coolest feature is this syncronization against a base file. Just make sure you have selected
your base language (in this case English):

$xmlconfig::set_current_lang('en');

And then, update the rest of the files: add to them the missing keys (from base file) and delete the
extra ones (not found in the en.xml). After this operation, all language files should contain the same
amount of keys (of course, you need to update the translation for the newly generated keys).