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ő