Page MenuHomePhabricator

In tr, cannot lowercase I in title using {{DISPLAYTITLE:i}} because ->ucfirst(lcfirst('I')) is not I.
Closed, ResolvedPublic

Description

Author: ilhan

Description:
In the Turkish wiki if the address is "İPhone" then we can make the title "iPhone". but of course the address cannot be "İPhone".

Then if we change the address to IPhone then we cannot make the title "iPhone"

Also look for further information at
small letter (lowercase) at the Turkish wiki: http://tr.wikipedia.org/wiki/%C5%9Eablon:K%C3%BC%C3%A7%C3%BCk_harf

İ: http://en.wikipedia.org/wiki/Dotted_and_dotless_I


Version: unspecified
Severity: enhancement
URL: http://tr.wikipedia.org/wiki/IPhone

Details

Reference
bz28040

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:33 PM
bzimport set Reference to bz28040.
bzimport added a subscriber: Unknown Object (MLST).

On Wikipedia, the articles names are forced to an upper case first letter.

A workaround exist as you can see on the English wikipedia, the article at http://en.wikipedia.org/wiki/IPhone shows with a dot-less lower case i. This is made possible by using the template {{Lower case title}} available at http://en.wikipedia.org/wiki/Template:Lowercase_title

Template content as of today is:

<span>{{DISPLAYTITLE:{{#if:{{NAMESPACE}}|{{NAMESPACE}}:|}}{{lcfirst:{{PAGENAME}}}}}}</span>

You might want to use a similar template on the Turkish wiki.

ilhan wrote:

There is one http://tr.wikipedia.org/wiki/%C5%9Eablon:K%C3%BC%C3%A7%C3%BCk_harf
it works for İPhone (makes it iPhone) but it doesn't work for IPhone (shows up again as IPhone), even if it works it will show it as ıPhone.

Updating summary to hopefully capture the issue better.

Basically, in turkish the page [[i]] = [[İ]], where the page [[ı]] -= [[I]]. Thus doing {{DISPLAYTITLE:{{lcfirst:{{PAGENAME}}}}}} won't work, since the target of {{lcfirst:IPhone}} (which is iPhone) does not have the same canonical name as IPhone (So the displaytitle restrictions come into affect).

I'm not sure if this is an issue that should be fixed as in Turkish, the lowercase of I is generally not i (from what I read on 'pedia), except for in circumstances such as iPhone where a foreign word is involved. It might make sense however to just put $wgRestrictDisplayTitle = false; for tr. (It can't be that bad, any wiki using language converter can already get around the display title restrictions)

As an aside, the Turkish language file is kind of interesting. Only the ucfirst is overridden to make i -> İ. uc (in general without the first) puts i -> I, and the lowercase functions all just inherit the standard lc, which puts I -> i. That is perhaps something that should be changed, but I don't know enough about the language to know if that's actually as wrong as I think it is. (and its somewhat beside the point for the issue reported above).

The Turkish wikipedia got renamed to İPhone thus rendering as iPhone with the template above.

http://tr.wikipedia.org/wiki/%C4%B0Phone

I have send a patch for the lcfirst case as well as unit tests ih r83970

Keeping the bug open waiting for code review and user feedback (translatewiki comes to mind).

I have forgotten about full strings case change. r84057 deals with it.

(In reply to comment #7)

Any news?

The fix is in the unstable version of MediaWiki. It will be fixed on the site next general update (when its updated to 1.18). I have no idea when that will be. Perhaps in a month or two.

The code review Ashar talked about in comment 5 hasn't happened yet, but I don't think there will be any issues with that.

Patches pending review are:

r83970
r84057
r84080

They are tagged with keyword 'patchset-turkish' (which will get removed one day).
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/tag/patchset-turkish

Patches got reviewed and will be included in MediaWiki 1.18.

It will be deployed on WikiMedia live site whenever 1.18 is deployed there :)

This fix triggers breakages with case-insensitive magic word matching for keywords containing "i", such as the {{ucfirst:}} and {{lcfirst:}} parser functions: bug 31490

Has been reverted in r99289 / r99290.

r83970 is still in place as it doesn't appear to break anything so far.

ilhan wrote:

Uhmm, so what I have to do now in order to make http://tr.wikipedia.org/wiki/IPhone_4 's title "iPhone 4". Now it seems "ıPhone 4".

ilhan wrote:

Since MediaWiki is out, I have a question regarding the usage of the patch. Consider this page http://tr.wikipedia.org/wiki/IPhone It has a template called {{Küçük harf}} which lowers the title to ıPhone. {{Küçük harf}} has lcfirst see http://tr.wikipedia.org/w/index.php?title=%C5%9Eablon:K%C3%BC%C3%A7%C3%BCk_harf&action=edit Instead of lcfirst what should be used in order to achieve the title iPhone?

(In reply to comment #16)

Since MediaWiki is out, I have a question regarding the usage of the patch.
Consider this page http://tr.wikipedia.org/wiki/IPhone It has a template called
{{Küçük harf}} which lowers the title to ıPhone. {{Küçük harf}} has lcfirst see
http://tr.wikipedia.org/w/index.php?title=%C5%9Eablon:K%C3%BC%C3%A7%C3%BCk_harf&action=edit
Instead of lcfirst what should be used in order to achieve the title iPhone?

You essentially can't at the moment without resorting to js hacks or requesting that $wgRestrictDisplayTitle be set to false. (Since currently [[tr:iPhone]] and [[tr:IPhone]] refer to different articles, and displaytitle only works if the display title would refer to the exact same page as the original title)

The fix mentioned several comments above was so that {{lcfirst:I}} -> ı, so that lcfirst would correspond to the "exact" same article, so it could be used with displaytitle.

The turkish language lcfirst() and ucfirst() methods have been fixed by 83970. That makes the parser functions {{lcfirst}} and {{ucfirs}} to behave correctly on turkish wikis.

That makes the template 'Küçük harf' referenced above behave correctly.

Source code:
{{DISPLAYTITLE:{{lcfirst:{{PAGENAME}}}}}} does work on a Turkish wiki now.

See http://tr.wikipedia.org/w/index.php?title=Şablon:Küçük_harf&action=edit

On the Turkish Wikipedia, the article is named İPhone (upper case dotted i), the above template does make it to render iPhone (lower case dotted i).

The IPhone (dot less i) is redirected to İPhone (upper case dotted i). Once redirect is done, DISPLAYTITLE correctly change the article title to iPhone (lower case dotted i).

So this bug is thus resolved.

ilhan wrote:

Hmm, okay. But https://tr.wikipedia.org/wiki/IPhone_4 lowercase of I in English is not ı.