Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
167 lines (109 sloc) 2.61 KB
title type order
Inflection & Transliteration
guide
30

Wordsmith provides multi-language methods for dealing with noun inflection.

Inflection is available for these locales:

  • en (English) (default)
  • es (Spanish)
  • fr (French)
  • nb (Norwegian Bokmal)
  • pt (Portuguese)
  • tr (Turkish)

Wordsmith's inflection and transliteration methods include:

Singulars/Plurals

pluralize

When used without an explicit quantity, pluralize returns the plural form of the given word.

When used with a quantity, pluralize returns the correct singular or plural form of the given word, for the provided quantity and language.

  • quantity (2) — The quantity of objects
  • locale (en) — The language to use for inflection
{{ 'plugin' | pluralize }}

#  plugins
3 {{ 'plugin' | pluralize( qty=3 ) }}

#  "3 plugins"
{{ pluralize('child', qty=1) }}

#  "child"
{{ pluralize('child', qty=100) }}

#  "children"
{{ pluralize('el', locale='es') }} {{ pluralize('hijo', locale='es') }}

#  "los hijos"

singularize

Returns the singular form of the given word.

{{ 'matrices' | singularize }}

#  "matrix"
{{ singularize('mamás', locale='es') }}

#  "mamá"

Ordinals

ordinal

Returns the ordinal suffix that corresponds to the given number. (Uses English ordinalization rules).

{{ 1 | ordinal }}

#  "st"
{{ 2 | ordinal }}

#  "nd"
{{ 3 | ordinal }}

#  "rd"
{{ 4 | ordinal }}

#  "th"

ordinalize

Returns the ordinalized variant of the given number. (Uses English ordinalization rules).

{{ 1 | ordinalize }}

#  "1st"
{{ 42 | ordinalize }}

#  "42nd"
{{ 103 | ordinalize }}

#  "103rd"
{{ 4 | ordinalize }}

#  "4th"

Transliteration

transliterate

// TODO

Case Modification

Wordsmith also provides several methods for case modification, including: