-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat(locales): spanish support added #1105
Conversation
Support for Spain and Mexico. Issue: Optimized for currencies, numbers ending in 1 are showed as "Un" instead of "Uno"
Replace "One Dollars Only" for "One Dollar Only". It works for al amounts equals to 1
Thank you for your contribution @ohmmolina. There are a few failing tests. Please have a look at them. |
@mastermunj I'm not sure how to go about this, while I don't speak Spanish (I'm learning bit by bit) I do need this for a project, and because this PR seems to have gone stale, I went ahead and fixed the remaining issues which is downstream here. I don't mean to steal credit from @ohmmolina (they're still credited as the author of the brunt of the work: s1gtrap/to-words@0ec0204), but should I submit a new PR? The primary addition is the notion of a 'trailing' word. According to point 2.2 of 'uno' in Diccionario panhispánico de dudas describing cardinals:
I.e. 'uno' immediately prior to a masculine noun (such as millon, billon and trillon) is shortened to 'un', hence the only case when it should be 'uno' is when it's the last word (this doesn't account for feminine substantives, but it's my impression that gender is out of scope of this library). Obviously this is a bit awkward with the recursion, but I believe I solved it by passing If there is a better solution that didn't occur to me please let me know and I'd be down to try and fix it in such a manner instead as this only further complicates the algorithm, but I did have a look at French (as that's the only other romance language) but didn't have much luck since one is literally just 'un' everywhere. |
Hi, @s1gtrap. Thank you for your interest about my language. The main reason why this PR is not acepted, is not because of Spanish, but because I can't found a way to define how to not use plurals when the number to convert is just one. In USD, for example, it shows "One Dollars Only", but should shows "One Dollar Only". Anyway, you should made another PR. Let me know when you do and I would close this one. |
Thank you @ohmmolina and @s1gtrap. Your contributions are well appreciated! |
Support for Spain and Mexico.
Issue: Optimized for currencies, numbers ending in 1 are showed as "Un" instead of "Uno"