Jump to content

Template:IPA/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
update IETF
Line 7: Line 7:
'''[[Template:IPA]]''' is useful when there are multiple instances of the [[International Phonetic Alphabet]] (IPA) on a page. It contains
'''[[Template:IPA]]''' is useful when there are multiple instances of the [[International Phonetic Alphabet]] (IPA) on a page. It contains


<nowiki><span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA" lang="und-fonipa">{{{1}}}</span></nowiki>
<nowiki><span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA" lang="und-Latn-fonipa">{{{1}}}</span></nowiki>


This means it specifies a class called "IPA" as a hook for CSS styling and DOM scripting. This allows for assigning specific fonts to display IPA characters. Registered Wikipedia users can specify their own fonts for IPA text by editing their user style sheet, e.g. [[Special:MyPage/common.css]]. Users can also edit their global stylesheet ([[meta:Special:MyPage/global.css]]), which works across all projects. [[MediaWiki:Common.css]] also ensures that links inside IPA transcriptions marked up with this template do not use underlines since these carry special semantics there. For instance, the following code would cause IPA to be displayed in the font [[Charis SIL]]:
This means it specifies a class called "IPA" as a hook for CSS styling and DOM scripting. This allows for assigning specific fonts to display IPA characters. Registered Wikipedia users can specify their own fonts for IPA text by editing their user style sheet, e.g. [[Special:MyPage/common.css]]. Users can also edit their global stylesheet ([[meta:Special:MyPage/global.css]]), which works across all projects. [[MediaWiki:Common.css]] also ensures that links inside IPA transcriptions marked up with this template do not use underlines since these carry special semantics there. For instance, the following code would cause IPA to be displayed in the font [[Charis SIL]]:
Line 43: Line 43:
The result will be a span with a class attribute, like this:
The result will be a span with a class attribute, like this:


<nowiki><span</nowiki> title="Representation in the International Phonetic Alphabet (IPA)" class="IPA" lang="en-fonipa">/ˈkærəktɚz/<nowiki></span></nowiki>
<nowiki><span</nowiki> title="Representation in the International Phonetic Alphabet (IPA)" class="IPA" lang="en-Latn-fonipa">/ˈkærəktɚz/<nowiki></span></nowiki>


Which appears in your browser as:
Which appears in your browser as:

Revision as of 20:39, 27 June 2022

Usage

Template:IPA is useful when there are multiple instances of the International Phonetic Alphabet (IPA) on a page. It contains

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

This means it specifies a class called "IPA" as a hook for CSS styling and DOM scripting. This allows for assigning specific fonts to display IPA characters. Registered Wikipedia users can specify their own fonts for IPA text by editing their user style sheet, e.g. Special:MyPage/common.css. Users can also edit their global stylesheet (meta:Special:MyPage/global.css), which works across all projects. MediaWiki:Common.css also ensures that links inside IPA transcriptions marked up with this template do not use underlines since these carry special semantics there. For instance, the following code would cause IPA to be displayed in the font Charis SIL:

.IPA {
	font-family: Charis SIL;
}

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:IPA in articles based on its TemplateData.

TemplateData for IPA

This template ensures proper display of transcriptions using the International Phonetic Alphabet (IPA), especially in older operating systems and browsers. There are related specialized templates that also semi-automatically generate the transcription itself.

Template parameters

ParameterDescriptionTypeStatus
Transcription1

including square brackets [...] for phonetic transcriptions or enclosing forward slashes /.../ for phonemic ones

Stringrequired
Language codelang

ISO 639 code of the language being transcribed, will be used in IETF language tag

Example
en
Stringoptional

Examples

Placing a phonemic rendering of the word characters in Template:IPA:

{{IPA|/ˈkærəktɚz/|lang=en}}
{{IPA|/[[character|ˈkærəktɚz]]/|lang=en}}

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

<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA" lang="en-Latn-fonipa">/ˈkærəktɚz/</span>

Which appears in your browser as:

/ˈkærəktɚz/
/ˈkærəktɚz/

Without template:IPA:

/ˈkærəktɚz/
/ˈkærəktɚz/

These sets may look different if you have a custom font defined for IPA text.

Please place all IPA text into the template, even if it doesn't have any special IPA characters, like this: /mi/. This will allow users to format all examples of IPA text consistently, with their choice of fonts, colours, etc.