-
Notifications
You must be signed in to change notification settings - Fork 7
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
RBNF Number Formats in Messages #11
Comments
The ICU Messages documentation recommends that complex arguments be formatted outside the message itself:
However I have also implemented the functionality you're after per the examples below. Note the iex> Cldr.Message.format("{ordering,number,:spellout_ordinal} jab date", ordering: 1)
{:ok, "first jab date"}
iex> Cldr.Message.format("{ordering,number,:ordinal} jab date", ordering: 1)
{:ok, "1st jab date"}
# `ordinal` is "well known" and therefore does not require the `:` before it
iex> Cldr.Message.format("{ordering,number,ordinal} jab date", ordering: 1)
{:ok, "1st jab date"} There was a bug in this part of the code though which is fixed in commit 7ae3d02 so you'll need to |
Note that given the grammatical gender requirements (which the message format does not cater for) I suspect you will be better off formatting the number outside the message format in this example. |
I have been contemplating whether there is a way to normalise RBNF formatting using grammatical case and gender. And thereby derive the right rule name. It can't be a complete solution but it should simplify a lot of formats - like your example. Most of the rules have a standard structure:
Do you know what the |
Awesome, I will try that 😊
The issue with that is, that I do not know the grammatical gender outside of the translation. (We will have many translations that are done independently from the code.)
The rule names in german are weird. The letter at the end specifies with what letter the spelled out word ends. It’s a mix of gender and case. Heres a few tables detailing it for the word first: https://m.korrekturen.de/flexion/deklination/Erste/ I get now why people think german is complicated 😅 |
Actually, that left out Erstem. Heere is a complete table: https://de.m.wiktionary.org/wiki/Flexion:erste |
As of this commit in To make this work I will need to refactor some function from Thoughts, comments and suggestions most welcome. |
@kipcole9 This sounds nice, then people will not have to lookup those rule names that are somehow different in every language. I don’t get though, what this has in common with this issue. How would this help with the problem? |
@kipcole9 Do you have an idea what could be the problem here?
|
I have published ex_cldr_messages version 0.13.1 to fix this issue (and the bug related to RBNF formats). The changelog entry is: Bug Fixes
|
@kipcole9 Thanks :) Do you know what the reason for this is?
(same translation as before) |
My apologies, I have fixed this properly now and added additional tests. The issue arose because you have no I have published ex_cldr_messages 0.13.2 with the fix. |
How can RBNF number formats be used in ICU messages? Example:
{ordering,number,spellout_ordinal_r} Impfungstermin
withnumber: 1
should outputErster Impfungstermin
in localede
.(Same for
spellout_ordinal_feminine
infr
,spellout_ordinal_r
inde
etc.)I would like to replace this monstrosity: /~https://github.com/jshmrtn/hygeia/blob/main/lib/hygeia_web/live/person_live/vaccination.sface#L21
The text was updated successfully, but these errors were encountered: