Locales
Part of TutorialAdvanced
Description
An example using version that shows how to use version to compile different executables for different languages.
Example
version(English) { const char[] salutation = "Hi"; const char[] negative = "No"; } version(Espanol) { const char[] salutation = "Hola"; const char[] negative = "No"; } version(Francais) { const char[] salutation = "Bonjour"; const char[] negative = "Non"; } version(Deutsch) { const char[] salutation = "Hallo"; const char[] negative = "Nein"; } int main() { printf("%.*s\n", salutation); return 0; }
Compiling Tips
Compile for the English locale:
dmd locales.d -version=English
Compile for the German locale:
dmd locales.d -version=Deutsch
More Information
For more examples that use version, see VersioningCategory.
Source
| Link | http://jcc_7.tripod.com/d/tutor/locales1.html |
| Author | jcc7 |
| Date | October 6, 2003 |
