[Mediawiki-i18n] How do I find out on client-side whether the current language uses genders?

Gergo Tisza gtisza at wikimedia.org
Sun Apr 20 03:27:42 UTC 2014


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?

thanks
Gergő
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/mediawiki-i18n/attachments/20140419/6d8d4757/attachment.html>


More information about the Mediawiki-i18n mailing list