kikito/i18n.lua

[proposal] add inflection and transformations

leite opened this issue · 1 comments

leite commented

Hi, nice lib.

I've been working with inflection (pluralize, singularize) and transformations (camelcase and snakecase),
wonder if i18n could support it?

I would be glad to help :)

Hi, thanks for stopping by!

inflection (pluralize, singularize) and transformations (camelcase and snakecase),

My point of view regarding libraries in Lua is that they should be very concise tools. They should do one thing and one thing only (just do it very well).

CamelCase and snake_case should definitively not be included in a i18n lib. Those belong into a "string utils" lib, which i18n is not.

Inflection could be part of i18n, but again I would rather create a separate project for that. If you are up for it, may I suggest naming it inflector.lua?

If you decide to build your own inflection library, I must warn you that i18n commits a particularly "big sin" - it relies in global state. I plan to change it soon, so it is an "instantiated library", and thus make it stateless. I recommend you do the same in yours. I have explained what this means in my blog.

For now, I am closing down this issue. Feel free to reopen/comment if you want!