Comments (9)
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'
}
}
}
from grunt-wp-i18n.
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 👍
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
from grunt-wp-i18n.
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:
- Change the version for grunt-wp-i18n in package.json to:
git://github.com/blazersix/grunt-wp-i18n.git#develop
- Run
npm install
. If that doesn't grab the dev version, you may need to runnpm clean cache
before runningnpm install
- Then just run your build task again and verify it works.
If that works, I'll go ahead and release the next version. Thanks!
from grunt-wp-i18n.
Awesome, worked perfectly 👍
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 <[email protected]>\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 <[email protected]>\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
from grunt-wp-i18n.
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.
from grunt-wp-i18n.
Thanks, greatly appreciated :)
from grunt-wp-i18n.
Added grunt-wp-i18n
to bbPress r5295
from grunt-wp-i18n.
Sweet! I wasn't expecting this to receive much adoption, but I'm glad to see people are finding it useful. 👍
from grunt-wp-i18n.
@zedejose sent me this way after the gettext dependency issues I was having on Windows
from grunt-wp-i18n.
Related Issues (20)
- Ignore certain domain (e.g. via an options.dontUpdateDomains) HOT 12
- Warning: Cannot read property 'split' of undefined HOT 6
- Exclude page templates HOT 3
- "updateTimestamp: false" is not working properly HOT 3
- Exclude doesn't included in .pot file HOT 2
- Send modified files to build path only HOT 2
- Not Working on Windows ver > 8
- Good way to eliminate duplicates in pot file HOT 8
- Running "makepot" task keeps running forever HOT 4
- update node-wp-i18n to v1.0.5 HOT 1
- updateTimestamp: false not working HOT 8
- Detecting msgid stored in variable HOT 1
- Warning: Cannot read property 'pot-creation-date' of undefined Use --force to continue. HOT 1
- POT File by text domain HOT 2
- Switch to using `wp i18n make-pot` HOT 6
- Makepot supports for monorepo plugins HOT 1
- Addtextdomain throws error HOT 1
- Better output when makepot fails due to missing PHP cli
- Warnings when running on PHP 8 HOT 2
- Duplicate text domains added where text domain already exists HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-wp-i18n.