![]() |
Crossfire Server, Trunk
1.75.0
|
i18n's routines are located in the languages::c file.
To use i18n in the server code, instead of putting strings, use
i18n(who, "This is a translatable message.");
with who the player's object you wish to translate for.
The string can be anything you want, and will get replaced by the localised version. They must not contain a | character. If the string doesn't exist for the language, the code will be returned.
The recommanded strategy for translation is:
i18n callmessages.en file) version|, then use an arbitrary code, and do put it in the messages.en fileLanguage files are located in lib/i18n/messages.xx files, with xx the language's code, "en" or "fr" for instance.
They are installed as part of make install.
The format is straightforward:
# is a commentsentence code|localised versionsentence code, without any |, the localised version is the code\nLN, which contains the native language's nameWarning: currently the order of arguments is fixed, as defined by the print call (English version if you followed this guide) in the code.