ruby-gettext / gettext

Gettext gem is a pure Ruby Localization(L10n) library and tool which is modeled after the GNU gettext package.
https://ruby-gettext.github.io/
69 stars 28 forks source link

Purpose of the edit.po file #47

Closed ayoub-belarbi closed 8 years ago

ayoub-belarbi commented 8 years ago

Thanks to Kouhei's help, I now understand perfectly the purpose of the edit.po files:

It's for reducing needless changes from repository. The needless changes are location changes such as: "#: .../a.rb:29" -> "#: .../a.rb:30". These changes are needless for version control but these changes are very useful on translation. So I introduced edit.po. edit.po (not version controlled) include them but po (version controlled) doesn't include them. By the split, we can exist together "easy to translation by location information" and "reducing needless changes from repository".

So I'm using this gem in an a opensource project with a lot of legacy code, of course in addition to the gettext_i18n_rails and fast_gettext. Usually when we change something in the code we create a pot file and submit that to the translation team. Except this time, only the line numbers changed not the translated text itself, so I noticed that both the generated po and edit.po files contain the original text, the translated text and the right line numbers!

My question is: how is this possible? Not only the gem figured out the correct line numbers, but also it matched the original text with the old translation! Does the gettext:find uses the old po files for generating the new one?

Thanks!

kou commented 8 years ago

Does the gettext:find uses the old po files for generating the new one?

Yes.

how is this possible?

Does the following code describes about it?

https://github.com/ruby-gettext/gettext/blob/master/lib/gettext/tools/task.rb#L361-L377

ayoub-belarbi commented 8 years ago

Thank you for your response. Very helpful !

kou commented 8 years ago

It's good. Can we close this issue?