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 来源: https://codeday.me/bug/20191210/2103303.html