Ordinal
Synopsis
Converts numbers to ordinal format in multiple languages.
Schema
- ordinal:
field: <ident>
target_field: <string>
language: <string>
format: <string>
case: <string>
date_format: <string>
gender: <string>
superscript: <boolean>
space_before_suffix: <boolean>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Source field containing number or date to convert |
target_field | N | Same as field | Target field to store ordinal result |
language | N | en | Language code (en, es, fr, de, it, pt, nl, ru, ja, zh) |
format | N | suffix | Output format (suffix, word, both, number_suffix) |
case | N | lower | Text case (lower, upper, title, sentence) |
date_format | N | - | Custom date format with ordinals using {day} placeholder |
gender | N | - | Gender for languages with gender (masculine, feminine, neuter) |
superscript | N | false | Output ordinal suffix with HTML superscript tags |
space_before_suffix | N | false | Add space before ordinal suffix |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if conversion fails |
ignore_missing | N | false | Skip processing if referenced field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
Converts numeric values to ordinal representations supporting multiple languages and output formats. The processor handles both individual numbers and numbers embedded within strings.
The processor supports ten languages with proper linguistic rules for ordinal formation. For gendered languages like Spanish, French, Italian, and Portuguese, the gender parameter affects the ordinal suffix and word forms.
Languages use different ordinal conventions: English uses suffixes (1st, 2nd, 3rd), Romance languages use degree symbols (1º, 2ª), Germanic languages use periods (1.), and Asian languages use prefixes (第1, 1番目).
The processor can output ordinals in various formats: numeric with suffix (21st), word form (twenty-first), or both (21st (twenty-first)). For date formatting, use the special \{day\}
placeholder to insert ordinal day numbers into custom date templates.
When processing strings containing multiple numbers, all numeric values in the text will be converted to ordinals. Use field isolation if you need to convert only specific numbers.
Examples
Basic Number Ordinals
Converting numbers to English ordinals... |
|
creates ordinal form: |
|
Spanish Gendered Ordinals
Using Spanish feminine ordinals... |
|
generates Spanish feminine ordinal: |
|
Date Formatting with Ordinals
Creating ordinal date format using custom template... |
|
formats with ordinal day: |
|
Word Form Ordinals
Converting to word form ordinals... |
|
creates word form: |
|
Superscript HTML Format
Generating HTML superscript ordinals... |
|
outputs HTML formatted ordinal: |
|
Multi-Language Processing
Processing French ordinals with proper formatting... |
|
generates French ordinal: |
|
String Number Conversion
Converting numbers within text strings... |
|
converts embedded numbers: |
|