문제

After running django-admin.py makemessages -l de in Django to create the translation files, you could use a plain text editor or Poedit to fill them out.

Poedit has the advantage that it provides a specialized UI for entering this data. However I keep getting an error message when I switch between the words:

MyBookmarks/locale/de/LC_MESSAGES/django.po:7: header field `Project-Id-Version' still has the initial default value

What is this? Has anyone with knowledge of internationalization in Django or general users of po / GNU gettext came across this error message?

Many Thanks,

도움이 되었습니까?

해결책

I guess Django leave the header of the .po file customizable by the user, so is up to you to substitute "PACKAGE VERSION" with something more descriptive like "MY FABULOUS APP v.1.0".

To do that on any relevant file in a given path, you can use this command from the command line and in a *nix environment (or anywhere sed and find are available)

find <YOUR_PATH_HERE> -type f -name '*.po' -exec sed -e s'/PACKAGE VERSION/<YOUR_APP_NAME> <YOUR_APP_VERSION>/g' -i.bak {} \;

the command will replace the aforementioned text in every .po file and will save also an unmodified, backup file of each one.

So, in your case the command will be:

find MyBookmarks/ -type f -name '*.po' -exec sed -e s'/PACKAGE VERSION/MyBookmarks v.1.0/g' -i.bak {} \;

I routinely include this command in my fabfile and it solves the issue using POedit 1.5.x (but should work also on previous versions).

NOTE: You have to do that only once for every .po file. Next time you'll launch a ./manage.py makemessages Django will remember the setting.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top