forzagreen / n2words

Convert numerical numbers to written numbers, in 25+ languages.
MIT License
87 stars 22 forks source link

feat: add support for fr-BE #126

Closed victortaleb closed 1 year ago

victortaleb commented 1 year ago

Summary

In Belgium, we don't say "soixante-dix" or "quatre-vingt-dix" but "septante" and "nonante".

Potential improvements

forzagreen commented 1 year ago

Hi @victortaleb , thanks for the contribution. Indeed this is a very interesting topic.

👍 OK for the country code as 2 capital letters, which is compliant with ISO 3166-1 alpha-2.

I'm still thinking on how to represent the feature. 2 options are possible:

  1. Your suggestion with {region: 'BE'} (or {country: 'BE'})
  2. Appending the region name after the language code, as fr-BE or fr_BE. This is the approach used by our cousin package num2words (python equivalent): _You can supply values like frFR; if the country doesn't exist but the language does, the code will fall back to the base language (i.e. fr).
victortaleb commented 1 year ago

Option 2 would probably be better if there are languages with significantly different dialects.

Here is an implementation. To keep things DRY, I kept the region option but prefixed with an _ to show that it should only be used internally. I went with fr-BE as I never saw fr_BE before. Feel free to change it if you want to.

forzagreen commented 1 year ago

That's great @victortaleb . Thank you for your contribution !

forzagreen commented 1 year ago

Released in v1.18.0 🎆