3 ms·
This is a nice simplistic implementation for basic apps but could lead to a painful rewrite if you start integrating languages with significantly different gram
by STRML 11y ago
This is a nice simplistic implementation for basic apps but could lead to a painful rewrite if you start integrating languages with significantly different grammar constructs than your home language.
If you're really serious about internationalization you need to use a more complete solution like FormatJS[1], which has a really nice React implementation[2].
1. http://formatjs.io/ http://formatjs.io/
2. http://formatjs.io/react/ http://formatjs.io/react/
- BenjaminCoe 11y agoAgreed, yargs (the CLI app that this was built for) has very basic requirements -- there are only a few dozen strings in the entire codebase. Having said this I did make an effort to learn from prior work in the area, basing the library on: https://github.com/mashpie/i18n-node https://github.com/mashpie/i18n-node A friend of mine who did a thorough literature review at PayPal also advocated formatjs.io -- although I think this is a little bit too much power for little old yargs.