Wiktionary:Grease pit/Problems displaying IPA + Classes for support of Unicode ranges

Definition from Wiktionary, the free dictionary
Jump to: navigation, search

Problems displaying IPA in edit & special chars boxes[edit]

These items broken out of the thread on UK/US spellings, for convenience:

I should like to know how to display all the IPA characters everywhere -- the notes in Help don't work for me -- I can see the characters in the finished product, but not in the Special Characters box or Edit box on edit pages). Can anyone help?

[1]. I've never had any problems. —Vildricianus 15:54, 31 May 2006 (UTC)
I had assumed that it was a problem with the fixed width font used in my edit box (Courier New). However, I have just realised that the Special Characters box seems to have the ordinary PS font, and I can't see them there either (in fact there are only nine I can see (øəœæŋβθðχ and ħ). Any ideas (other than using Firefox)? In the main areas I can see all the IPA characters on Wiktionary:English pronunciation key, though there are a few near the bottom of Wiktionary:International Phonetic Alphabet which I can't see. --Enginear 07:07, 6 June 2006 (UTC)
It would be easier if you started a new topic on this. It would also help if you specified your browser and OS. — Vildricianus 10:06, 6 June 2006 (UTC)
Done. I am using IE 6.0.2900.2180 with service packs 1 & 2, under Windows XP Home Edition version 5.1.2600 with SP1 & SP2. --Enginear 23:08, 6 June 2006 (UTC)
  • Many months ago while I was crafting or extending the special characters box, I put a lot of work into finding a way to use the {{IPAchar}} template - it required tricky stuff that I believe Connel or somebody helped me with. But months later I noticed somebody took that all out and I never knew why. Now on most of the computers I use I see just boxes for almost all of the IPA characters even though in the articles where IPA or IPAchar is used they work fine. Somebody needs to hunt through the history and find what I did and who and why it was removed. It may have been removed before this magic was even in Mediawiki:Edittools — Hippietrail 23:49, 6 June 2006 (UTC)
  • I just rolled back the apparent vandalism to {{IPA}} of January 19th, that got lost in the shuffle of (Karmosin's and Peter Isotolo's opinions) vs. (Wiktionary) pissing contest. It should be working now. --Connel MacKenzie T C 05:26, 7 June 2006 (UTC)
  • But adding that to both {{IPA}} and {{IPAchar}} did not seem to fix it for IE. --Connel MacKenzie T C 05:32, 7 June 2006 (UTC)
Neither {{IPA}} nor {{IPAchar}} would affect this, for neither is called from Mediawiki:Edittools. I tried editing a copy of Mediawiki:Edittools in the sandbox and I found I could get the IPA character to display if I delete "font-family /**/:inherit;" from the IPA span tags. (This of course is undesirable, because it applies {{IPA fonts}} to all browsers not just IE6. But it show that the problem is the sensitive nature of the style parameters in Mediawiki:Edittools.)
A clean solution is described in the next section: Define font-family with appropriate fonts into class="IPA"; specify class="IPA" in Mediawiki:Edittools (it turns out it is already there); and delete the style="font-family...;" from Mediawiki:Edittools.
Wikipedia has the same problem with IPA display in Mediawiki:Edittools. I was able to fix it (with a copy in the sandbox) by applying class="IPA" to a span containing the IPA characters. --teb728 06:58, 7 June 2006 (UTC)
Say what? What sandbox was that? The inherit thing is only for the IPA characters in IE. IE is the only one that isn't displaying them correctly, to begin with! --Connel MacKenzie T C 14:05, 7 June 2006 (UTC)
I refered to two sandboxes: I did my experiment with Wiktionary:Mediawiki:Edittools at Wiktionary:Sandbox, and I did my experiment with Wikipedia:Mediawiki:Edittools at w:Wikipedia:Sandbox. (Last night I created a semi-permanent copy of the latter experiment in a personal sandbox.)
I believe you are wrong about the "inherit thing." The way it is supposed to work is exploit a known bug in IE: First it tells all browsers to use the font list; then the inherit thing tells browsers to override the font list and inherit the font(s) from the surrounding scope. But due to a bug in IE the inherit thing is ignored by IE; so IE (and only IE) is left with the font list. What my first experiment shows is that for some reason (presumably related to the complicated HTML in Wiktionary:Mediawiki:Edittools) IE does not ignore the inherit thing there. My second experiment shows that much simpler HTML works as intended. See w:Template talk:IPA#Technical details. --teb728 04:29, 8 June 2006 (UTC)
Oh, OK. I think I see now. Hippietrail, did you follow this too? Shall we flip a coin then, to decide which of us should put TEB's changes in place? --Connel MacKenzie T C 05:09, 9 June 2006 (UTC)

