Closed ntwb closed 10 years ago
Hi @ntwb,
If I have this right, you want to extract strings from the source directory and save the POT file in the build directory? Looking at the build tasks, it looks like the files are copied to the build directory before running makepot
, so is there any reason you don't want to extract strings from there instead? That's the way I originally envisioned it so that development files could be excluded.
mainFile:
This does highlight one issue: Ideally, the mainFile
config should be relative to cwd
, so I probably need to update that.
cwd:
This is an issue in WordPress' i18n tools. There isn't a CLI arg for passing the main file or slug, so they attempt to guess the slug based on the working directory, which is src
in this case. I was attempting to keep the fork as close to original as possible, but that's proving difficult, so I'll likely make another change to handle this error.
With a few updates, I'm thinking the config should look something like this (if there's not an issue extracting strings from the build directory):
makepot: {
target: {
options: {
cwd: BUILD_DIR,
domainPath: '.',
mainFile: 'bbpress.php',
potFilename: 'bbpress.pot',
type: 'wp-plugin'
}
}
}
Thanks... Thinking aloud for a moment... If I'm editing a file it will be from the src/
folder, save it and gets copied to build/
... Run grunt build
or grunt build-release
copy all the things from src/
to build/
then makepot
So is there any reason you don't want to extract strings from there instead?
No, that thought never crosseed my mind ;) Run makepot
from build/
, yeah, that'll work just fine :+1:
I've changed the config to match yours above with the following errors:
Warning: fopen(C:\xampp\htdocs\bbp.wp.nw\wp-content\plugins\bbpress\build/build.php): failed to open stream: No such file or directory in C:\xampp\htd ocs\bbp.wp.nw\wp-content\plugins\bbpress\node_modules\grunt-wp-i18n\vendor\wp-i18n-tools\makepot.php on line 392
Warning: fopen(C:\xampp\htdocs\bbp.wp.nw\wp-content\plugins\bbpress\build/build.php): failed to open stream: No such file or directory in C:\xampp\htd ocs\bbp.wp.nw\wp-content\plugins\bbpress\node_modules\grunt-wp-i18n\vendor\wp-i18n-tools\makepot.php on line 392
The bbpress.pot
file is generated in /build/bbpress.pot
and looks valid.
Let me know once you've made any updates you plan and I'll then implement the changes into the bbPress repo.
Cheers,
Stephen
Great! Glad that process will work.
Regarding that error, the POT file is generated, the only thing missing would be the plugin headers. I've already made a commit that should take care of it, though. Would you mind testing using the dev version? If you can, here's how you go about that:
git://github.com/blazersix/grunt-wp-i18n.git#develop
npm install
. If that doesn't grab the dev version, you may need to run npm clean cache
before running npm install
If that works, I'll go ahead and release the next version. Thanks!
Awesome, worked perfectly :+1:
Running "makepot:target" (makepot) task
>> POT file saved to C:\xampp\htdocs\bbp.wp.nw\wp-content\plugins\bbpress\build\bbpress.pot
Done, without errors.
Here are the full headers from the generated bbpress.pot
from the grunt-wp-i18n.git#develop
# Copyright (C) 2014 bbPress
# This file is distributed under the same license as the bbPress package.
msgid ""
msgstr ""
"Project-Id-Version: bbPress 2.6-alpha\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/bbpress\n"
"POT-Creation-Date: 2014-02-26 00:12:38+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
In the previous grunt-wp-i18n
v0.3.1:
# Copyright (C) 2014
# This file is distributed under the same license as the package.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/build\n"
"POT-Creation-Date: 2014-02-25 07:49:57+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Compared with our current release Source: bbpress.pot
# Copyright (C) 2013 bbPress
# This file is distributed under the same license as the bbPress package.
msgid ""
msgstr ""
"Project-Id-Version: bbPress 2.5\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/bbpress\n"
"POT-Creation-Date: 2013-11-25 06:51:36+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-MO-DA HO:MI+ZONE\n"
"Last-Translator: JOHN JAMES JACOBY <`redacted`>\n"
"Language-Team: ENGLISH <`redacted`>\n"
Edit: I just redacted the email address
Nice! Thanks for posting those headers, too. I didn't realize the POT headers weren't right, but that's good to know. I'll go ahead and bump the version and push out a release.
Thanks, greatly appreciated :)
Sweet! I wasn't expecting this to receive much adoption, but I'm glad to see people are finding it useful. :thumbsup:
@zedejose sent me this way after the gettext dependency issues I was having on Windows
I'm having some issues trying to get this working with a custom build process.
Project source: https://bbpress.trac.wordpress.org/browser/trunk
(Because of gettext/xgettext issues I'd like to switch from
grunt-pot
togrunt-wp-i18n
)My latest 'working' version of patching this is 2542.12.diff in bbPress Ticket #2452
Am I_doing_it_wrong and there is a more eloquent way of achieving the same goal?
With the above and below it lappears
bbpress.pot
is correctly generated, so that's :+1:cwd:
It appears from the errors below
grunt-wp-i18n
is looking for a file and not a folder. (I get the same error on Windows if I usecwd: 'src/
orcwd: 'src
cwd: SOURCE_DIR
Warning: fopen(C:\xampp\htdocs\bbp.wp.nw\wp-content\plugins\bbpress\src/src.php): failed to open stream: No such file or directory in C:\xampp\htdocs\ bbp.wp.nw\wp-content\plugins\bbpress\node_modules\grunt-wp-i18n\vendor\wp-i18n-tools\makepot.php on line 392
domainPath:
bbPress has
Domain Path: /languages/
defined inbbpress.php
so to override it and create thebbpress.pot
file in/build/bbpress.pot
I am using `potFilename: '../../' + BUILD_DIR + 'bbpress.pot',``