1

我正在使用 pootle 来允许人们在 PHP Yii 项目中翻译 .po 文件。

一旦翻译者更新了 .po 文件,Pootle 就可以拉取和推送翻译。另外,我们有开发人员在网站上工作,他们也可能会更新翻译文件以添加更多要翻译的文本。

Yii 要求 .po 文件位于:

yii-project/protected/messages/en_gb/messages.po

Pootle 要求目录结构为:

pootle/yii-project/en_GB/messages.po

为了让 pootle 拉和推,.git 目录需要在 pootle/yii-project/.git 中。

我曾尝试使用 git sparse checkout,但这会将文件拉入 pootle/yii-project/protected/messages/en_gb/messages.po 不幸的是 pootle 没有收到。

我无法在其他地方提取存储库然后进行软链接,因为那时 pootle 将无法找到 .git 目录。

我真正想做的是一个目录的稀疏检出并将结果映射到另一个目录,即检出:

pootle/yii-project/protected/messages/ -> pootle/yii-project

我不想使用 git-subtree,因为我希望开发人员或翻译人员能够更新文件。我不想使用子模块,因为我不喜欢额外的拉动开销,我们希望开发人员在一次提交中包含与新功能有关的所有更改(而不是在主项目上的一次提交和一个在子模块上)。

有什么建议么?

4

1 回答 1

0

我们找不到使用 git sparsecheckout 的解决方案。

相反,我们使用了子模块。

我们首先提取了 yii-project/protected/messages 目录,并创建了一个名为 yii-project-translations 的新存储库。

然后我们将包括翻译在内的每个目录都小写 - 例如:

git mv en_GB en_gb

然后我们将新的存储库作为子模块包含回原来的 yii-project 中:

cd yii-project/
git subtree split --prefix=protected/messages --branch=yii-project-translations
cd protected/
git rm -rf ./messages
mkdir messages
pushd messages
git init
git remote add origin git-server:yii-project-translations
git pull ../../ yii-project-translations
git push origin -u master
popd

并将此存储库克隆为 pootle 项目:

cd $POOTLE_HOME/translations/
git clone gitolite@git.algo.travel:yii-project-translations yii-project

最后,我们将 pootle 数据库中的几个表更新为小写目录名,所以一切都很好地联系在一起:

update pootle_app_language set code = lower(code);
update pootle_app_directory set pootle_path = lower(pootle_path);
update pootle_app_translationproject set real_path = lower(real_path), pootle_path = lower(pootle_path); 

@michal-cihar - Weblate 看起来很棒。如果我在我们沿​​着 pootle 路径获得 90% 之前遇到它,我会使用它。谢谢!

于 2013-01-03T14:47:33.130 回答