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

Wrong spellout cardinal for et locale #6

Closed
ragulka opened this issue Dec 13, 2013 · 4 comments
Closed

Wrong spellout cardinal for et locale #6

ragulka opened this issue Dec 13, 2013 · 4 comments

Comments

@ragulka
Copy link

ragulka commented Dec 13, 2013

console.log(inter.renderSpelloutCardinal(2439871));

Gives: üks miljonit nelisada ükskümmend üheksa tuhat kolmkümmend üks

The above result is totally messed up. It should say:
kaks miljonit nelisada kolmkümmend üheksa tuhat kaheksasada seitsekümmend üks

Basically, translated to english, it is currently saying:
One millione four-hunderd onety-nine-thousand thrity-one

I guess there must be a serious flaw in the cardinal function generator.

@ragulka
Copy link
Author

ragulka commented Dec 13, 2013

FWIW, here are some more errors that I stumbled when trying it out.

var inter = require('inter').load('fr_be');
console.log(inter.renderSpelloutCardinal(2439871));

Results in:

TypeError: Cannot call method 'charCodeAt' of undefined
    at subformatFixed (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/root.js:175:121)
    at format (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/root.js:350:84)
    at Object.(anonymous function) [as renderNumber] (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/root.js:573:162)
    at Object.inter.renderSpelloutCardinal (/Library/WebServer/Documents/node_projects/test_inter/node_modules/inter/build/fr_be.js:856:33)

The following:

var inter = require('inter').load('fr');
console.log(inter.renderSpelloutCardinal(2439871));

Results in:

2 439 871

@papandreou
Copy link
Owner

Thanks for taking the time to submit these issues. Some of them are certainly caused by me rushing the update to CLDR 24 without realizing that there were major changes. I'm really sorry about that. I managed to fix some of the problems, but I haven't released a new version yet, because I started writing tests and realized that more stuff is broken.

I hope I'll find the time to get the project into a good state soon. Thanks for you patience.

@ragulka
Copy link
Author

ragulka commented Dec 15, 2013

That's okay. I was simply playing around. I do hope I can evaluate your lib for an app that I am building, where i18n is a big must.

@papandreou
Copy link
Owner

Seems like these are now fixed in inter 1.2.3, which will be released shortly (updates cldr to 2.1.1).

Apparently the correct name for that spellout rule is spelloutNumbering, not spelloutCardinal. Seems like spelloutCardinal only exists as a helper function in some locales as of some CLDR update.

require('inter').load('fr_be').renderSpelloutNumbering(2439871);
// 'deux millions quatre cent trente-neuf mille huit cent septante-et-un'

And for fr:

require('inter').load('fr').renderSpelloutNumbering(2439871);
// 'deux millions quatre cent trente-neuf mille huit cent soixante-et-un'

Better?

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

2 participants