Template:A or an/doc

From Alliance of Independent Nations Wiki
Revision as of 03:17, 17 April 2024 by CharlieZane (talk | contribs) (Created page with "{{high-use}} {{Documentation subpage}} <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> {{template shortcut|a(n)|a/n}} {{Lua|Module:a or an}} This template determines whether the first word in the argument provided begins with a vowel or consonant and returns with it "a" or "an" depending on the assessment. ==Usage== In general, it returns "an" if the first letter is ''a, e, i, o'', or ''u'', and "a" if any other: * <code><nowiki>"{{a or...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template determines whether the first word in the argument provided begins with a vowel or consonant and returns with it "a" or "an" depending on the assessment.

Usage[edit source]

In general, it returns "an" if the first letter is a, e, i, o, or u, and "a" if any other:

  • "{{a or an|word}}" → "Script error: No such module "A or an"."
  • "{{a or an|elephant}}" → "Script error: No such module "A or an"."

To capitalize "a", wrap the template in {{ucfirst:...}}.

  • "{{ucfirst:{{a or an|word}}}}" → "Script error: No such module "A or an"."
  • "{{ucfirst:{{a or an|elephant}}}}" → "Script error: No such module "A or an"."

Words beginning with a vowel letter[edit source]

Words that begin with eu, ew, uni, etc., and others like one, once, and U are exceptions:

  • "{{a or an|European}}" → "Script error: No such module "A or an"."
  • "{{a or an|one-sided game}}" → "Script error: No such module "A or an"."
  • "{{a or an|U-turn}}" → "Script error: No such module "A or an"."
  • "{{a or an|Ukrainian}}" → "Script error: No such module "A or an"."
  • "{{a or an|university}}" → "Script error: No such module "A or an"."

Some exceptions are made to the above rule.

  • "{{a or an|Euler diagram}}" → "Script error: No such module "A or an"."
  • "{{a or an|unimportant case}}" → "Script error: No such module "A or an"."

Words beginning with a consonant letter[edit source]

Words that begin with a consonant letter also have some exceptions:

  • "{{a or an|heir}}" → "Script error: No such module "A or an"."
  • "{{a or an|hour}}" → "Script error: No such module "A or an"."
  • "{{a or an|honor}}" → "Script error: No such module "A or an"."
  • "{{a or an|honour}}" → "Script error: No such module "A or an"."
  • "{{a or an|nth degree}}" → "Script error: No such module "A or an"."
  • "{{a or an|x-ray image}}" → "Script error: No such module "A or an"."
  • "{{a or an|Xbox}}" → "Script error: No such module "A or an"."
  • "{{a or an|ytterbium fiber}}" → "Script error: No such module "A or an"."

Abbreviations[edit source]

Words in all caps are treated as initialisms. If an initialism begins with F, H, L, M, N, R, S, or X, it returns "an". If it begins with U, it returns "a". Thus:

  • "{{a or an|LED}}" → "Script error: No such module "A or an"."
  • "{{a or an|led}}" → "Script error: No such module "A or an"."
  • "{{a or an|URL}}" → "Script error: No such module "A or an"."
  • "{{a or an|url}}" → "Script error: No such module "A or an"."

Some notable acronyms are made exceptions.

  • "{{a or an|FIFA referee}}" → "Script error: No such module "A or an"."
  • "{{a or an|NASA program}}" → "Script error: No such module "A or an"."
  • "{{a or an|UNRWA ambulance}}" → "Script error: No such module "A or an"."

Numbers[edit source]

If the first word begins with 8, 11, or 18, it returns "an", unless it is read with "hundred", "thousand", etc. at the beginning.

  • "{{a or an|11}}" → "Script error: No such module "A or an"."
  • "{{a or an|18th}}" → "Script error: No such module "A or an"."
  • "{{a or an|110}}" → "Script error: No such module "A or an"."
  • "{{a or an|1800}}" → "Script error: No such module "A or an"." (assumes it's a year)
  • "{{a or an|1,800}}" → "Script error: No such module "A or an"."
  • "{{a or an|180,000}}" → "Script error: No such module "A or an"."
  • "{{a or an|180000}}" → "Script error: No such module "A or an"."
  • "{{a or an|18,000,000}}" → "Script error: No such module "A or an"."
  • "{{a or an|18000000}}" → "Script error: No such module "A or an"."

Currency signs at the beginning are ignored.

  • "{{a or an|£8}}" → "Script error: No such module "A or an"."

Ambiguous cases[edit source]

If |variety=us is set, herb(s) and herbal are treated as starting with a vowel sound.

  • "{{a or an|herb}}" → "Script error: No such module "A or an"."
  • "{{a or an|herb|variety=us}}" → "Script error: No such module "A or an"."

Words before which people have not settled on whether to use "a" or "an" are generally not made exceptions, so the general rules apply.

  • "{{a or an|FAQ}}" → "Script error: No such module "A or an"."
  • "{{a or an|upsilon}}" → "Script error: No such module "A or an"."

If the first letter is a non-Latin character, it returns "a" by default.

  • "{{a or an|あ}}" → "Script error: No such module "A or an"."

If the parameter is not entered, it returns an empty string.

  • "{{a or an}}" → "Script error: No such module "A or an"."

Template:String-handling templates Template:Lowercase title