Показать сообщение отдельно
Старый 30.11.2011, 10:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,488 / 846 (79) +++++++
Регистрация: 28.10.2006
doens.be: Change the language at runtime
Источник: http://www.doens.be/2011/11/change-t...ge-at-runtime/
==============

Normally when you change your language you go to your user options, change your current language and the restart the client. This week I got the question if it was possible to do so in runtime. You can do so by just calling the infolog.language(str 7 _languageCode). All labels that you load after calling this method will be translated to the new language.

X++:
static void JDO_ChangeLanguage(Args _args)
{
    info("@SYS1");
    infolog.language('nl-be'); // Change the language to nl-be
    info("@SYS1");
    infolog.language('fr-be'); // Change the language to fr-be
    info("@SYS1");
    infolog.language('it'); // Change the language to it
    info("@SYS1");
    infolog.language('de'); // Change the language to de
    info("@SYS1");
    infolog.language('en-us'); // Change the language to en-us
    info("@SYS1");
}
And the result is:



Caution: When you use this function make sure you get the current language before you use this function, so you can change it back when you don’t need it any more.



Источник: http://www.doens.be/2011/11/change-t...ge-at-runtime/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось Poleax; 30.11.2011 в 10:22.