标签:xgettext python internationalization
我正在国际化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
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。