Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Django中管理单独的翻译文件(.po)_Django_Internationalization_Translation_Gettext - Fatal编程技术网

在Django中管理单独的翻译文件(.po)

在Django中管理单独的翻译文件(.po),django,internationalization,translation,gettext,Django,Internationalization,Translation,Gettext,我不是Python或gettext实用程序的专家。我有一个Django项目,其中我在应用程序中有几个模块。我需要为将在时间部署中合并的每个模块维护单独的.po翻译文件。例如,在django-cms-2模块旁边有一个Dictionary模块,我希望这两个模块都有不同的.po文件(例如dict.po和django-cms-master.po)。然后,我将使用msgmerge和compilemessagesfromgettext和Django创建最终的Django.mo文件。我需要什么,有什么解决办法

我不是
Python
gettext实用程序的专家。我有一个Django项目,其中我在应用程序中有几个模块。我需要为将在时间部署中合并的每个模块维护单独的
.po
翻译文件。例如,在
django-cms-2
模块旁边有一个
Dictionary
模块,我希望这两个模块都有不同的
.po
文件(例如
dict.po
django-cms-master.po
)。然后,我将使用
msgmerge
compilemessages
from
gettext
和Django创建最终的
Django.mo
文件。我需要什么,有什么解决办法吗

下面是我的快速技巧,可以将locale/locale\u CODE/下的多个.po文件合并到locale/locale\u CODE/LC\u MESSAGES/django.po中

#/bin/bash
#快速合并在./locale/locale下找到的所有.po文件/
#然后将django.po编译为django.mo
对于语言环境中的l/*
做
bn=$(基本名称$l)
echo“翻译语言环境亿美元”
cat$l/*.po>$l/LC_消息/django.po
python manage.py compilemessages-十亿美元
完成