Welcome, Guest
Username: Password: Remember me

TOPIC: Parameters depending on other parameters?

Parameters depending on other parameters? 1 year 2 months ago #1750

  • BenHymers
  • BenHymers's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Apologies for the obscure title; the character limit is very short!

Before I buy I2 Localization, I'd like to know if the following are supported, and how easily they can be done:

If I have a string of the form "there are 10 players", where '10' is a number provided at runtime, are the translations able to perform logic based on the number? E.g. changing between 'is' and 'are', and 'player' and 'players' in English, and other more complex logic in other languages that have special rules for 0, 10+ and so on? Perhaps a syntax with some scripting, like "there <num==1,is><num!=1,are> <num> player<num!=1,s>", or perhaps something higher-level than that to avoid repetition.

Similarly, am I able to do things like supply a gender as a parameter and make this available to translations?

Lastly (maybe this is asking a bit much), if I wanted to insert the name of some object into a string, but that object can have a different gender in different languages, how could that be done? For example, if I want a string that said "The player has just picked up a <object>" , and a list of objects ("sword", "shield"), and the sentence needs to change in some languages based on the gender of the object. Ignore the a/an in that sentence for now - if the answers to these questions are good, that shouldn't be a problem too!

Thanks!
The administrator has disabled public write access.

Parameters depending on other parameters? 1 year 2 months ago #1754

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 915
  • Thank you received: 196
  • Karma: 58
Hi,
The plugin already supports parameters:

"You got {[POINTS]] points" automatically replaces {[POINTS]} by the number of points that variable represents. The variables could be Local or Global parameters.



Plurals.

The current version doesn't support plurals yet. This is the next feature I'm working on.
I already added support for specifying what text variant should be displayed for the different Plural categories.
You can see this in the image next to the Touch/Normal tabs.



By clicking in the tabs (Zero, One, Few, Many, etc) you can define the different texts for each case:
e.g.
ZERO : "You have no points"
ONE : "You have 1 point"
others: "You have {[POINTS]} points"

When parameters are applied, they select the correct variant and replace the tag with the correct number.
However, I'm currently working on this and hasn't been released yet.


Gender.

This is a trickier one and depends on too many rules to have right.
So, given that the game knows the context of the text its up to the game to do this modification.
To handle this, the plugin allows Callbacks, which are called after the translation is ready. This allows modifying anything in the text before it gets set in the Label.

Hope that helps,
Frank
Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Last Edit: 1 year 2 months ago by Frank.
The administrator has disabled public write access.

Parameters depending on other parameters? 1 year 2 months ago #1756

  • BenHymers
  • BenHymers's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Hi Frank, thanks for the reply!

It's great that plurals are being worked on! I'm not sure that zero/one/two/few/many/other is the correct split though; some language rules are more complex even than this. See for example section 11.2.6 of the GNU gettext manual (www.gnu.org/software/gettext/manual/gettext.html) - Polish apparently has different forms for numbers ending 2 through 4 and 5 through 1, and there are many other languages with weird rules.

Just a thought :)

Genders are also complex, yes :) When you say handle it myself, do you mean by e.g. combining the gender with the string ID, e.g. "POINTS_MALE"? If so that's not too much of a burden, though it does mean there will be duplicate strings for languages that don't use the gender.

For the dynamic objects I'll also have to have alongside the translations, for each language, a table of which objects have which language - is there any facility for that? I suppose I could keep them as 'translations', e.g. "SWORD" translates as "male" which I then parse as a gender to then pick a string "ITEM_ACQUIRED_MALE". That just feels a bit messy and inefficient!

One more thing I've just remembered to ask; does the plugin localize number formats, e.g. will "1.23" be turned into "1,23" (with a comma) in French etc.?
The administrator has disabled public write access.

Parameters depending on other parameters? 2 months 2 weeks ago #2461

  • BenHymers
  • BenHymers's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Hi, did you get round to implementing plurals in the end?
The administrator has disabled public write access.

Parameters depending on other parameters? 1 month 2 weeks ago #2533

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 915
  • Thank you received: 196
  • Karma: 58
Hi,
Sorry for the delay in adding this feature!
I have tried several approaches for plurals, and finally finished one that its quite simple, yet allows for all grammar rules. Its amazing how many variations of plurals are used! Not every language is as simple as English (with just plural & singular), there are languages with up to 6 plural forms!



Documention: I2 Localization Plurals

I just uploaded v2.8.1a3 to the beta folder with the new implementation.

Hope that helps,
Frank
Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Last Edit: 1 month 2 weeks ago by Frank.
The administrator has disabled public write access.

Parameters depending on other parameters? 1 month 2 weeks ago #2534

  • BenHymers
  • BenHymers's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Hi Frank,

This is excellent! Thank you very much!!

I was beginning to worry that I2 wouldn't be good enough, as I'd also done research into pluralisation etc (Polish has some nutty rules too!) - this fills me with hope again :)
The administrator has disabled public write access.
Time to create page: 0.205 seconds
Colors