Hacker News new | past | comments | ask | show | jobs | submit login
Internationalization made easier with static analysis (glebm.com)
26 points by glebm on Feb 27, 2014 | hide | past | favorite | 6 comments

I don't understand the importance of this gem: isn't this what gettext/Poedit helps you with? Not to be too negative here, I am just wondering how this actually works with Ruby. I am not familiar with the availability of gettext for Ruby, but the two issues can be negated with gettext/Poedit, as far as I know:

> If you use a key that does not exist, this will only blow up at runtime.

Using Poedit scans automatically your source and imports all missing translation keys. It's just a simple step you have to be aware of when dealing with translations.

> Keys left over from removed code accumulate in the resource files, introducing unnecessary overhead on the translators.

Again, Poedit scans your source and also removes all unused keys.

We're using Poedit for ages and never had troubles with missing keys or orphaned keys. Just use it every time you deal with translations. The only issue you have with Poedit is you cannot translate variables, only strings, but this seems to be the same with i18n-tasks?

Poedit looks great, but different from what i18n-tasks offers.

i18n-tasks is on the command line, easily extensible, with configuration that can be easily tailored to the app from data layer to usage search. It is also very easy to integrate it into the test suite.

The default data adapter supports YAML and JSON by default, more common in many web communities (rails, node) than .po.

I'd prefer static analysis that extracts strings from calls like t("Check out our Jobs page {{url}}!") and auto-populates the appropriate locale files/databases, etc. Referencing keys all over the place seems like a poor substitute to just writing the content in a natural way and having the tools do the heavy lifting for you. For instance, I know that Twitter and Facebook both handle I18N content in such a way, and you can see the text-strings that they use in the translation dashboards.

There's also a good technical overview of Facebook's I18N framework here: https://www.quora.com/Facebook-Internationalization/What-was... .

My first observation is that in most of the apps I've worked on keys are composed by constructs such as `t :"something_#{from_the_context}"`, which I assume this tool will miss. I'd much rather see a tool that tracked i18n hits in a k/v store, and used that in addition to the static analysis.

Don't let this discourage you, your work looks great (props on the correctly tabulated output!) - but it would never work for me in what I think is a reasonable usecase :(

Such keys are supported to a certain extent (e.g they won't be reported as unused). A runtime tool that tracks runtime misses to the store is a part of ruby i18n gem and many other environments already. I have found such keys to constitute a minority in most projects I've worked on.

Great work, Gleb! This is in my top ten list of the best gems out there. We are using it on itbyen.no and it does the job really good.

Keep shipping!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact