xgettext

xgettext in OSX to create .po file from PHP code

↘锁芯ラ 提交于 2020-03-03 05:17:06
问题 I'm on Mac OSX, and I'm unable to find a good solution to parse PHP Code and extract the translatable strings. I've tried PoEdit, but it fail with an anti-verbose trunkated error: I've also tried Virtaal, but the app crash when I click "Open", event before the browsing windows appear. I've tried OmegaT, but I think it doesn't support .po files. I can't figure out how it works :( I've also tried xgettext.pl, and it work really well, except it doesn't detect the PHP dgettext() function, and

Translate variables with POEdit/xgettext

亡梦爱人 提交于 2020-02-05 08:33:33
问题 I am using PHP , Zend Framework and Zend_Translate (gettext adapter). To edit translations I use POEdit which utilizes xgettext to fetch strings to be translated. POEdit (xgettext) will search for keywords to find strings to translate. So, if searching for the keyword translate , POEdit will have no problem finding the 'Text to translate' string when the text is passed to the translate function directly like: echo translate('Text to translate'); But, in ofther cases strings will be passed to

How to generate a new .pot template from a translated .po file

余生颓废 提交于 2019-12-23 09:13:45
问题 Having started off with an incomplete gettext .pot file, the resulting .po translations file now includes a large number of translation strings that were not originally in the .pot file. How can I backwards generate a .pot file for other languages (strings with blank translation entries) from a translated .po file? Thanks for your help. 回答1: You can use something like this: msgfilter -i xx.po -o new.pot true msgfilter applies a program to all translations in a file, and true is just some

Recusive xgettext?

泪湿孤枕 提交于 2019-12-20 09:44:43
问题 How can I compile a .po file using xgettext with PHP files with a single command recursively? My PHP files exist in a hierarchy, and the straight xgettext command doesn't seem to dig down recursively. 回答1: Got it: find . -iname "*.php" | xargs xgettext I was trying to use -exec before, but that would only run one file at a time. This runs them on the bunch. Yay Google! 回答2: For WINDOWS command line a simpe solution is: @echo off echo Generating file list.. dir html\wp-content\themes\wpt\*.php

Extract translator comments with xgettext from JavaScript (in Python mode)

旧城冷巷雨未停 提交于 2019-12-12 08:54:00
问题 I have a pretty well-working command that extracts strings from all my .js and .html files (which are just Underscore templates). However, it doesn't seem to work for Translator comments. For example, I have this in one of my .js files: /// TRANSLATORS: The word "manual" stands for manual process gettext("manual"); Using the following command: find . -iname '*.html' -o -iname '*.js' | xargs xgettext --language=Python --from-code=utf-8 --keyword=pgettext:1c,2 --keyword=npgettext:1c,2,3 --add

PoEdit keywords - plurals

删除回忆录丶 提交于 2019-12-12 08:44:11
问题 I incorporated a gettext-like localization system in my app, but my translation function looks like this: t($category, $string, [$plural_string, $number, $vprintf_arguments]) My PoEdit keywords: t:2 t:2,3 t:2 tells PoEdit to parse $string , and it works apparently t:2,3 should tell PoEdit to parse both $string and $plural_string - but it's not :( It only sees $string , so I don't get the plural forms parsed... How can I fix that? I don't want to switch my function to a different argument

Can xgettext be used to extract specific domain strings only?

荒凉一梦 提交于 2019-12-10 10:25:17
问题 (Really surprised this isn't answered anywhere online; couple posts over the past few years with a similar question, but never answered. Let's hope the Stackoverflow crew can come to the rescue) Situation: When using gettext to support application localization, one sometimes wishes to specify a 'domain' with dgettext('domain', 'some text string'). However, when running xgettext , all strings wrapped with dgettext(...) are spit out into one file (default: messages.po). Given the following

Localization with django and xgettext

回眸只為那壹抹淺笑 提交于 2019-12-10 10:16:38
问题 I am working on translation of my site, but when I try to run command: manage.py makemessages --locale=bs I constantly get error like: CommandError: errors happened while running xgettext on rjsmin.py xgettext: Non-ASCII string at .\compressor\filters\jsmin\rjsmin.py:59. Please specify the source encoding through --from-code. What shell I do? 回答1: I have the same problem. At the top of the rjsmin.py, change the "- * - coding: ascii -*-" to "- * - coding: utf-8 - * -" 来源: https://stackoverflow

Localization with django and xgettext

偶尔善良 提交于 2019-12-06 02:13:17
I am working on translation of my site, but when I try to run command: manage.py makemessages --locale=bs I constantly get error like: CommandError: errors happened while running xgettext on rjsmin.py xgettext: Non-ASCII string at .\compressor\filters\jsmin\rjsmin.py:59. Please specify the source encoding through --from-code. What shell I do? I have the same problem. At the top of the rjsmin.py, change the "- * - coding: ascii -*-" to "- * - coding: utf-8 - * -" 来源: https://stackoverflow.com/questions/20955811/localization-with-django-and-xgettext

Can xgettext be used to extract specific domain strings only?

北城余情 提交于 2019-12-05 23:43:46
(Really surprised this isn't answered anywhere online; couple posts over the past few years with a similar question, but never answered. Let's hope the Stackoverflow crew can come to the rescue) Situation: When using gettext to support application localization, one sometimes wishes to specify a 'domain' with dgettext('domain', 'some text string'). However, when running xgettext , all strings wrapped with dgettext(...) are spit out into one file (default: messages.po). Given the following example: dgettext('menus', 'login link'); dgettext('menus', 'account link'); dgettext('footer', 'copyright