retoo / ruby_gettext_extractor

Alternative gettext parser for ruby files
MIT License
4 stars 2 forks source link

Extract class names, fields, etc #3

Open pupeno opened 14 years ago

pupeno commented 14 years ago

The original ruby gettext extractor also extracted fields and database names as translatable strings because they find their way into views quite often. Is it possible to add that to this extractor too?

retoo commented 14 years ago

I use the 'store_model_attributes' task of Michael Grossers gettext/rails integration plugin: http://github.com/grosser/gettext_i18n_rails

This generates a file local/model_attributes.rb which contains all model names and attributes. I like this method as I can regenerate this file whenever I know there are new attributes (and therefore it doesn't slow down the usual gettext:find rake tastk)

What do you think about this approach?

Cheers, Reto

pupeno commented 14 years ago

I don't like generating source code for a side effect, that is never going to be executed. But on the other side, I can also see why that way could be seen as cleaner.

At any rate I believe the real issue is that I solved a problem that was already solved because using gettext involves picking pieces from many different locations, finding out about those pieces and combining them carefully. I believe there should be a more ready-to-work gettext solution (and I wish to work on that, I just don't have the time, yet).