DevinVinson / WordPress-Plugin-Boilerplate

[WordPress] A foundation for WordPress Plugin Development that aims to provide a clear and consistent guide for building your plugins.
http://wppb.io
7.67k stars 2.25k forks source link

Add gettext keywords, plural form and path #40

Closed grappler closed 11 years ago

grappler commented 11 years ago

I would have the top of the pot file like this.

You are missing the gettext keywords, the plural form and path.

msgid ""
msgstr ""
"Project-Id-Version: TODO 1.0.0\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/plugin-boilerplate\n"
"POT-Creation-Date: 2013-05-10 11:23:19+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2013-05-10 10:37-0500\n"
"Last-Translator: Tom McFarlin <tom@tommcfarlin.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"X-Generator: Poedit 1.5.5\n"
"X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;"
"esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n"
"X-Poedit-Basepath: ../\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-SearchPath-0: .\n"

If you wanted to top it off then you could add Text Domain: TODO like I mentioned in my comment. http://tommcfarlin.com/internationalize-wordpress-plugins/#comment-167129

GaryJones commented 11 years ago

+1 for these additions. If users use POEdit, then the POEdit reads these values and sets the project up, for rescanning, or creating .po files. If a different app opens this .pot, then it may ignore the X-Poedit headers, which is fine.

GaryJones commented 11 years ago

The Domain Path tag could also be added for completeness.

grappler commented 11 years ago

I think it has been added. b1d1566

GaryJones commented 11 years ago

No, that's the Text Domain header. The Domain Path header gives the relative path from plugin root to where language files are e.g. /lang/ .

grappler commented 11 years ago

I learnt something new today. What is the use of it?

http://codex.wordpress.org/File_Header#Plugin

GaryJones commented 11 years ago

It makes it easier for i18n tools, or something, to know where the .pot will go, and therefore what the base path value will be. Maybe. It has a default value, of /lang/ I think, or maybe /languages/, but it's easy enough to define it anyway.