xgettext 和 xgettext 的字符集问题消息合并
我正在尝试编写一个脚本来从我的源文件创建 .po 文件将其与现有的合并,这样我就不必每次更新网站时都重做翻译。
我的脚本基于这篇博客文章 http://www.lxg.de/code /playing-with-xgettext
这是我正在尝试运行的内容:
#!/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 字符串 &无效的多字节序列。
感谢您的帮助
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.
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
The problem is with the msgmerge command, It complains about non ascii strings & invalid multibyte sequence.
thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的翻译人员忘记正确填写
Content-Type
标头。Your translator forgot to fill in the
Content-Type
header properly.