On Sat, Apr 19, 2014 at 8:27 PM, Gergo Tisza <[email protected]> wrote:
> Hi,
>
> when displaying messages containing usernames in Javascript code, one needs
> to pass the gender of the given user. This usually means sending a userinfo
> API query, possibly sending it to a different domain and forcing a DNS
> lookup (since the given user sometimes resides on another wiki, e.g. in the
> case of images transcluded from a repository such as Commons), which can be
> quite slow. The time and bandwidth spent on this is often wasted, since not
> all languages have the concept of gender; for such languages, the API
> request should be omitted.
>
> So,
> - how can I tell from Javascript code whether the current language supports
> genders? (I guess relying on that is not 100% failsafe, since even if it
> doesn't, a fallback language still might, but that sounds unlikely enough to
> ignore.)
> - how can I tell whether a given message depends on the gender? I suppose I
> could grep for '{{gender', or use mw.language to parse it with all genders
> and check if the output differs, but both of those are ugly and fragile. Is
> there a better option?
>
Do you need the gender of the current user, or of another user?

If you need the gender of the current user, all you need to do is
depend on mediawiki.user and mediawiki.jqueryMsg, then just pass
mw.user (the user object) as the parameter to {{GENDER:$1|...}}. If
you need the gender of a different user, I'm not sure that's even
available.

Roan

_______________________________________________
Mediawiki-i18n mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-i18n

Reply via email to