我不是Python或gettext utilities方面的专家。我有一个Django项目,其中我在应用程序中有几个模块。我需要为每个模块维护单独的.po转换文件,这些模块将在time部署中合并。例如,在django-cms-2模块旁边有一个Dictionary模块,我希望这两个模块有不同的.po文件(比如dict.po和django-cms-master.po)。然后,我将使用来自gettext和Django的msgmerge和compilemessages来创建最终的django.mo文件。对于我需要的东西,有什么解决方案吗?
发布于 2011-09-06 19:58:14
下面是我将locale/LOCALE_CODE/下的多个.po文件合并到locale/LOCALE_CODE/LC_MESSAGES/django.po中的快速技巧
#!/bin/bash
# quick hack to merge all .po-files found under ./locale/LOCALE/
# to a django.po-file and then compile the django.po to django.mo
for l in locale/*
do
bn=$(basename $l)
echo "translating locale $bn"
cat $l/*.po > $l/LC_MESSAGES/django.po
python manage.py compilemessages -l $bn
donehttps://stackoverflow.com/questions/3198691
复制相似问题