Jump to content

Template talk:IPA/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1Archive 2Archive 3Archive 5

Usage

Template:IPA is for IPA characters only!

Template:IPA contains

<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA">{{{1}}}</span>

I.e., it simply specifies CSS class IPA.

This allows fixing broken display of International Phonetic Alphabet (IPA) characters in MS Internet Explorer 6 for Windows, and choice of style in any browser.

The font declarations are in MediaWiki:Common.css. Registered Wikipedia users can specify their own style for IPA text by editing, for each project, their user style sheet, e.g. monobook.css. Users can also specify the style locally in their browser, which works across projects.


An example, placing a phonetic rendering of the word characters in Template:IPA:

{{IPA|[ˈkæ.ɹəkˌtə(ɹ)z]}}

The result will be a span with a style attribute, like this:

<span title="Pronunciation in IPA" class="IPA">[ˈkæ.ɹəkˌtə(ɹ)z]</span>

Which appears in your browser as:

[ˈkæ.ɹəkˌtə(ɹ)z]

Without template:IPA:

[ˈkæ.ɹəkˌtə(ɹ)z]

[The last two should only look different if you are using Internet Explorer on Windows, or if you have a custom style defined for IPA text.]

Please place all IPA text into Template:IPA, even if it doesn't have any special IPA characters, like this: [aj pi ej]. This will allow users to format all examples of IPA text consistently, with their choice of fonts, colours, etc.

Technical details

The class="IPA" attribute exists so that Wikipedia users can apply their own style sheets to text in Template:IPA. See #Applying custom styles to IPA text, below.

In MediaWiki:Common.css, the declaration for font-family lists a series of fonts that are known to contain IPA characters.

The second style declaration font-family /**/:inherit; overrides the preceding font declaration, and tells the text in Template:IPA to use the default font inherited from its surroundings, in every browser except MSIE 6.0. The empty comment placed just in the right spot confuses MSIE 6 and prevents it from applying this declaration. This is a documented way of hiding CSS from MSIE 6. [1] (site gone)

Criteria for fonts

Criteria for selecting fonts:

  • Full IPA character set.
  • Normal and bold weights, for emphasis.
  • Sans-serif, matching Wikipedia's default font family.

Less important criteria:

  • Having a wide range of other international characters.
  • Having italics.

Do not surround font names with single quotes, because Wikipedia's software will escape them with backslashes. CSS recommends single quotes around font names with spaces, but doesn't require them.

About the fonts

Arial Unicode MS

  • sans-serif
  • regular only, but automatically generated bold & slanted works in Windows
  • comes with MS Office for PC and Mac
  • is not available for Linux through [2], but is available through distribution-specific methods (i.e. YaST)
  • places double combining modifiers too far to the left by 1 em

Code2000

Doulos SIL

  • serif
  • free font from SIL
  • regular only

Gentium

  • serif
  • free font from SIL
  • regular and italic only

Lucida Grande

  • sans-serif
  • comes with Mac OS X
  • regular and bold only

Lucida Sans Unicode

  • sans-serif
  • comes with Windows XP
  • doesn't include some IPA characters
    • double combining inverted breve

DejaVu Sans

  • full family
  • freely available from SourceForge
  • very complete, also includes LGC (Latin-Greek-Cyrillic)

Free Sans Free Serif Free Mono

  • full family
  • freely available
  • some possible display problems (bad hinting)
    • [what others?]

Applying custom styles to IPA text

You can apply your own custom styles using the .IPA class selector in your local style sheet. If you are a registered Wikipedia member, you can put custom styles into your monobook.css style sheet. For detailed instructions, see Help:User style.

Try this: place the following text into your own monobook.css page after logging in.

.IPA { color: green; }

If you want to see IPA displayed in a particular font, try something like this:

.IPA { font-family: 'Charis SIL', serif; }

You can also override Template:Unicode fonts by using .Unicode, and Template:Polytonic fonts by using .polytonic. Capitalization of these class names must be the same.

See also

Discussion

Just so people understand, this template forces its argument to appear in a <span> tag forcing the use of Unicode fonts. This ensures that users can see the IPA characters in Windows Internet Explorer, which otherwise doesn't display IPA characters for anonymous users. Nohat 18:21, 31 Dec 2004 (UTC)

