Internetpräsenz Peter Lenhard
|
|||||||||||||||||||||||||||||||
Navigation: |
wxLocalisator: generated dialog to choose a locale in wxWidgetsfile locor_readme.htmContents:
What is wxLocalisator?It is a cpp-class for use with wxWidgets.It supports the internationalisation of your application. Internationalisation with the free and portable GUI Toolkit wxWidgets is quite easy because of the locale-concept and the great free tool poedit from Vaclav Slavik. But your application has to decide which locale to choose. If the system locale (default) is not the right one, this is done via an entry in the configuration of your program (not very user-friendly) or with a dialog to ask the user. The class wxLocalisator is such a dialog and it provides you additional features:
Some pictures of the three styles:
How do I use wxLocalisator?You have to add the filelocor.cpp to your sources,
as this class is not part of the wxWidgets distribution.
Include the file locor.h in your main application file,
like shown in the demo.By calling AskUser() the dialog will show up and you get a locale-ID
as return-value. The choosen locale will be stored in ./locale/locale.ini, which is
the default ini-file of wxLocalisator.Just set this ID in the global locale-object. If wxLocalisator can read a valid locale from its ini-file, the dialog will not be shown, unless you call AskUser(true).(The name of this method is not just ShowModal() because of its side effects.)
CustomisationThe methodAskUser() provides an additional parameter style
to choose from three styles:
ItemsShown() lets you choose from three
possible layouts:The corresponding flag for each language is shown or the name of the language or both (default). The second parameter decides whether the short descriptive text is shown (default) or not. If you choose the third style, the mode parameter of AskUser()
and and a former call of SetStyle() have obviously no effect.You can change the shown file by calling SetFileHtml().
If you choose the second style and you want the generated html-code to look more fancy, you have to edit the generating code in the method wxLocalisator::BuildHtml().By default no language is known by the dialog. Add a language by a call of AddLanguage().You can also read all languages specified in the ini-file by calling ReadFile(), which simply makes some calls of AddLanguage().Have a look at the demo i18ner.cpp, which shows the
different possibilities.What about the files
There is a light-weight-version of the class, named |
||||||||||||||||||||||||||||||