Skip to content
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

spelloutCardinal stopped working in a lot of languages #145

Closed
rotsee opened this issue May 24, 2021 · 1 comment
Closed

spelloutCardinal stopped working in a lot of languages #145

rotsee opened this issue May 24, 2021 · 1 comment

Comments

@rotsee
Copy link
Collaborator

rotsee commented May 24, 2021

Since one of the latest releases, renderSpelloutCardinal no longer works for many languages

> cldr.extractRbnfFunctionByType("en").renderSpelloutCardinal(5)
'five' // OK
> cldr.extractRbnfFunctionByType("ja").renderSpelloutCardinal(5)
'五' // OK
> cldr.extractRbnfFunctionByType("es").renderSpelloutCardinal(5)
'5' // Expected 'cinco'
> cldr.extractRbnfFunctionByType("sv").renderSpelloutCardinal(5)
'5' // Expected 'fem'

Furthermore, in some languages, we now get an error:

> cldr.extractRbnfFunctionByType("ru").renderSpelloutCardinal(5)
Uncaught Error: Numeric literal whose value is NaN
    at generateNumber (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:270:19)
    at CodeGenerator.Literal (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:2360:24)
    at CodeGenerator.generateExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:2496:28)
    at CodeGenerator.BinaryExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:1856:29)
    at CodeGenerator.generateExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:2496:28)
    at CodeGenerator.BinaryExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:1846:29)
    at CodeGenerator.generateExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:2496:28)
    at CodeGenerator.ConditionalExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:1821:26)
    at CodeGenerator.generateExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:2496:28)
    at CodeGenerator.BinaryExpression (/home/leo/newsworthy/textfunctions/node_modules/escodegen/escodegen.js:1846:29)

(not sure if these errors are related or not)

@rotsee
Copy link
Collaborator Author

rotsee commented May 24, 2021

Never mind, I was too quick. This is actually not supposed to work in current CLDR. You need to specify a gender, using e.g. cldr.extractRbnfFunctionByType("sv").renderSpelloutCardinalNeuter(5). I did not know that. Closing, but keeping this issue, in case someone else searches for a similar thing

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

No branches or pull requests

1 participant