Actually, I'd say that matching the rest of the page and having bold characters is more important. A well-written browser will substitute characters from a different font if the specified font doesn't have those characters. Of course if the most common browser were well-written, we wouldn't need this template at all. However, we do need it, but we shouldn't degrade the appearance of pages for users whose browsers are well-written. Therefore, a an attractive, well-matched font with roman and bold characters should be the primary criteria. Code2000 is widely regarded as a font of last resort due to its ugliness (as well as its non-freeness) and doesn't match the rest of the pages because it's a serif font: sans-serif is specified for body text in Wikipedia's CSS. Nohat 07:04, 9 Jan 2005 (UTC)
Are there any instances on Wikipedia where IPA is formatted in bold-face? I can't think of a situation where it would be desirable. Michael Z. 16:17, 2005 Jan 9 (UTC)
It's used on several pages to highlight particular symbols in a transcription. See [3] Nohat 19:37, 9 Jan 2005 (UTC)
Good example. I've updated the criteria, and took the liberty of moving discussion down here. Michael Z. 01:17, 2005 Jan 10 (UTC)

Unicode tables

Wouldn't it be useful to make a template that is just the desired CSS font arguments and use that template in table headers so you can avoid putting the IPA template in at every item in the table? I'm not sure how this would interact with Wiki table markup, but I think it would work.

Done, at Template:IPA fonts. It renders the following
  Chrysanthi Unicode, Doulos SIL, Gentium, GentiumAlt, Code2000, TITUS Cyberbit Basic, DejaVu Sans, Bitstream Cyberbit, Arial Unicode MS, Lucida Sans Unicode, Hiragino Kaku Gothic Pro, Matrix Unicode
It's just the font list, so it can be used in a style attribute to specify font-family or font, or even (heaven forfend) in a <font> element. I've put it into template:IPA, so the font list for all IPA in Wikipedia can be edited in one place. Michael Z. 01:59, 2005 Jan 10 (UTC)

Also, as you probably remember I made a separate Unicode template a while back. In that template we recently changed the order of the fonts. What is your logic for the order you're using? It would be good to put the logic here in the talk page. --Chinasaur 19:40, 8 Jan 2005 (UTC)

The logic has been changing as users have edited this template. See the history, and the font list above, for some insight. If the activity settles down, maybe I'll write it out for this talk page. Michael Z. 01:59, 2005 Jan 10 (UTC)

Arial Unicode MS bugs

AxSkov, which IPA characters does Arial Unicode MS have that Lucida Sans Unicode does not? The reason I want to move Arial further down the list is that it has a bug in the way it displays double combining modifiers (which are used to represent some affricates). See Talk:International Phonetic Alphabet#Other symbols for the technical details and examples. Michael Z. 21:56, 2005 Jan 8 (UTC)

After doing some testing, it appears to me that Lucida Sans Unicode doesn't include those characters anyway, so I guess it doesn't matter which MS font comes first in that regard. I've put Lucida Grande first, so Mac OS X users will see it correctly even if they happen to have the MS fonts. Lucida Grande doesn't have italics, but I think IPA would never be italicized anyway. Michael Z. 22:22, 2005 Jan 8 (UTC)

Replace with IE-specific style sheet class

I'd like to propose changing the way Template:IPA works, so that it only has an effect in MSIE 6 for Windows. This requires two changes:

1. Add a style sheet directive to Wikipedia's existing MSIE-only style sheet [4]:

.IPA { font-family: Lucida Grande, Arial Unicode MS,
       Lucida Sans Unicode, Gentium, Code2000; }

2. Edit Template:IPA so that it applies the IPA class:

<span class="IPA"> [content] </span>

To specify IPA in a different scope (e.g., a table or a div), an editor can simply add class="IPA" as an HTML attribute. Multiple classes can be specified: class="toccolours IPA". Users can also use the .IPA selector to specify styles in their own user style sheets at User:XXX/monobook.css.

We'll need the co-operation of an admin or developer to change the style sheet.

