Template:IPA audio filename
Error using {{IPAsym}}: No input
This template produces the filename of an IPA sound sample (not the sound itself). It is determined, by default, from the IPA symbol. For example:
→ {{IPA audio filename|m}}
bilabial nasal.ogg
. Optionally, a non-default filename can be entered here, so the template will produce that non-default filename. Also optionally, the existence of the file can be checked, and an error message can be overridden by a text or a blank.
Usage
changeFull input list is:
{{IPA audio filename | ipa symbol = | soundfile = | checkexist = | errortext = }}
- First parameter or ípa symbol= This first parameter (or named parameter ipa symbol=)is for the IPA symbol. The symbol is translated into the name of the sound (using the list in {{IPAsym}}) and adding the extension
.ogg
. When the parameter is not used, the inputsoundfile=
should be used. For any symbol, the default name can be permanently overruled through the list (see below).
→{{IPA audio filename|ʒ}}
voiced palato-alveolar sibilant.ogg
- soundfile= (optional, default=none) This parameter allows for entering any literal filename. Input here bypasses (overwrites) the first parameter. It can be used to enter a filename that does not have a default name as {{IPAsym}} produces. Note: when used, this input should have the extension.
→{{IPA audio filename|ʒ|soundfile=Accordian chords-01.ogg}}
Accordian chords-01.ogg
- checkexist= (optional, default=no) Can be "yes" or "no". When entered "yes", and the filename is not an error, the template checks for the existence of the filename. If itdoes not exist, an error is produced. Note: Checking for existence is called an "expensive" function, in that it requires serious server-side action. The number of file checks per page is limited.
→{{IPA audio filename|n̪|checkexist=yes}}
File "dental nasal.ogg" does not exist
- errortext= (optional, default=none) The errortext entered here overwrites any possible error-output. If there is no error, this errortext is not used. The tradeoff is: it hides any error information, but is cleans up the output. The errortext can be a blank, like
{{IPA audio filename|m|errortext=}}
.
→{{IPA audio filename|abc|errortext=Some error in the filename}}
Some error in the filename
Permanent altered from default name
changeSome IPA symbols have soundfiles available in Wikipedia that are not the default name. These alternate names can be entered in this template, and will show up in the output.
Subtemplate {{IPA audio filename/filename}}
contains the list of alternate names. Example:
- kʼ is named
velar ejective
, so this would yield default name:velar ejective.ogg
The filename however differs from that default name. The list in {{IPA audio filename/filename}}
produces that different name:
{{IPA audio filename|kʼ}}
→ velar ejective plosive.ogg
Currently, the next nine non-default names are in the list:
- voiceless labio-velar approximant = voiceless labio-velar fricative.ogg (from: ʍ)
- alveolar ejective = alveolar ejective plosive.ogg (from: tʼ)
- uvular ejective = uvular ejective plosive.ogg (from: qʼ)
- bilabial ejective = bilabial ejective plosive.ogg (from: pʼ)
- sje-sound = voiceless dorso-palatal velar fricative.ogg (from: ɧ)
- velar ejective = velar ejective plosive.ogg (from: kʼ)
- labial-velar nasal = labial-velar nasal stop.ogg (from: ŋ͡m)
- epiglottal plosive = voiceless_epiglottal_plosive.ogg (from: ʡ)
- velar approximant = voiced velar approximant.ogg (from: ɰ)
- near-close near-back vowel = near-close near-back rounded vowel.ogg (from:ʊ)
- R-colored vowel=Regular and r-colored vowels.ogg (from:ɚ)
- Near-open central vowel=Near-open central unrounded vowel.ogg (from: ɐ)
Possible errors
changeThree error situations are covered:
- No IPA symbol entered (and no soundfile name):
{{IPA audio filename}}
→ Error using {{IPAsym}}: No input
- The IPA symbol may not be defined in
{{IPAsym}}
:
{{IPA audio filename|abc}}
→ Error using {{IPAsym}}: IPA symbol "abc" not found in list
- Checkexist=yes is asked, and the file does not exist:
{{IPA audio filename|ⱱ̟|checkexist=yes}}
→ File "bilabial flap.ogg" does not exist
These error outputs can be overridden by using errortext=
. This can be blank. This only has effect on the output, it does not alter the existing error situation.
Technical background
change- The template uses nested sub-templates to prevent re-caculation of repeated data. e.g. the name from
{{IPAsym}}
is calculated only once, and then passed through to the next subtemplate in the nest. This is more important for the check on existence {{#ifexist:}}, which is "expensive" and should be performed only once. The nesting has three levels:{{IPA audio filename}}
calls{{IPA audio filename/main1}}
calls{{IPA audio filename/main2}}
. - Error texts are passed through unaltered. At the end, in
/main2
, any error is enveloped with the errortext (if provided). - Check existence is performed only when the filename is not an error in itself.
Issues
change- Todo: the template should accept input "|ipa symbol=...", overriding current unnamed param #1.
Subtemplates used:
{{IPA audio filename/main1}}
{{IPA audio filename/main2}}
{{IPA audio filename/filename}}
(Here non-default filenames can be entered){{IPA audio filename/checkexist}}
Related templates
change{{IPAsym}}
contains the list for translating IPA symbol into the name{{IPA audio filename/filename}}
(Here non-default filenames can be entered)