Ludeon Forums

Ludeon Forums

  • June 27, 2019, 04:50:36 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: More minor 1.0 changes + info about LanguageWorkers  (Read 1228 times)

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2138
    • View Profile
More minor 1.0 changes + info about LanguageWorkers
« on: July 18, 2018, 08:05:34 PM »

Just so you know, since it causes problems in other languages, we've added 2 new keyed translations: MaleAnimal and FemaleAnimal which are "male" and "female" labels used when the pawn is an animal.

And while we're at it, I'd like to remind you that it's possible to define a custom LanguageWorker for a language. This is simply a piece of C# code which handles complex language specific string conversions. Currently only English, Russian, and Korean use it.

The available methods are:
WithIndefiniteArticle(): e.g. "an elephant"
WithDefiniteArticle(): e.g. "the elephant"
OrdinalNumber(): e.g. 1st 7th 15th
PostProcessed(): returns post-processed text generated by RulePacks
ToTitleCase(): converts "some text" to "Some Text"
Pluralize(): returns the plural form of the given word
PostProcessedBackstoryDescription(): returns post-processed backstory description
PostProcessedKeyedTranslation(): returns post-processed keyed translation (i.e. any non-def-injected translation)

You can override any of these methods. You can also suggest adding more if needed.

How to contribute
New keyed translations format
RimWorld 1.0 Translation Improvements
New translation cleaner tool
Request: Help check the language workers for accuracy
« Last Edit: December 06, 2018, 08:28:11 AM by ison »
Logged

pluhi

  • Muffalo
  • *
  • Posts: 19
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #1 on: July 19, 2018, 02:01:34 AM »

Hi!
I don't have MaleAnimal or FemaleAnimal keyed and translation report does not have them as missing. Is this modification pushed already? /// Update 1969 has them, great addition!
Also this LanguageWorker stuff would be very useful for Hungarian, but I'm totally lost. What to do with these?
I can see the russian has a <languageWorkerClass>LanguageWorker_Russian</languageWorkerClass> reference but that's it. Can you help? Thanks!
« Last Edit: July 19, 2018, 05:18:45 AM by pluhi »
Logged

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2138
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #2 on: July 19, 2018, 03:23:52 PM »

It's just a custom class we'd need to add to our code. For example, English uses PostProcessed() to change "a" articles to "an" where appropriate. Such post processing isn't a very elegant solution though.
Logged

pluhi

  • Muffalo
  • *
  • Posts: 19
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #3 on: July 20, 2018, 12:44:03 AM »

Well that sounds great, Hungarian has the same problem with definite articles. We have "a" and "az". Now I have to use "a(z)" everywhere or avoid. I hate it. Can you send a template so I can see what can be implemented? Or is there way to check the already existing russian version? Thnaks!
Logged

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2138
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #4 on: July 20, 2018, 10:07:20 AM »

Ok, we can solve the problem with articles in Hungarian. I've looked up the a/az usage rules and they seem simple to implement, so I think I can handle it.

The WithIndefiniteArticle() / WithDefiniteArticle() methods are simple methods which accept a string and return a processed string.
Logged

Elevator

  • Drifter
  • **
  • Posts: 67
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #5 on: July 20, 2018, 10:20:50 AM »

How shall translators modify the source code of this class? This file is not a part of Github localization repositories.
Logged

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2138
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #6 on: July 20, 2018, 11:58:15 AM »

The only way is to send them to us so we can integrate them.

Alternatively, perhaps we could allow translators to use regular expressions. Though I'm concerned about performance of this approach.
Logged

pluhi

  • Muffalo
  • *
  • Posts: 19
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #7 on: July 20, 2018, 03:25:12 PM »

Ok, we can solve the problem with articles in Hungarian. I've looked up the a/az usage rules and they seem simple to implement, so I think I can handle it.

The WithIndefiniteArticle() / WithDefiniteArticle() methods are simple methods which accept a string and return a processed string.

Cool, thank you very much! It's the same rule English has for "a" and "an" so modifying that rule would be sufficient. I guess after that we use "a" everywhere and in case the pulled variable starts with a vowel, postprocessing replaces it with "az". Right?
Another thing, not sure it's postprocess related. I realized if I start the sentence with a variable, the first letter does not get capitalized.
Logged

b606

  • Drifter
  • **
  • Posts: 25
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #8 on: July 21, 2018, 09:10:04 AM »

Dear Ison,

It is very interesting. Can you please give more detail about how to implement this for French language. I suppose that this may be not too complicated: My first concerns are
WithIndefiniteArticle() / WithDefiniteArticle() / Pluralize() that should be dependent on whether the subsequent word is Male or Female (not the subject in the sentence)
Logged

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2138
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #9 on: July 21, 2018, 09:36:08 AM »