Mediawiki software change[edit]

I just discovered what happened: On about 2005-10-02 the Mediawiki software was changed to no longer allow comments in inline style sheets (because they can be used for cross-site scripting attacks). See Wikimedia bug no. 3588. As a result of this change "font-family /**/:inherit;" affects IE6 the same as other browsers (except in css). There are 3 possible responses:

  • Leave IPA display broken for IE6. (IMO unacceptable)
  • Remove "font-family /**/:inherit;" several places from Mediawiki:Edittools. This will have the side effect of applying the font list to all browsers, not just IE6. (IMO marginally acceptable)
  • Move the font-family specifications (including "font-family /**/:inherit;") to CSS (to which the Mediawiki change does not apply). This is the response chosen by Wikipedia. See the section "Font declaration has been moved to Common.css" at w:Template_talk:IPA.

--teb728 18:08, 8 June 2006 (UTC)

Classes for support of Unicode ranges[edit]

I would like to propose that we borrow an idea from Wikipedia. There they define classes in Mediawiki:Common.css specifying fonts giving optimal support for various Unicode ranges:

/* Support for Template:IPA, Template:Unicode and Template:Polytonic. The inherit declaration resets the font for all browsers except MSIE6.  The empty comment must remain. Please copy any changes to [[Template:IPA fonts]] and [[Template:Unicode fonts]]. */
.IPA {
        font-family: Chrysanthi Unicode, Doulos SIL, Gentium, GentiumAlt, Code2000, TITUS Cyberbit Basic, DejaVu Sans, Bitstream Vera Sans, Bitstream Cyberbit, Arial Unicode MS, Lucida Sans Unicode, Hiragino Kaku Gothic Pro, Matrix Unicode;
        font-family /**/:inherit;
}
.Unicode {
        font-family: TITUS Cyberbit Basic, Code2000, Doulos SIL, Chrysanthi Unicode, Bitstream Cyberbit, Bitstream CyberBase, Bitstream Vera, Thryomanes, Gentium, GentiumAlt, Visual Geez Unicode, Lucida Grande, Arial Unicode MS, Microsoft Sans Serif, Lucida Sans Unicode;
        font-family /**/:inherit;
}
.latinx {
        font-family: TITUS Cyberbit Basic, Code2000, Microsoft Sans Serif;
        font-family /**/:inherit;
}
.polytonic {
        font-family: Athena, Gentium, Palatino Linotype, Arial Unicode MS, Lucida Sans Unicode, Lucida Grande, Code2000; 
        font-family /**/:inherit;
}
.mufi {
        font-family: Alphabetum, Cardo, LeedsUni, Junicode, TITUS Cyberbit Basic, ALPHA-Demo;
}

Having done that the various templates IPA (equivalent to IPAchar here), Unicode, latinx, and polytonic specify only the class; they no longer specify the font-family, saving a transclusion.

If we do that, we could also modify Mediawiki:Edittools to specify appropriate classes for various ranges. For example on my browser (IE6) most IPA characters display as boxes, as do various Latin extended characters, including Old English ǢǣǷƿȲȳȜȝ.

Unsigned comment by USer:TEB728

While I agree that that is an interesting approach, I detest putting things into the site-wide Javascript and CSS files that are not needed on every page. (I've done it, but I'm not happy about it.)

The template approach is highly superior, in that it is not overwhelming every single page on en.wiktionary, but instead, only the pages that need it. --Connel MacKenzie T C 05:10, 7 June 2006 (UTC)

