Re: [crossfire] Localisation

2021-09-17 Thread Mark Wedel

On 9/17/21 10:28 AM, Nicolas Weeger wrote:

Hello.


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


 so the reason that I added the name_pl many years ago is that in English, 
there were various 'one off' cases that were not easy to handle.

 Before, logic was basically:
 - Most plurals just need an s added (sword -> swords)
 - If it ends in y, tends to need to be replaced by ies (ruby -> rubies).  I 
think there might have been a flag to handle that.

 But there are other words where this logic is not sufficient (die -> dice is 
one that comes to mind - I think there were some others which followed yet 
different rules).  So in the end, it became simpler on the code side just to have 
a different field with the plural name, instead of the code itself having to do a 
bunch of stuff to make a proper plural.

 I think the other cases where things became complicated are more complex names, 1 
foo of bar -> 2 foos of bar, which became yet another case (and now once again, 
rules for the first name have to be covered - ruby of greatness -> rubies of 
greatness.

 I'm not quite sure what using the library, and adding to add in gender field 
and special fields, etc, is a simpler solution - it in fact looks more 
complicated - from a person making arches (who may not be much a programmer), 
having {en,fr,de,...}_{name,name_pl} seems simpler.  It becomes 'Oh, I know the 
proper German plural for this name, so I just need to add a de_name_pl with it 
to the arch and are done, and do not need to thing about gender field, special 
fields, etc.
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire
IRC: http://crossfire.real-time.com/irc/index.html
Discord: http://crossfire.real-time.com/discord/index.html
Project Site: https://sourceforge.net/projects/crossfire/
Wiki: http://wiki.cross-fire.org/
Website: http://crossfire.real-time.com


[crossfire] Localisation

2021-09-17 Thread Nicolas Weeger
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

signature.asc
Description: This is a digitally signed message part.
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire
IRC: http://crossfire.real-time.com/irc/index.html
Discord: http://crossfire.real-time.com/discord/index.html
Project Site: https://sourceforge.net/projects/crossfire/
Wiki: http://wiki.cross-fire.org/
Website: http://crossfire.real-time.com