Difference between revisions of "Template:IPA symbol/doc"

From blackwiki
Jump to navigation Jump to search
imported>Nardog
 
(84 intermediate revisions by 23 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{SpecialChars}}
+
{{lua|Module:IPA symbol}}
This template provides a simple conversion table from IPA symbols (which may consist of one or more characters) to Wikipedia article names for the corresponding sound.
+
This template provides a simple conversion table from an ''IPA symbol'' '''to''' a ''Wikipedia article name''. Its direct use is probably not too meaningful, but it can be useful inside other templates, e.g. {{tl|IPA link}}. It is a meta-template.
  
Its direct use is probably not too meaningful, but it can be useful inside other templates, e.g. {{tl|IPAlink}}.
+
The resulting article name should exist. The input symbol may be multiple characters.
  
=== Usage ===
+
==Usage==
This template has one parameter which is numbered and mandatory. The parameter can be an IPA symbol, or an IPA-number. If the argument does not exist in the table, then by default {{IPAsym|this is definitely not in the table}} is returned (but please note that a change to this is [[Template_talk:IPAsym#Default_string|under discussion]]).
+
This template has one parameter that is mandatory. The parameter must be an IPA symbol or a sequence of IPA symbols. A formatting template like {{tl|IPA}} is not necessary.
  
:<tt><nowiki>{{IPAsym|m}}</nowiki></tt> &rarr; {{IPAsym|m}}
+
* <code><nowiki>{{IPA symbol|m}}</nowiki></code> {{IPA symbol|m}}
:<tt><nowiki>{{IPAsym|114}}</nowiki></tt> &rarr; {{IPAsym|114}}
+
* <code><nowiki>{{IPA symbol|ɡ͡b}}</nowiki></code> {{IPA symbol|ɡ͡b}}
:<tt><nowiki>{{IPAsym|ɡ͡b}}</nowiki></tt> &rarr; {{IPAsym|ɡ͡b}}
 
:<tt><nowiki>{{IPAsym|pʰɪk}}</nowiki></tt> &rarr; {{IPAsym|pʰɪk}}
 
  
The latter is normally more an example of accidental misuse than intentional use, or it could be a sign that a symbol is missing from this table.
+
Use <code>output=</code> to specify the type of the output: "name", "symbol", "article", or "audio".
 +
* <code><nowiki>{{IPA symbol|t̪|output=name}}</nowiki></code> → {{IPA symbol|t̪|output=name}}
 +
* <code><nowiki>{{IPA symbol|t̪|output=article}}</nowiki></code> → {{IPA symbol|t̪|output=article}}
 +
* <code><nowiki>{{IPA symbol|t̪|output=audio}}</nowiki></code> → {{IPA symbol|t̪|output=audio}}
 +
* <code><nowiki>{{IPA symbol|w̥|output=symbol}}</nowiki></code> → {{IPA symbol|w̥|output=symbol}} (returns the primarily defined symbol)
  
Optionally, when the input characters are unknown, the returned text can be altered from "IPA" by using the second parameter:
+
Certain symbols such as the tie bars, length marks, and dotted circle in the input are ignored so long as the rest of the input matches a definition, so that the below do not result in errors even though these individual combinations are not defined in the data.
:<tt><nowiki>{{IPAsym|pʰɪk}}</nowiki></tt> &rarr; {{IPAsym|pʰɪk}} (regular, default)
+
* <code><nowiki>{{IPA symbol|}}</nowiki></code> {{IPA symbol|}}
:<tt><nowiki>{{IPAsym|pʰɪk|unknown}}</nowiki></tt> &rarr; {{IPAsym|pʰɪk|unknown}} (parameter 2 used)
+
* <code><nowiki>{{IPA symbol|◌ʰ}}</nowiki></code> {{IPA symbol|◌ʰ}}
:<tt><nowiki>{{IPAsym|pʰɪk|}}</nowiki></tt> &rarr; {{IPAsym|pʰɪk|}} (empty string)
 
  
=== Extending this template ===
+
If no direct match is found, the template will then look for the earliest instance of a diacritic in the input string.
If you want to add a new symbol-to-sound mapping, simply add a new row in the table, using the existing rows as examples.
+
* <code><nowiki>{{IPA symbol|pʰ}}</nowiki></code> → {{IPA symbol|pʰ}}
 +
* <code><nowiki>{{IPA symbol|pʰæ̃}}</nowiki></code> → {{IPA symbol|pʰæ̃}}
 +
* <code><nowiki>{{IPA symbol|pæ̃}}</nowiki></code> → {{IPA symbol|pæ̃}}
  
It is possible to map more than one symbol to the same sound. IPA-numbers for the symbol should be added in the same fashion. To avoid duplication, please make them "fall through" to the last case, like this:
+
A two-character diacritic takes precedence over a one-character one should they be found at the same position.
 +
* <code><nowiki>{{IPA symbol|ʰa}}</nowiki></code> → {{IPA symbol|ʰa}}
 +
* <code><nowiki>{{IPA symbol|ʰpa}}</nowiki></code> → {{IPA symbol|ʰpa}}
  
<nowiki>
+
Some symbols in the input are automatically replaced by the more suitable counterparts.
...
+
* <code><nowiki>{{IPA symbol||output=symbol}}</nowiki></code> (right single quotation mark) → {{IPA symbol|’|output=symbol}} ([[modifier letter apostrophe]])
  | 424
 
  | ɑ̃
 
  | ɛ̃
 
  | œ̃
 
  | ɔ̃ = nasal vowel
 
...</nowiki>
 
  
=== See also ===
+
==Data==
* {{tl|IPAlink}} – Displays an IPA symbol which is automatically linked to its sound article: {{IPAlink|β}}
+
The data is stored at [[Module:IPA symbol/data]]. It is divided into two groups: "sounds" and "diacritics". If no "article" is specified, the value for "name" will substitute it. A diacritic must be one or two Unicode characters. The data also stores substitution patterns for the input string.
* {{tl|IPAblink}} – As {{tlf|IPAlink}}, enclosed in square brackets: {{IPAblink|β}}
+
 
* {{tl|infobox IPA}}, which uses the IPA-number here to provide the (linked) name of the corresponding article.
+
==Errors==
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
+
If the input matches no definition in the data, an error message is returned and the page will be categorized into [[:Category:International Phonetic Alphabet pages needing attention]].
[[Category:IPA working templates]]
+
* <code><nowiki>{{IPA symbol|xyz}}</nowiki></code> → {{IPA symbol|xyz}}
</includeonly>
+
 
 +
Optionally, an error text can be altered from the default message to any text by using the second parameter (if set to <code>blank</code>, the message will not appear at all). This cancels the addition of the error category.
 +
* <code><nowiki>{{IPA symbol|xyz|unknown}}</nowiki></code> → {{IPA symbol|xyz|unknown}}
 +
* <code><nowiki>{{IPA symbol|xyz|blank}}</nowiki></code> → {{IPA symbol|xyz|blank}}
 +
 
 +
==See also==
 +
* {{tl|IPA link}} – Displays an IPA symbol which is automatically linked to its sound article: β → {{IPA link|β}}
 +
* {{tl|IPAblink}} – As {{tlf|IPA link}}, enclosed in square brackets: {{IPAblink|β}}
 +
* {{tl|IPAslink}} – As {{tlf|IPA link}}, enclosed in slashes: {{IPAslink|β}}
 +
* [[:Category:International Phonetic Alphabet pages needing attention]]
 +
 
 +
{{IPA templates}}
 +
 
 +
{{collapse top|TemplateData}}
 +
<templatedata>
 +
{
 +
"params": {
 +
"1": {
 +
"label": "Input symbol",
 +
"example": "'m'",
 +
"type": "string",
 +
"required": true
 +
},
 +
"2": {
 +
"label": "Error text",
 +
"example": "blank",
 +
"type": "string"
 +
},
 +
"output": {
 +
"label": "Output type",
 +
"example": "audio",
 +
"type": "string"
 +
}
 +
}
 +
}
 +
</templatedata>
 +
{{collapse bottom}}
 +
<includeonly>{{sandbox other||
 +
<!-- Categories below this line, please; interwikis at Wikidata -->
 +
[[Category:IPA symbol templates]]
 +
[[Category:Templates that add a tracking category]]
 +
}}</includeonly>

Latest revision as of 09:14, 2 March 2019

This template provides a simple conversion table from an IPA symbol to a Wikipedia article name. Its direct use is probably not too meaningful, but it can be useful inside other templates, e.g. {{IPA link}}. It is a meta-template.

The resulting article name should exist. The input symbol may be multiple characters.

Usage

This template has one parameter that is mandatory. The parameter must be an IPA symbol or a sequence of IPA symbols. A formatting template like {{IPA}} is not necessary.

  • {{IPA symbol|m}} → Voiced bilabial nasal
  • {{IPA symbol|ɡ͡b}} → Voiced labial–velar plosive

Use output= to specify the type of the output: "name", "symbol", "article", or "audio".

  • {{IPA symbol|t̪|output=name}} → Voiceless dental plosive
  • {{IPA symbol|t̪|output=article}} → Voiceless dental plosive
  • {{IPA symbol|t̪|output=audio}} → Voiceless dental stop.ogg
  • {{IPA symbol|w̥|output=symbol}} → ʍ (returns the primarily defined symbol)

Certain symbols such as the tie bars, length marks, and dotted circle in the input are ignored so long as the rest of the input matches a definition, so that the below do not result in errors even though these individual combinations are not defined in the data.

  • {{IPA symbol|aː}} → Open front unrounded vowel
  • {{IPA symbol|◌ʰ}} → Aspirated consonant

If no direct match is found, the template will then look for the earliest instance of a diacritic in the input string.

  • {{IPA symbol|pʰ}} → Aspirated consonant
  • {{IPA symbol|pʰæ̃}} → Aspirated consonant
  • {{IPA symbol|pæ̃}} → Nasal vowel

A two-character diacritic takes precedence over a one-character one should they be found at the same position.

  • {{IPA symbol|ʰa}} → Aspirated consonant
  • {{IPA symbol|ʰpa}} → Preaspiration

Some symbols in the input are automatically replaced by the more suitable counterparts.

Data

The data is stored at Module:IPA symbol/data. It is divided into two groups: "sounds" and "diacritics". If no "article" is specified, the value for "name" will substitute it. A diacritic must be one or two Unicode characters. The data also stores substitution patterns for the input string.

Errors

If the input matches no definition in the data, an error message is returned and the page will be categorized into Category:International Phonetic Alphabet pages needing attention.

  • {{IPA symbol|xyz}}Error using {{IPA symbol}}: "xyz" not found in list

Optionally, an error text can be altered from the default message to any text by using the second parameter (if set to blank, the message will not appear at all). This cancels the addition of the error category.

  • {{IPA symbol|xyz|unknown}} → unknown
  • {{IPA symbol|xyz|blank}}

See also

TemplateData

No description.

Template parameters

ParameterDescriptionTypeStatus
Input symbol1

no description

Example
'm'
Stringrequired
Error text2

no description

Example
blank
Stringoptional
Output typeoutput

no description

Example
audio
Stringoptional