views:

14

answers:

1

At present I am working with a cakephp solution (closed source unfortunatelly) and noticed sometimes that a string won't be translated even if it has msgid entry in the po file. I realized that this happens if the source reference is not in the entry. If I type in a source reference to that string, or remove all source references from an entry it will be translated.

To test this I made a small cakephp app with translatable strings (using the __() function) but I can't get the same behavior.

e.g.:

#: /views/view1/add.ctp:6
#: /views/view1/edit.ctp:6
#: /views/view2/add.ctp:5
#: /views/view2/edit.ctp:5
msgid "Name"
msgstr "localized name string"

App1: If I remove view1 references than no translation happens for that locale for view1, but view2 works translated. If I remove all references both work.

App2 (my test): references has no affect, all translated

How it could be? I am using theming in the first app and the strings are vary depending on the theme. Could this cause such behavior?

Other question: what is the best practice to insert new strings in the po files if I make any new one in the views? I can extract a new empty pot, it is ok, but always search the po files and insert the ones manually is very time consuming. There should be a better automatic way what I could not find. The GNU/gettext manual is too complicated for me to understand the process of this :(

A: 

I always use poedit - http://www.poedit.net/ - it's the best of the bunch, but still not great. Setting it up can be very confusing, but persevere.

It will manage the references and generate the mo (binary) files for you.

I use it on Mac and Ubuntu, and have used it in the past on Windows.

Leo
Thanks for the tip for a good po editor, but it is not an answer for either question. Anyway, quite useful :)
sipiatti