[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: [transcript doubt] user's gender
From:       Chusslove Illich <caslav.ilic () gmx ! net>
Date:       2011-10-20 12:08:22
Message-ID: 201110201408.24716.caslav.ilic () gmx ! net
[Download RAW message or body]


> [: mvillarino :]
> How to guess the user's gender (male/female/other) in order to adapt gui
> texts grammatical gender ?

I see no basis upon which to guess the gender. That particular piece of data
about the user would have to be manually entered and stored somewhere.
Everything after that would be simple.

If you'd like to try it on the scripting side, for fun or test, you can set
the gender in Transcript user configuration, ~/.transcriptrc:

  [gl]  # section for language gl
  user-gender = m  # possible values: m/f

then add gl/scripts/kdelibs/kdelibs4/kdelibs4.js with this code:

  function selectByUserGender (phraseMas, phraseFem, phraseOther)
  {
      userGender = Ts.getConfString("user-gender");
      if (userGender == "m")
          return phraseMas;
      else if (userGender == "f")
          return phraseFem;
      else
          return phraseOther;
  }
  Ts.setcall("by-user-gender", selectByUserGender)

and in PO files you can use it as

  msgid ""
  "You won the game!"
  msgstr ""
  "Dobili ste partiju!"
  "|/|"
  "$[by-user-gender 'Dobio si' 'Dobila si' 'Dobili ste'] partiju!"

The location of kdelibs4.js given above is in the repository tree, and when
installed it would become
<kdeprefix>/share/locale/gl/LC_SCRIPTS/kdelibs4/kdelibs4.js, so that you can
test with existing KDE installation. The user-gender configuration key and
m/f values, and by-user-gender PO call name, in this example are arbitrary,
you can pick anything you like.

-- 
Chusslove Illich (Часлав Илић)

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic