本文介绍了xgettext&的字符集问题msgmerge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个脚本,以根据我的源文件&将其与现有网站合并,这样我每次更新网站时都不必重做翻译.
I'm trying to make a script to create a .po files from my sources files & merge it with the existing one so I don't have to redo the translation every time I update my website.
我将脚本基于此博客文章 http://www.lxg.de/code/playing-with-xgettext
I'm basing my script on this blog post http://www.lxg.de/code/playing-with-xgettext
这就是我要运行的内容:
Here is what I'm trying to run :
#!/bin/bash
if [ $# -eq 1 ]
then
if [ -d "./locale/$1" ]
then
echo '' > "./locale/$1/msg_tmp.po"
find . -type f -iname "*.php" | xgettext -j --from-code="utf-8" -o "./locale/$1/msg_tmp.po" -f -
msgmerge -N "./locale/$1/msg.po" "./locale/$1/msg_tmp_iconv.po" > "./locale/$1/msg_new.po"
mv "./locale/$1/msg_new.po" "./locale/$1/msg.po"
rm "./locale/$1/msg_tmp.po"
rm "./locale/$1/msg_tmp_iconv.po"
else
echo The directory locale/$1 does not exist
fi
else
echo Locale not specified
fi
问题出在msgmerge命令,它抱怨非ascii字符串&无效的多字节序列.
The problem is with the msgmerge command, It complains about non ascii strings & invalid multibyte sequence.
感谢您的帮助
推荐答案
您的翻译忘了正确填写 Content-Type
标头.
Your translator forgot to fill in the Content-Type
header properly.
这篇关于xgettext&的字符集问题msgmerge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!