Though a conceptually simple Visual C++ application
for counting time and generating an audio alarm, Timer has constituted
an interesting test bed for some specific user interface, localization
and architecture features that are significant in more complex internationalized
programs. Quite often, the requirement of internationalization prevents
from using ready-made functions provided by the development environment
and requires that they be specifically written. The English, French
and Italian versions of Timer are available for download.
The user can customize the alarm jingle by replacing the .wav sound
file.
|
Specific code has been written to develop a non-standard
user interface, featuring owner drawn buttons and a special progress
bar, not using standard Windows components provided by the Visual C++
development environment. The user interface also includes standard Help
and context Help.
|
Software localization
All the dialog window text strings, including static text, are not hard
coded into a resource description, but originate from a single string
table in the .rc file. Translation can be directly performed by translating
the string table, without searching for strings in the resource definition
statements. All the strings are UNICODE and the bimodal API text routines
have been used. The code generating error messages corresponding to
data input has been customized by rewriting the DDV_ e DDX_ functions,
so that the error dialog boxes, besides being localized, maintain the
colors and the graphics layout of the application. All strings are included
in the string table but for colored buttons bitmaps strings. Separate
colored key bitmaps exist for each language.
All the context Help strings of the main Timer window are generated
by the application itself using WinHelp API calls. The functions for
the Exit and ? buttons have been specifically written to prevent the
corresponding help strings be provided by the operating system. This
has been done to avoid, for example, displaying a help context string
in English when a Timer application localized in some other language
is executed on an English OS.
|
Software architecture
- statically/dynamically linked .exe/.dll
Timer is statically linked and its software has been internationalized
at resource level: the localized versions contain any specific resources
required. Static linking has been preferred in order to ensure portability
to different Windows platforms and installation simplicity.
A dynamically linked version of the application also exists, featuring
execution level internationalization: it consists of an executable and
of a dynamic link library that contains both English and Italian resources.
When this configuration is run the user interface is either English
or Italian in accordance with the language selected in the Control Panel
Regional Settings. Another dynamically linked version uses the same
executable with a different dynamic link library, which is smaller and
contains only the resources of the application in a single specific
language. Consequently the user interface is always in this specific
language. This architecture makes it possible to localize the application
into different languages by simply implementing new dynamic link libraries
containing the specific resources, with no modifications to the executable
required.
|