poedit

Using POEdit — only search for strings in specific domain

↘锁芯ラ 提交于 2019-12-01 17:55:33
I have created a WordPress theme that I wish to translate. Inside my theme I use some translations from woocommerce (i.e. <?php _('Your cart', 'woocommerce'); ?> ). Theese woocommerce strings, I do not wish to translate again, naturally, as they are already translated. But when I use poedit to scan my theme, of course it will find ALL text domains. So my question is: How can I tell POEdit to only pick up only strings in a specific text domain? __('Something', 'my-text-domain') _e('Something else', 'my-text-domain') I have found this answer: How to get (translatable) strings from specific

Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit)

南楼画角 提交于 2019-12-01 17:49:42
I checked MSDN and the locale string is zh_Hant, but I also tried with zh_TW (Chinese, Taiwan). The traditional Chinese characters look OK in the poEditor, but when I open the file in the browser the characters are just weird symbols («¢Åo¥@¬É!). I think the translation is working, but there's something wrong with the encoding (I used UTF-8 for both Charset and Source Code Charset). The files generated with poEditor: messages.po: msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-15 16:26+0800\n" "PO-Revision-Date: 2010-02-15 16:26+0800\n" "Last

Using POEdit — only search for strings in specific domain

蹲街弑〆低调 提交于 2019-12-01 16:19:48
问题 I have created a WordPress theme that I wish to translate. Inside my theme I use some translations from woocommerce (i.e. <?php _('Your cart', 'woocommerce'); ?> ). Theese woocommerce strings, I do not wish to translate again, naturally, as they are already translated. But when I use poedit to scan my theme, of course it will find ALL text domains. So my question is: How can I tell POEdit to only pick up only strings in a specific text domain? __('Something', 'my-text-domain') _e('Something

poedit workaround for dynamic gettext

荒凉一梦 提交于 2019-12-01 04:50:17
I have started using gettext for translating text and messages i send to user. I am using poedit as an editor, but i am struggling with dynamic messages. For example i have things like the login where i have a variable that tells the type of error. $this->translate('page-error-' . $error); When i auto update from poedit this gets read like "page-error-". What i do is have a file where i place dummy calls to the translate method with all the possible keys to have them added in my poedit when auto updating. I don't particularly like this situation. How do you guys do it. Thanks for your ideas No

How to load language with gettext in PHP?

淺唱寂寞╮ 提交于 2019-11-30 10:03:21
I have created a language file in poedit for the use of the PHP gettext function, now on the page I am trying to test it on, I cannot get it to find/load the .po or .mo file I created, does anyone see what I am doing wrong? $locale = "en_US"; putenv("LC_ALL=$locale"); setlocale(LC_ALL, $locale); bindtextdomain("default", "/includes/locale"); textdomain("default"); //my .po ad .mo file is located here /includes/locale/en/default.mo Even though I am trying to load the default english lang file, I have changed some text in the file to make sure it is reading from a language file and currently it

How to run or load .po/.mo files for localization in php

冷暖自知 提交于 2019-11-30 07:42:30
问题 I have installed poedit and running my file through it, it creates .po and .mo files for them. But I have a problem to load and use these files for translating my text. I don't know how to load or open the translated files and to show the translated content. Can anyone help me about this. I tried every possible source but not succeeded. 回答1: First of all you need to inform PHP which locale and domain you are using. putenv("LANG=da_DK"); setlocale('LC_ALL', "da_DK"); bindtextdomain("mycatalog"

POEdit doesn't extract string in HTML tags

◇◆丶佛笑我妖孽 提交于 2019-11-29 20:06:53
问题 I'm having a problem with Laravel's blade templating syntax. When having something like: <input placeholder="{{ __('My Tooltip') }}" /> that string won't be founded by POEdit. But on same file if I had this: <span>{{ __('My Tooltip') }}</span> that's OK. I've already added a new extractor with follow configs but the problem persists. Command: xgettext --language=Python --add-comments=TRANSLATORS: --force-po -o %o %C %K %F An item in keywords list: -k%k An item in input files list: %f Source

How to run or load .po/.mo files for localization in php

社会主义新天地 提交于 2019-11-29 05:21:37
I have installed poedit and running my file through it, it creates .po and .mo files for them. But I have a problem to load and use these files for translating my text. I don't know how to load or open the translated files and to show the translated content. Can anyone help me about this. I tried every possible source but not succeeded. Mark Hünermund Jensen First of all you need to inform PHP which locale and domain you are using. putenv("LANG=da_DK"); setlocale('LC_ALL', "da_DK"); bindtextdomain("mycatalog", "./locale/"); textdomain("mycatalog"); In this case I'm having a Danish translation

How to get (translatable) strings from specific domain with POEdit

有些话、适合烂在心里 提交于 2019-11-29 05:10:46
I have been trying for hours finding a way to setup POEdit so that it can grab the text from specific domain only My gettext function looks like this: function ri($id, $parameters = array(), $domain = 'default', $locale = null) A sample call: echo ri('Text %xyz%', array('%xyz%'=>100), 'myDomain'); I will need to grab only the text with the domain myDomain to translate, or at least I want POEdit to put these texts into domain specific files. Is there a way to do it? I found several questions that are similar but the answers don't really tell me what to do (I think I'm such a noob it must be

How to make PoEdit correctly parse custom “ngettext” implementation?

冷暖自知 提交于 2019-11-29 04:51:09
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); But that doesn't work at all, PoEdit picks nothing at all. I also tried: _e('%d house', '%d houses', 5); 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