I would say just the opposite is the case: With the css approach the class definitions do not cause the file to be downloaded more often than otherwise. (And I suspect it is cached anyway.) With the template approach {{IPA fonts}} and/or {{Unicode fonts}} and/or {{Latinx fonts}} may be transcluded several times per page.
I didn't realize when I created this section that the previous section described a problem to which my section provided a solution. If you use IE6, compare w:Mediawiki:Edittools with w:User:TEB728/My Edittools. --teb728 07:25, 7 June 2006 (UTC)
I don't see any difference, but that's probably because I haven't updated my IE6 for a while. I'm wondering, though, is IE7 going to improve on that? — Vildricianus 17:33, 8 June 2006 (UTC)
Not sure how the CSS works here, but caching is the argument that makes the most sense to me. The CSS files aren't dynamic links, are they? Davilla 17:19, 8 June 2006 (UTC)
I spotted a fallacy in your comment, Connel: every page is supposed to have IPA somewhere in the future :-). — Vildricianus 09:12, 7 June 2006 (UTC)
Every Talk: page? Every Image: page? Every Wikisaurus: page? Every Transwiki: page? etc. No. Not even Main Page. --Connel MacKenzie T C 13:59, 7 June 2006 (UTC)
Including that crap on every single page (try "View HTML source") is a Bad Thing. --Connel MacKenzie T C 13:59, 7 June 2006 (UTC)
Right. Non-main namespace pages are not the "pages" I was talking about. They're only there to support the real "pages". And tell me what's wrong with the page sources. The only argument I see for not using Common.css is that it's not editable for non-admins. — Vildricianus 15:11, 7 June 2006 (UTC)
Page load time/size, as you often point out to me. I'm sorry, but having it only where needed seems to be a highly superior solution. --Connel MacKenzie T C 15:20, 7 June 2006 (UTC)
I'm not so sure anymore of the page load differences for the various CSS and JS files that need to be loaded. That is, they have to be loaded anyway. I doubt whether their sizes really matter (perhaps in terms of milliseconds). Having defined classes for a couple of things could be superior to templates, if used sparingly. — Vildricianus 15:23, 7 June 2006 (UTC)
OK, I tried "View HTML source" on this page. I don't see any part of Mediawiki:Common.css. I don't think it appears in the HTML source of any page (except Mediawiki:Common.css itself).
Conversely, trying "View HTML source" on beon-wesan, I get 1 transclusion of {{IPA fonts}}, 4 of {{latinx fonts}}, 1 {{polytonic fonts}}, and 1 of the fonts in {{Unicode}}.
Does it bother you that Mediawiki:Common.css defines (for example) classes for wikitable and prettytable even though neither is used on most pages? --teb728 05:43, 8 June 2006 (UTC)
Looking at the comments far above: Ahhh. And BTW, yes, it bugs me that CSS doesn't work the way my brain does.  :-)   --Connel MacKenzie T C 04:44, 9 June 2006 (UTC)
  • I disagree with Connel and I am pretty sure the Wiki devs would too. The CSS pages are precisely where site-wide CSS is supposed to be and it's the reason CSS exists in the first place. Inline styles are generally considered bad. If you watch the dev list or Recent changes over on the English Wikipedia you'll see people are actively replacing inline CSS with CSS classes and IDs which are in their site-wide CSS. Neither the CSS nor the JS pages are downloaded every time you look at a page. They have some kind of timestamp which specifies how often they are downloaded in case of changes - that's why you have to hit CTRL+F5 every time you edit a CSS or JS page.
  • Anyway classes like this are a good idea and I have made several based on {{IPA}} and {{IPAchar}} over the past year or so: {{ARchar}}, {{THchar}}, {{RUchar}}, {{FAchar}}, {{URchar}}, etc. By the way, the inherit/comment hack for MSIE seems to now be discouraged. — Hippietrail 23:06, 9 June 2006 (UTC)
    • Exactly. One big argument against them is that they can't be edited by non-admins. But then, they actually don't have to be very often. — Vildricianus 23:11, 9 June 2006 (UTC)
    • Actually, the inherit/comment hack in not mearly discouraged, it is disabled. Specifically the wiki software now replaces comments in inline styles with a single non-breaking space. This applies, however, to inline styles but not CSS; if you should implement my suggestions, be sure to include the hack. BTW did you notice Connel's latest comment at #Problems displaying IPA in edit & special chars boxes? He seems to agree that you or he should implement my suggestions. --teb728 03:53, 10 June 2006 (UTC)

Specific proposal[edit]

If I understand correctly, there is consensus that my proposal should be implemented. So I propose specifically that the following be appended to Mediawiki:Common.css (just ahead of "/* </pre> */").