Why?

  • The font specification is only required for one browser: MSIE 6/Windows. It's a hack.
    • Other modern browsers automatically substitute fonts containing the characters (Mozilla, Firefox, Safari)
    • Some older browsers won't display IPA anyway (MSIE 5/Mac)
  • The current method needlessly overrides the font display for other browsers, including user-selected fonts, and may break the display. It will override:
    • Web browser's default font
    • Web browser's automatic font substitution (e.g., if the default font doesn't have IPA characters
    • User's selected font in browser preferences
    • User's local style sheet
    • Wikipedian's fonts specified in User:XXX/monobook.css.
  • Users might be tempted to use this for other Unicode character ranges, where it may may degrade display in other browsers (I've already seen it happen). If its application is restricted to a single Windows browser, then changes are less likely to do any damage.
  • This solution allows registered Wikipedians to specify their own font for IPA in their monobook.css style sheet.

Disadvantages:

  • The font specification list would live in a style sheet, where it can only be edited by an admin or developer.

Any comments? Michael Z. 20:22, 2005 Jan 14 (UTC)

Attention, Australia!

Dear anonymous user from Australia (203.164.184.61, etc.),

Why do you keep changing this template? It's set up to work around a font-display inadequacy in MS Internet Explorer for Windows, and to not do anything in other web browsers. There's an explanation in #Technical details, above. If you're changing it for another reason, please let us know here.

You can override the font display for yourself only, by putting something like the following in your browser's user style sheet, or by registering as a Wikipedia user and putting it in your own Wikipedia style sheet. Registration has other benefits, too.

 .IPA { font-family: Arial Unicode MS; }

Michael Z. 2005-01-22 16:54 Z

Using the template

It's important, if surrounding the IPA characters with slashes or square brackets, to put these inside the IPA template, for instance {{IPA|/.../}}, rather than /{{IPA|...}}/, as otherwise a spurious space will appear after the leading slash or bracket. I realised this after seeing some of my edits corrected by User:Angr. rossb 06:57, 18 Feb 2005 (UTC)

Yup. I don't think it used to do this; anyone know if template behaviour has changed in the last week or two? Michael Z. 2005-02-18 16:13 Z

In my opinion the brackets should be integrated to the Template already. Stern 07:59, 16 Mar 2005 (UTC)

Well, sometimes you want to use square brackets, sometimes you want slashes, and sometimes you don't want any brackets at all. And if you had three separate templates, the names of the templates would probably be longer than the two keystrokes it takes to type a pair of brackets. Compare {{IPA-slashes|bim}} {{IPA-brackets|bim}} {{IPA-plain|bim}} with {{IPA|/bim/}} {{IPA|[bim]}} {{IPA|bim}} Nohat 08:53, 16 Mar 2005 (UTC)

Hundreds of IPA codes ...

... can be found here and can be copied to the english Wikipedia. Stern 08:06, 16 Mar 2005 (UTC)

Thank you. Some of these will be helpful, although I must confess some of them are quite amusing, such as the British pronunciations of American places. [ˈaːkənsɔː] and ['ʌɪdəhəʊ], indeed! Nohat 09:05, 16 Mar 2005 (UTC)

Like in the german Wikipedia (see de:Enschede for example) the IPA-code should link to Wikipedia's IPA page. In the german Wikipedia the Template follows always directly after the first time the text's name is used -- without any description. Thats better than in the english Wikipedia. Stern 08:04, 16 Mar 2005 (UTC)

The problem with linking the IPA transcriptions themselves is the underline that is standard in the link can get in the way of deciphering which symbol is present, particularly if there are diacritics that appear below the letter. But even disregarding that, the difference between the symbol for the velar nasal and the palatal nasal would probably be hard to discern if there were an underline crossing through the descenders. Nohat 08:53, 16 Mar 2005 (UTC)
I do like the usage without a label, but I agree that a link is problematic. If the usage becomes a commonly-used convention, then I think it can stand without explanation, just as it does in paper dictionaries or encyclopedias. Michael Z. 2005-03-17 15:58 Z
How about adding something like " [[International Phonetic Alphabet|*]]" to the template? J. 'mach' wusttskʃpræːx 17:00, 2 May 2005 (UTC)
I for one don't want to link to the International Phonetic Alphabet page every single time I use the IPA template. Sometimes I prefer to link to International Phonetic Alphabet for English or IPA chart for English, or nothing at all because I'm using the template for the twentieth time in the same paragraph. Also all those asterisks before linguistic forms would make people think they were either reconstructed or ungrammatical. --Angr/comhrá 17:43, 2 May 2005 (UTC)
That's true, the asterisks would be too confusing. What do you think about adding a title-attribute:
<span title="This is an IPA-transcription; see: International phonetic alphabet." class="IPA" style="white-space: nowrap; font-family:{{IPA fonts}}; font-family /**/:inherit;">{{{1}}}</span>
This would look like this: /aɪ æm ən ɪgzɑːmpl/. J. 'mach' wusttskʃpræːx 18:13, 2 May 2005 (UTC)
That's pretty good. I would edit the title slightly: /aɪ æm ən ɪgzɑːmpl/.
I would also be in favour of linking the text to International Phonetic Alphabet, and using CSS to prevent underlining. Michael Z. 2005-05-2 23:51 Z
If we'd include "Pronunciation of xxx" in the title, then the template must include a regular spelling of the transcribed phrase. This would be possible, but it would be a major work to do so. Aditionally, I don't think it would be necessary, since the transcription will most of the times be preceded by a regular spelling version.
I've tried to make the css disappear the underline. However, this css is overwritten by the settings in the preferences (and probably by browser settings as well). If we look what the following produces:
[[International Phonetic Alphabet|<span class="IPA" style="text-decoration:none; white-space:nowrap; font-family:{{IPA fonts}}; font-family /**/:inherit;">{{{1}}}</span>]]
Then we see that the underline stays: /aɪ æm ən ɪgzɑːmpl/. J. 'mach' wusttskʃpræːx 09:52, 3 May 2005 (UTC)
It's text-decoration: none, but it won't work in an inline style, because the style sheet's :hover selector is more specific. To make this work we need the co-operation of an admin who can edit monobook.css. Michael Z. 2005-05-3 15:31 Z

Sometimes the template makes it worse!

I've been adding the IPA template to the Brazilian Portuguese article, which had a lot of IPA without the template, but there are one or two characters that are worse with the template than without it. Notably #7869 displays correctly wihout the template — ẽ , but as the null glyph with the template — . Any suggestions? rossb 10:07, 16 Mar 2005 (UTC)

Font problem. The current font order is Code2000, Gentium, Lucida Sans Unicode, TITUS Cyberbit Basic, Arial Unicode MS, Lucida Grande (Template:IPA_fonts). Both Code2000 and Gentium contain the character, but Lucida Sans Unicode does not. I suspect you do not have Code2000 or Gentium, but do have LSU. Since Arial Unicode MS also includes the character, I'll move that one before Lucida. Jordi· 10:19, 16 Mar 2005 (UTC)
This seems to have cured the problem! rossb 13:39, 16 Mar 2005 (UTC)

SAMPA

I have created Template:SAMPA and Template:IPA-SAMPA, the first simply a class wrapper for SAMPA code in the same vein as the IPA class, the second is for pages where both IPA and SAMPA are given, and allows the user to turn off one or the other based on their preference, such as:

.IPA { color: green; }
.IPA-SAMPA .SAMPA { display: none; }
Nicholas 22:17, 22 Mar 2005 (UTC)
Thanks, I think. I just hope people don't take this as an incentive to add gobs of hideous SAMPA to lots of articles. Nohat 01:16, 23 Mar 2005 (UTC)
Concurrance, although Wikipedia policy is preference for IPA, I realise that some people may not be able to display IPA or may be familiar with SAMPA and not IPA, and prefer to see that. I originally did this in Received Pronunciation (2 October or so) with classes 'ipa' and 'sampa' but it got reverted for adding HTML tags liberally throughout the article. This template method is much better. Personally I'd never heard of SAMPA till I saw it on Wikipedia, and honestly can't agree more that it's the most hideous thing I've seen in linguistics :-) Nicholas 09:38, 23 Mar 2005 (UTC)
I think there are now very few articles in the English Wikipedia that still use SAMPA to show the pronunciation of a particular word. Several editors (including myself) have been systematically replacing it with IPA. it does of course still exist in specialist articles on linguistic matters, but could probably be largely removed there as well. I think it's unlikely that any significant number of people would be familiar with SAMPA and not IPA, give that SAMPA is merely a kludge for displaying IPA on computer systems that can't cope with IPA characters. And just about every modern dictionary I've looked at recently (in the UK) uses IPA. I think that American dictionaries may use other schemes, but I can't imagine SAMPA will be among them. rossb 18:49, 23 Mar 2005 (UTC)

The real problem with this is that some articles will have just IPA, others just SAMPA. If I can't see the SAMPA, then I won't take the opportunity to quickly add the IPA (and probably nuke the SAMPA). Michael Z. 2005-04-7 23:18 Z

I don't understand this point about not seeing the SAMPA. If the SAMPA is there, anyone can see it, it doesn't need any special characters (which is the whole point of it after all). In practice there should be almost no articles left that contain SAMPA and not IPA (other than a few more complex specifically linguistic articles, which if they don't have IPA should already have had their talk pages marked with the convertIPA template). rossb
I was referring to Nicholas' proposal of hiding SAMPA. Michael Z. 2005-04-8 14:00 Z

Size?

IPA is often nigh-illegible with the default font size, so I've found myself increasing the text size just to see what's going on. I now have my monobook.css set to display IPA at 16pt which is much nicer. Any thoughts on this? It does stand out, but then so does the image rendering of math TeX markup. Probably something other than points would have to be used in the CSS since people may be using different base font sizes. DopefishJustin (・∀・) 21:49, May 23, 2005 (UTC)

Template size

With the long title text and many fonts in the declaration, this template is currently 471 characters long. This template swells the article on the International Phonetic Alphabet by over 219 kilobytes, tripling its size!

The title text should be pared down. Only fonts that are likely to be on a user's machine should be included; if you want another font represented, add a declaration to your own user style sheet instead of adding it here (see #Applying custom styles to IPA text on this page). Michael Z. 2005-10-2 22:51 Z