[crossfire] Localisation

Nicolas Weeger nicolas.weeger at laposte.net
Fri Sep 17 12:28:10 CDT 2021


Hello.


I'd like to overhaul the translation / localisation system. So searching good 
ideas & suggestions & comments :)


My goal is to be able to handle:
- singular / plural / variants (some languages have more forms apparently)

- genders

- other special cases. For instance in English "the bow" and "the bows", but 
in French "l'arc" and "les arcs"


Here's what I thought of so far.


For archetypes and objects, add a language specifier for "name", "message", 
other language-dependant fields.

Remove the "name_pl" field, merge it into "name".

Add a common "gender" field, and a "special" field per language. "special" will 
have a meaning varying between languages, so for French it'd indicate the name 
can be used with "l'" at singular form but "les" in plural form, and other 
variants (proper name in English, for instance, which shouldn't have a "the" 
in front of it).


The "name" will contain everything needed to write the correct form based on 
the number of items.

The same principle will apply to quest messages, messages in maps, and such.

For server-side messages, same principle, messages will contain all 
information needed to properly display things.



I'm considering using the ICU4C library, https://github.com/unicode-org/icu 
but of course other options would be fine :)

Using that library, a name could be for instance (I think it's correct, but 
didn't actually test)

en: {0,choice,=1#bow|1<#bows}
fr: {0,choice,=1#arc|1<#arcs}

Ok, it isn't too user-friendly, but we'd manage - "constant" messages would be 
easier of course :p


For the server-side messages, I currently only have thought of a slightly 
"heavy" way to format messages, given that the C API of ICU isn't too user-
friendly.

Thinking of something like (pseudo-code):

esrv_send_message(message_add_object(message_create("{0} entered the game"}), 
pl))

with the "message" functions handling the interface with ICU.

(in C++ or Java it'd be chained builders, same principle here)



Thanks for reading this long mail ;)

Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.metalforge.org/pipermail/crossfire/attachments/20210917/30ffbc47/attachment.sig>


More information about the crossfire mailing list