/* Support for script templates. The inherit declaration resets the font for all browsers except MSIE6.  The empty comment must remain. */
.IPA {
        font-family: DejaVu Sans, Segoe UI, Lucida Grande, Lucida Sans Unicode, Charis SIL, Doulos SIL, Code2000, Gentium, Gentium Alternative, TITUS Cyberbit Basic, Arial Unicode MS;
        font-family /**/:inherit;
}
.Unicode {
        font-family: TITUS Cyberbit Basic, Code2000, Doulos SIL, Chrysanthi Unicode, Bitstream Cyberbit, Bitstream CyberBase, Bitstream Vera, Thryomanes, Gentium, GentiumAlt, Visual Geez Unicode, Lucida Grande, Tahoma, Arial Unicode MS, Microsoft Sans Serif, Lucida Sans Unicode;
        font-family /**/:inherit;
}
/* Arabic */
.AR {
        font-family: Tahoma, Arial Unicode MS, Code2000, Traditional Arabic; 
        font-family /**/:inherit;
        font-size: 125%;
}
/* Bengali */
.BN {
        font-family: UniBangla, Arial Unicode MS, Code2000, Likhan, UT Bengali Dhaka, Vrinda; 
        font-family /**/:inherit;
        font-size: 130%;
}
/* Persian */
.FA {
        font-family: Tahoma; 
        font-family /**/:inherit;
        font-size: 125%;
}
/* Kashmiri */
.KS {
        font-family: Tahoma; 
        font-family /**/:inherit;
        font-size: 125%;
}
/* Kurdish */
.KU {
        font-family: Tahoma; 
        font-family /**/:inherit;
        font-size: 125%;
}
/* Latin Extended-B
.latinx {
        font-family: TITUS Cyberbit Basic, Code2000, Microsoft Sans Serif;
        font-family /**/:inherit;
}
/* Polytonic Greek */
.polytonic {
        font-family: Athena, Gentium, Palatino Linotype, Arial Unicode MS, Lucida Sans Unicode, Lucida Grande, Code2000; 
        font-family /**/:inherit;
}
/* Russian and other Cyrillic */
.RU {
        font-family: Arial Unicode MS, Gentium, Code2000, Lucida Sans Unicode; 
        font-family /**/:inherit;
}
/* Sindhi */
.SD {
        font-family: MB Sindhi, MBSarang Sattar, MB Bhitai Sattar, MB Lateefi, Ayaz Gul, Tahoma; 
        font-family /**/:inherit;
        font-size: 125%;
}
/* Thai */
.TH {
        font-family: Arial Unicode MS, Code2000; 
        font-family /**/:inherit;
        font-size: 125%;
}
/* Urdu */
.UR {
        font-family: Tahoma; 
        font-family /**/:inherit;
        font-size: 125%;
}

Also that the style specifications be removed from the <span> tags in the "IPA" paragraph of Mediawiki:Edittools, thus:

<p class="specialbasic" id="ipa">
Vowels: <span class="IPA"><charinsert>ɨ ʉ ɯ ɪ ʏ ʊ ø ɘ ɵ ɤ ə ɛ œ ɜ ɞ ʌ ɔ æ ɐ ɶ ɑ ɒ ɚ ɝ </charinsert></span> ··· 
Other: <span class="IPA"><charinsert>ˈ ˌ ː . </charinsert></span><br>
Consonants: <span class="IPA"><charinsert>ʈ ɖ ɟ ɢ ʔ ɱ ɳ ɲ ŋ ɴ ʙ ʀ ɾ ɽ ɸ β θ ð ʃ ʒ ʂ ʐ ʝ ɣ χ ʁ ħ ʕ ɦ ɬ ɮ ʋ ɹ ɻ ɰ ɭ ʎ ʟ ʍ ɥ ʜ ʢ ʡ ɕ ʑ ɺ ɧ ɡ ɫ</charinsert></span><br>
</p>

Also that a <span></span> be added to the "Old English" paragraph of Mediawiki:Edittools, thus:

<p class="speciallang" style="visibility:hidden; display:none">
<span class="latinx"><charinsert>Ā ā Æ æ Ǣ ǣ Ǽ ǽ Ċ ċ Ð ð Ē ē Ġ ġ Ī ī Ō ō Ū ū Ƿ ƿ Ȳ ȳ Þ þ Ȝ ȝ</charinsert></span>
</p>

--teb728 15:29, 13 June 2006