How to make PoEdit correctly parse custom quot;ngettextquot; implementation?(如何使 PoEdit 正确解析自定义“gettext执行?)
问题描述
我编写了一个 gettext 包装器,它使 l10n 的整个过程稍微简单一些,但不知何故,我无法让 PoEdit 正确识别和解析对该函数的复数版本调用.这是我最初拥有的:
I've coded a gettext wrapper that makes the whole process of l10n a little bit simpler but somehow I can't get PoEdit to correctly identify and parse plural version calls to the function. This is what I originally had:
_e(array('%d house', '%d houses'), 5);
但这根本不起作用,PoEdit 什么都不选.我也试过了:
But that doesn't work at all, PoEdit picks nothing at all. I also tried:
_e('%d house', '%d houses', 5);
这次 PoEdit 捕捉到 %d house 但不是 %d house 的复数形式,但是如果我尝试完全相同但使用 ngettext() 称它完美运行,单数和复数形式都被识别:
This time PoEdit catches the %d house but not the plural form of %d houses, however if I try exactly the same but with a ngettext() call it works perfectly, both the singular and plural forms are identified:
ngettext('%d house', '%d house', 5);
我已正确 (?) 将 _e 关键字添加到项目设置中,但它没有选择复数变体.我还注意到 PoEdit 只有 _、gettext 和 gettext_noop 作为默认的按键,没有任何参考ngettext、dngettext 或 dcngettext 函数,但它仍然可以正确接收 ngettext 调用...这让我想知道 PoEdit 是否对 ngettext 关键字进行了硬编码——那真的很难过.
I've correctly (?) added the _e keyword to the project settings, but it doesn't pick up plural variations. I've also noticed that PoEdit only has _, gettext and gettext_noop as the default keyworks to pick up, there is no reference whatsoever to the ngettext, dngettext or dcngettext functions but it can still correctly pick up the ngettext calls... This makes me wonder if PoEdit has hardcoded the ngettext keyword - that would be really sad.
无论如何,有没有办法让 PoEdit(或任何其他类似的应用程序)正确解析自定义函数?
Anyway, is there any way to make PoEdit (or any other similar app), correctly parse custom functions?
推荐答案
我找到了解决方案,关键字必须用以下表达式定义:
I've found the solution, the keyword has to be defined with the following expression:
_e:1,2
来源:http://osdir.com/ml/editors.poedit.user/2008-05/msg00012.html
这篇关于如何使 PoEdit 正确解析自定义“gettext"执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使 PoEdit 正确解析自定义“gettext"执行?
 
				
         
 
            
        基础教程推荐
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- php中的foreach复选框POST 2021-01-01
- 将变量从树枝传递给 js 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的PDF导出 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
				 
				 
				 
				