- #POEDIT ADDING ENTRY UPDATE#
- #POEDIT ADDING ENTRY PRO#
- #POEDIT ADDING ENTRY CODE#
- #POEDIT ADDING ENTRY DOWNLOAD#
The installation is super simple, just Terms and no options.
#POEDIT ADDING ENTRY PRO#
Poedit is open source (there’s a Pro version you can use to hook into online services) and free to use for commercial purposes.
#POEDIT ADDING ENTRY DOWNLOAD#
Not quite what you originally wanted but as close as you can get.One handy tip I was given by Gregory Alekseev over on Twitter was to use Poedit ( Download here) to edit my translation files. You can also omit the argument to -add-comments and extract all comments that immediately precede keywords.
![poedit adding entry poedit adding entry](http://guide.ttbtamer.com/wp-content/uploads/2018/10/single-entry-dialog.jpg)
You can exchange "TRANSLATORS:" with a string of your choice.
![poedit adding entry poedit adding entry](https://wiki.rosettacnc.com/_media/en/software/mdurosettacncsoftware/poedit_004.png)
The option -add-comments=TRANSLATORS: has the effect that it adds comments that immediately precede a keyword iff that comment starts exactly with the string "TRANSLATORS:". Now invoke xgettext like this: xgettext -add-comments=TRANSLATORS: -keyword=_ex so.php You can kind of achieve the desired result by changing your sources to this: The X-POEdit-KeywordsList seems to be a custom header used by POEdit. You can only specify which arguments are the singular, the plural, or the message context. The above command-line translates to "extract the first argument all all calls to _ex() as the msgid, and always add the comment 'my comment' to the PO entry". Unfortunately, this is not what you want. If used correctly, PoEdit (already the free version of it) can save you a lot of time!Īn example for the keyword spec (bourne shell syntax!) is: xgettext -keyword='_ex:1,"my comment"' so.php It took me some time to figure all of this out, and I would have saved tons of hours if I knew all of this from upon the beginning, so I wanted to share this here.
#POEDIT ADDING ENTRY UPDATE#
Then, in all of your PO files, you simply hit update from POT-File in PoEdit, and it will correctly update all of your translations, including all of the comments for translators, which will all be drawn from the POT file directly too (so you better write these translator comments in a language that all of your translators most likely understand). pot file, everytime when you update your translations.
![poedit adding entry poedit adding entry](http://cmsaddons.net/wp-content/uploads/2017/12/wordpress-taxonomy-generator.png)
#POEDIT ADDING ENTRY CODE#
Set all of your keyword extractors and / or comment identifier string, then extract from your source code into your. Change that for example to mysamplecommentkey, and write a translation like this in your PHP code, for example: /* mysamplecommentkey: This is a test */Īnd your "Translate Me" will have the This is a test comment attached to it when extracting from the source code.Īnd, just another point: You should rather use a POT instead of a PO template file for your gettext localizations in PoEdit. Normally the first field there should tell you the current string being used as comment identifying tag. To change the default comment identifier in PoEdit, simply go to Translation -> Properties -> Click on "Advanced Extraction Preferences" under de "Translation Properties" tab of the window which then pops up. Where %o %C %K %F are the respective placeholders, for example %o for the output filename, %K for the keyword list (you specify in POEdits keyword mask), etc. Xgettext -L PHP -add-comments=TRANSLATORS: -force-po -o %o %C %K %F This can actually be seen if you open PoEdit -> Preferences -> Extractors, then click on the little "+" button at the bottom left of the window, which will show you the command PoEdit fires by default for an extraction of your translation strings from the source file, which is sth like: I just came across this post because I was also looking for a way to do this, and just wanted to add that Roointans' solution works because PoEdit uses the TRANSLATORS: tag as default tag for comment extraction via gettext.