Skip to content

Ordinals do not work #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Cimbali opened this issue Oct 10, 2023 · 0 comments · Fixed by #193
Closed

Ordinals do not work #192

Cimbali opened this issue Oct 10, 2023 · 0 comments · Fixed by #193

Comments

@Cimbali
Copy link
Contributor

Cimbali commented Oct 10, 2023

The docs give the following example:

your-rank = { NUMBER($pos, type: "ordinal") ->
   [1] You finished first!
   [one] You finished {$pos}st
   [two] You finished {$pos}nd
   [few] You finished {$pos}rd
  *[other] You finished {$pos}th
}

Checking via the online editor I see we get the following strings:

1: You finished first!
2: You finished 2nd
3: You finished 3rd
4: You finished 4th
5: You finished 5th
…
20: You finished 20th
21: You finished 21st
22: You finished 22nd
23: You finished 23rd
24: You finished 24rd
25: You finished 25rd

But the python implementation seems to not recognise the type: "ordinal" on the selector and we always get the “other” case:

>>> from fluent.runtime import FluentLocalization, FluentResourceLoader
>>> l10n = FluentLocalization(['en'], ['test.ftl'], FluentResourceLoader('{locale}'))
>>> l10n.format_value('your-rank', {'pos': 1})
'You finished 1th'
>>> l10n.format_value('your-rank', {'pos': 2})
'You finished 2th'
>>> l10n.format_value('your-rank', {'pos': 3})
'You finished 3th'
>>> l10n.format_value('your-rank', {'pos': 5})
'You finished 5th'
>>> l10n.format_value('your-rank', {'pos': 21})
'You finished 21th'
>>> l10n.format_value('your-rank', {'pos': 22})
'You finished 22th'
>>> l10n.format_value('your-rank', {'pos': 23})
'You finished 23th'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant