inflex
inflex copied to clipboard
Suggestion for adding other languages support
Hi,
I'm interested to contribute in order to offer some sort of localization of the inflexions. Before going to add a particular language. I wanted to discuss for the "architecture" of handling the configuration of the locale setting.
I see three ways to do it internally with both a global default and an option to do it per function. But in any case, this needs to have all the inflexions mechanisms (I mean all the string manipulation and matching functions) separated from all the language related rules and data.
- Using the Elixir
Config
module and setting alocale
config value (eg. "en", "fr", etc.) - Using an optional key-value parameter (eg.
locale: "fr"
) in each function - Using a dedicated function that can be invoked at any time to set the locale from that moment on (not fan of that, but it's a possibility)
Another option could be to handle the localization setting itself outside with for example ex_cldr
. This needs an extra dependency, but it's possible to add it for those already using a package already using it (like ex_money
).
But in this case all the language related rules and data should still be done internally.
Again it's necessary in any case to separate the string manipulation mechanisms with the language data rules themselves. In this situation, it can be even possible to separate all the data as a separate package (or not).
What do you think?
i really like the idea!