Let’s suppose that we enabled the localization (on the fly edition) and translated a few languages. How can we see our application translated on the fly? First, open your application project file and add the Localizer initialization code:
begin LocalizerOnFly.InitReg; Application.Initialize; Application.CreateForm(TForm1, Form1);
Ensure that “LocOnFly” unit is listed in “uses” clause and that {$R YourProjectName.KLR} directive is added. If you didn’t turn off the “Add Localizer API” option in the “Project Settings” dialog, this code should be added automatically. Then, you need to put main menu on the form and add some top-level item, say miLang with name “Language”. Create the form FormCreate event handler. Add the following code:
LocalizerOnFly.PopulateMenu(miLang, 1);
Add “LocOnFly” unit to the “uses” clause. That’s all. Now you may compile and run application. The “Language” menu will contain the list of all available languages. Select the language from this menu and application will change its language on the fly. Next time you start the application it will be translated to the language it was closed with.