python复数的表达形式_python-将复数形式生成到.pot文件中

我正在国际化python程序,并且无法将复数形式放入.pot文件中.我用_pl()标记了需要复数翻译的字符串.

self.write_info(_pl(“已检查%(num)d条轨道”,“已检查%(num)d条轨道”,

song_obj.song_count)%{“ num”:song_obj.song_count})

然后我在跑步:

xgettext –language = Python –keyword = _pl –output = output.pot * .py

在pot文件中仅生成第一个(单数)字符串.

解决方法:

我还没有在Python上使用它,并且目前无法测试,而是尝试–keyword = _pl:1,2.

从GNU gettext docs:

–keyword[=keywordspec]’

Additional keyword to be looked for (without keywordspec means not to use default keywords).

If keywordspec is a C identifier id, xgettext looks for strings in the first argument of each call to the function or macro id. If keywordspec is of the form ‘id:argnum’, xgettext looks for strings in the argnumth argument of the call. If keywordspec is of the form ‘id:argnum1,argnum2’, xgettext looks for strings in the argnum1st argument and in the argnum2nd argument of the call, and treats them as singular/plural variants for a message with plural handling.

标签:xgettext,python,internationalization

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值