Inflection & Transliteration

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

Inflection is available for these locales:

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.

{{ '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: