如何编写具有 LINGUAS 支持的 Gentoo ebuild 文件

发布于 2024-11-29 23:01:52 字数 585 浏览 4 评论 0原文

我想为一些二进制包编写一个ebuild,它包含一个不同语言的文件夹,其结构是:

ls /路径/po:

de  fr  ja  zh_CN  zh_TW

我觉得很容易做到,但是Gentoo提供的文档实在是有限,如何过滤掉不需要的语言文件呢?我不应该将所有这些复制到 /usr/share/locale 。

=================================================== ========

@Updates:

我发现了一个简单的方法,它检查 ${LANGUAS} 变量, 就像下面的代码:

insinto /usr/share/locale
for x in "${LANGUAS}";do
  if [[ -d "po/${x}" ]];then
    doins "po/${x}"
  else
    einfo "LANGUAGE $x is not supported by this app"
  fi
done

只是想知道这是否是官方方法。

I wanted to write a ebuild for some binary package , it contains a folder for different languages , its structure is:

ls /path/po:

de  fr  ja  zh_CN  zh_TW

I think it's easy to do it , but the document provided by Gentoo is really limited , how can i filter the unnecessary language files ? I shouldn't be copying all those to /usr/share/locale.

==========================================================

@Updates:

I discovered a simple method , which examines ${LANGUAS} variable ,
like the following code:

insinto /usr/share/locale
for x in "${LANGUAS}";do
  if [[ -d "po/${x}" ]];then
    doins "po/${x}"
  else
    einfo "LANGUAGE $x is not supported by this app"
  fi
done

Just wondering if it's official approach.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清欢 2024-12-06 23:01:52

没有官方的方法,因为它非常依赖于包。例如,某些包可能需要将附加参数传递给 ./configure,而其他包(例如您的包)则需要更多手动方法。

至于你上面的例子,我相信这是完全可以接受的。您尚未提供整个 ebuild,因此请记住您需要将可接受的语言添加到 IUSE 变量中。

例如,

LANGS="de fr ja zh_CN zh_TW"
for X in ${LANGS} ; do
    IUSE="${IUSE} linguas_${X}"
done

对于更复杂的示例,您可以查看 openoffice-bin ebuild

There isn't an official approach as it is very package dependent. For example, some packages may require additional parameters to be passed to ./configure while others, like your, require a more manual approach.

As for your example above, I believe it to be perfectly acceptable. You haven't provided the whole ebuild so just remember that you need to be adding the acceptable languages into the IUSE var.

e.g.

LANGS="de fr ja zh_CN zh_TW"
for X in ${LANGS} ; do
    IUSE="${IUSE} linguas_${X}"
done

For a more complicated example you could check out the openoffice-bin ebuild

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文