On 22 February 2012 08:28, Thomas Gries <m...@tgries.de> wrote:

> Am 21.02.2012 23:57, schrieb Roan Kattouw:
> >
> > I don't think so. Even non-existent Title object must have their
> > namespace set.
> >
> Yes, they have.
>
> I have found the problem. It is not the Linker per se and come with a
> modified question.
> It has to do with i18n and localisation of the (in this case) names for
> USER and USER_TALK Namespace.
>
> Basically:
> a link on a page like [[Benutzer:Alice]] is not necessarily the same as
> [[User:Alice]] (even when the latter exists).
>
> It depends on the current setting of
>
> $wgLanguageCode = "en" ;
> $wgLanguageCode = "de" ;
> (during testing my extension I played with this setting)
>
> whether [[Benutzer:Alice]] it is in the Namespace or not.
>
> So I was trapped by thinking that _any_ localised Namespace (like
> "Benutzer") is necessarily the same as USER or USER_TALK,
> which was incorrect.
>
> Question:
> =======
> Has anyone an idea, how to detect language-independently whether a link
> on page is in Namespace USER or USER_TALK, or in a localised version of
> these (when $wgLanguageCode has been modified)?
>
> The goal is to detect and to mark USER or USER_TALK page links
> language-independently in
> function wfWikiArticleFeedsAddSignatureMarker in E:WikiArticleFeeds line
> 262 .
>
>
> Tom
>

Well if this were an on-wiki template I would suggest you normalise the
namespace name to the localised canonical name using {{NAMESPACE:<page>}},
then compare it with a switch to the various similarly-normalised namespace
names: {{#switch: {{NAMESPACE:<page>}} | {{ns:2}} = <it's a user page> |
{{ns:3}} = <it's a user talk page> }}.  Programatically you'd be able to
cut out a lot of circularity in that process, just have a look at what code
is used in the NAMESPACE: parser function and see what you can reuse.

Or, and I can't quite tell which you want from your comment, are you
looking to detect when a link uses a prefix which is a User: namespace
alias in *any* language, even when that prefix is not in use on the wiki?
Why would you want to do that?

--HM
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to