For languages like French where the article depends on the subject's gender we're going to implement a new system to figure out the gender of the given subject. It's easy for pawns, but e.g. determining the gender of a sword, chair, table, etc. is impossible without some kind of a special lookup table. Though now that I think of it, I'm not sure how often we even want to add an article to a non-pawn thing. I think RulePackDefs sometimes have to do this, and some keyed translations like "A battery has broken down.", so I think adding such system is necessary.

This gender will be passed to the WithDefiniteArticle() and WithIndefiniteArticle() methods.
Logged

b606

  • Drifter
  • **
  • Posts: 25
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #10 on: July 21, 2018, 09:50:50 AM »

Great news, thank you !
The other next problem is the pronoun le/la/les (not definite articles) such as in "je la veux/je le veux" (I want it) which is different of lui/elle (him/her).  I was at some point thinking about hacking the grammar.xml to use much less usefull key instead (ex NAME_possessive son/sa -> le/la)...
Logged

morticinus

  • Muffalo
  • *
  • Posts: 8
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #11 on: July 22, 2018, 03:45:33 AM »

Hi,
is it possible to add more customisable words for grammar.xml file like:
Quote
[PAWN_possessive]   ->   its/his/her
[PAWN_pronoun]   ->   it/him/her
[PAWN_objective]   ->   he/she/it

For example:
Quote
[PAWN_customword]   ->   x/y/z

I want in Czech for example:
Quote
George was   ->   George byl   ->   [PAWN_nameDef] byl[PAWN_customword]
Kate was   ->   Kate byla   ->   [PAWN_nameDef] byl[PAWN_customword]

I think a similar problem is in other languages like Russian, Polish, Slovak, etc.

Thanks
Logged

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2138
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #12 on: July 22, 2018, 08:42:56 AM »

The other next problem is the pronoun le/la/les (not definite articles) such as in "je la veux/je le veux" (I want it) which is different of lui/elle (him/her).

Is it different than NAME_pronoun? Does la/le depend on whether "I" is female or whether "it" is female?

Hi,
is it possible to add more customisable words for grammar.xml file like:

This will most likely be addressed, though I'm not sure if adding more customisable words would be the best approach here. Some languages have many pronouns, so remembering all their names could be difficult. Perhaps something like this would be good:

[PAWN_nameDef] [PAWN_gender ? był : była]

Or, if the language has 3 genders (male, female, neuter) then:

[PAWN_nameDef] [PAWN_gender ? był : była : było]
Logged

morticinus

  • Muffalo
  • *
  • Posts: 8
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #13 on: July 22, 2018, 12:40:52 PM »

I'm not sure if adding more customisable words would be the best approach here. Some languages have many pronouns, so remembering all their names could be difficult.


Yes it's true, but what I need is not pronouns but endings of words.


Perhaps something like this would be good:

[PAWN_nameDef] [PAWN_gender ? był : była]

Or, if the language has 3 genders (male, female, neuter) then:

[PAWN_nameDef] [PAWN_gender ? był : była : było]


I need only two variants for Czech (for examples):

Quote
[PAWN_gender1]  =   -/-a/-o    (for example - word "was": byl/byla/bylo    or word "could" "mohl/mohla/mohlo"   etc)
[PAWN_gender2]  =  -ý/-á/-é   (for example - word "hungry": hladový/hladová/hladové   etc)
[PAWN_genderx]  =  male/female/neuter


Example for female:

Quote
[PAWN_nameDef] was hungry.  =  Kate was hungry.
[PAWN_nameDef] byl[PAWN_gender1] hladov[PAWN_gender2]. = Kate byla hladová.

Thanks
Logged

robno

  • Drifter
  • **
  • Posts: 38
  • Refugee
    • View Profile
Re: More minor 1.0 changes + info about LanguageWorkers
« Reply #14 on: July 25, 2018, 07:50:18 PM »

The other next problem is the pronoun le/la/les (not definite articles) such as in "je la veux/je le veux" (I want it) which is different of lui/elle (him/her).

Is it different than NAME_pronoun? Does la/le depend on whether "I" is female or whether "it" is female?

Hi,
is it possible to add more customisable words for grammar.xml file like:

This will most likely be addressed, though I'm not sure if adding more customisable words would be the best approach here. Some languages have many pronouns, so remembering all their names could be difficult. Perhaps something like this would be good:

[PAWN_nameDef] [PAWN_gender ? był : była]

Or, if the language has 3 genders (male, female, neuter) then:

[PAWN_nameDef] [PAWN_gender ? był : była : było]
Not french native, but pretty sure it depends on whether 'it' is masculine or feminine.

For example: 'Je le veux' means 'I want him' or 'I want it', if 'it' is masculine. 'Je la veux' means 'I want her' or 'I want it', if 'it' is feminine.

Hope it helps.
Logged
Pages: [1] 2