wp-pot / gulp-wp-pot Goto Github PK
View Code? Open in Web Editor NEWGulp plugin to generate pot file for WordPress plugins and themes
Home Page: https://www.npmjs.com/package/gulp-wp-pot
License: MIT License
Gulp plugin to generate pot file for WordPress plugins and themes
Home Page: https://www.npmjs.com/package/gulp-wp-pot
License: MIT License
Could you please update required wp-pot version to latest one.
Right now it is set to "^1,3,3"
But you updated the version of wp-pot to 1,3,4.
Please see this closed issue.
Thanks for your hard work.
Using version 2.0.4, translator notes in my PHP file are not getting added to the generated .pot file as expected.
Source:
<?php
/* translators: PHP date string used by mysql2date function */
$date_string = __( 'j F Y @ g:i a', 'my_textdomain' );
?>
Output:
#: assets/functions/admin.php:56
msgid "j F Y @ g:i a"
msgstr ""
Gulp 4 now requires the latest version of vinyl-fs
. It appears that you're using gulp-utils
in this plugin which is now recommended against.
Any chance you can refactor so that gulp 4 users can still use this?
Thanks!
When developers is using different OS the paths can change which makes unnecessary changes in the pot-file.
Hi,
The problem is with latin chars
_e('Voici quelques liens pour vous aider à démarrer', 'domain');
POT headers
"Project-Id-Version: some-project\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n\n"
I use Netbeans, so all source files are in utf-8 without BOM by default.
I am using gulp-wp-pot
in a watch task, but the task crashes when wp-pot fails to parse a file.
[09:31:51] Starting 'pot'...
/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/wp-pot/translation-parser.js:325
throw e;
^
SyntaxError: Parse Error : syntax error, expecting T_ENDIF on line 530 | Unable to parse page-application.php
at parser.raiseError (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser.js:261:15)
at parser.error (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser.js:301:15)
at parser.expect (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser.js:386:10)
at parser.read_if (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser/if.js:39:12)
at parser.read_statement (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser/statement.js:194:46)
at parser.read_top_statement (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser/statement.js:74:21)
at parser.read_start (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser/main.js:17:19)
at parser.parse (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/parser.js:243:21)
at engine.parseCode (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/php-parser/src/index.js:168:22)
at TranslationParser.parseFile (/Users/stefanfisk/Projects/berghs/berghs.se/repo/node_modules/wp-pot/translation-parser.js:321:28)
This issue provides visibility into Renovate updates and their statuses. Learn more
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
Out of nowhere started seeing memory issues when wpPot runs...
<--- Last few GCs --->
[46760:0x108008000] 20658 ms: Scavenge 1393.8 (1424.6) -> 1393.5 (1425.6) MB, 2.6 / 0.0 ms (average mu = 0.114, current mu = 0.037) allocation failure
[46760:0x108008000] 21347 ms: Mark-sweep 1394.1 (1425.6) -> 1393.8 (1424.6) MB, 687.6 / 0.0 ms (average mu = 0.070, current mu = 0.021) allocation failure scavenge might not succeed
[46760:0x108008000] 21356 ms: Scavenge 1394.4 (1424.6) -> 1394.1 (1425.6) MB, 4.6 / 0.0 ms (average mu = 0.070, current mu = 0.021) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x3a3f28fdbe3d]
Security context: 0x018cd549e6e9
1: makeAbs [0x18c09045421] [/Users/bartdabek/Sites/www/lawtons.test/wp-content/themes/lawtons/node_modules/glob/common.js:~203] [pc=0x3a3f290504a3](this=0x018cabf8c8f9 ,self=0x018cec3ec591 ,f=0x018cf0752919 <String[160]: /Users/bartdabek/Sites/www/lawtons.test/wp-content/themes/lawtons/../../plugins/s...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x10096d6b6 node::Abort() (.cold.1) [/usr/local/opt/node@10/bin/node]
2: 0x10003b8d0 node_module_register [/usr/local/opt/node@10/bin/node]
3: 0x10003ba91 node::OnFatalError(char const*, char const*) [/usr/local/opt/node@10/bin/node]
4: 0x100178d87 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/opt/node@10/bin/node]
5: 0x100178d29 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/opt/node@10/bin/node]
6: 0x10042d29c v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/opt/node@10/bin/node]
7: 0x10042eed9 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/opt/node@10/bin/node]
8: 0x10042c576 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/opt/node@10/bin/node]
9: 0x10042b387 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/opt/node@10/bin/node]
10: 0x1004339ae v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/opt/node@10/bin/node]
11: 0x1004339f8 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/opt/node@10/bin/node]
12: 0x10041404f v8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::PretenureFlag, v8::internal::Map*, v8::internal::AllocationAlignment) [/usr/local/opt/node@10/bin/node]
13: 0x100415b6e v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/opt/node@10/bin/node]
14: 0x1004ef2ce v8::internal::String::SlowFlatten(v8::internal::Handlev8::internal::ConsString, v8::internal::PretenureFlag) [/usr/local/opt/node@10/bin/node]
15: 0x1006345a2 v8::internal::Runtime_StringCharCodeAt(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/opt/node@10/bin/node]
16: 0x3a3f28fdbe3d
17: 0x3a3f290504a3
[1] 46760 abort gulp
No idea what's going on my system hasn't changed... nothing was upgraded yet this is now failing.
1.6.3
to 1.6.4
.This version is covered by your current version range and after updating it in your project the build failed.
wp-pot is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
The new version differs by 15 commits.
10df9cc
1.6.4
3e2fa1d
updates
1741d3e
Merge pull request #55 from rasmusbe/greenkeeper/php-parser-3.0.0-prerelease.6
cd8b879
changes for php-parser 3
009babe
chore(package): update lockfile package-lock.json
1f4754f
fix(package): update php-parser to version 3.0.0-prerelease.6
61b0970
Merge pull request #54 from rasmusbe/rasmusbe-patch-1
7dd4655
Update readme.md
9af20c3
Merge pull request #53 from rasmusbe/greenkeeper/php-parser-3.0.0-prerelease.5
ec6b8eb
chore(package): update lockfile package-lock.json
3c057bc
fix(package): update php-parser to version 3.0.0-prerelease.5
5e04a4e
Merge pull request #52 from rasmusbe/greenkeeper/php-parser-3.0.0-prerelease.4
3d9ffd6
chore(package): update lockfile
6e89aba
fix(package): update php-parser to version 3.0.0-prerelease.4
14a988a
travis fixes
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Would be useful for excluding vendor dir for composer.
After generate the .POT file and open it with Poedit by selecting "Create new translation", the file won't be opened and returns following errors:
Mon Jul 18 03:24:07 2016: /var/folders/vj/mtrbj91j6hgdgcbcwkqn_51m0000gn/T/poeditLwzPFK/0ref.pot:534: duplicate message definition...
Mon Jul 18 03:24:07 2016: /var/folders/vj/mtrbj91j6hgdgcbcwkqn_51m0000gn/T/poeditLwzPFK/0ref.pot:311: ...this is the location of the first definition
Mon Jul 18 03:24:07 2016: msgmerge(2871,0x7fff785f0000) malloc: *** error for object 0x7fbef8414a20: pointer being freed was not allocated
Mon Jul 18 03:24:07 2016: *** set a breakpoint in malloc_error_break to debug
When I select "Edit a translation" it can be opened but I got notification that duplicated translation string found and Poedit automatically fixed that.
My Poedit version 1.8.8
Wordpress tool makepot.php parse also comments in main plugin file and theme style.css. So fields 'Plugin/theme name', 'Plugin/theme url', 'Description' also add to pot file.
Maybe consider add this functional to you tool?
Hi @rasmusbe ,
Thanks for this cool plugin
Unfortunately i'm currently facing an issue with this plugin.
Whenever i run the gulp task, this error always shows up
TypeError: Cannot read property 'toLowerCase' of undefined | Unable to parse inc/class-tgm-plugin-activation.php
I'm using version ^2.3.2
of gulp-wp-pot
npm
version 6.2.0
gulp
CLI version 2.0.1
, Local version 3.9.1
Here's the full error log
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'toLowerCase' of undefined | Unable to parse inc/class-tgm-plugin-activation.php
at parser.read_variable (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\variable.js:48:35)
at parser.read_expr_item (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:342:19)
at parser.read_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:11:23)
at parser.read_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:67:60)
at parser.read_expr_item (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:130:26)
at parser.read_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:11:23)
at parser.read_expr_item (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:110:50)
at parser.read_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:11:23)
at parser.read_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:43:52)
at parser.read_expr_item (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:110:50)
at parser.read_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\expr.js:11:23)
at parser.read_if_expr (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\if.js:57:25)
at parser.read_if (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\if.js:22:24)
at parser.read_statement (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:201:21)
at parser.read_inner_statement (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:188:21)
at parser.read_inner_statements (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:88:30)
at parser.read_code_block (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:400:14)
at parser.read_function (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\function.js:48:28)
at parser.read_class_body (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\class.js:103:26)
at parser.read_class (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\class.js:29:30)
at parser.read_inner_statement (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:170:21)
at parser.read_inner_statements (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:88:30)
at parser.read_code_block (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:400:14)
at parser.read_statement (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:198:21)
at parser.read_if (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\if.js:43:19)
at parser.read_statement (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:201:21)
at parser.read_top_statement (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\statement.js:76:21)
at parser.read_start (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser\main.js:18:19)
at parser.parse (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\parser.js:276:23)
at engine.parseCode (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\node_modules\php-parser\src\index.js:167:22)
at TranslationParser.parseFile (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\translation-parser.js:346:28)
at wpPot (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\wp-pot\index.js:171:38)
at DestroyableTransform._flush (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\gulp-wp-pot\index.js:51:27)
at DestroyableTransform.prefinish (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\readable-stream\lib\_stream_transform.js:138:10)
at emitNone (events.js:106:13)
at DestroyableTransform.emit (events.js:208:7)
at prefinish (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\readable-stream\lib\_stream_writable.js:619:14)
at finishMaybe (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\readable-stream\lib\_stream_writable.js:627:5)
at endWritable (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\readable-stream\lib\_stream_writable.js:638:3)
at DestroyableTransform.Writable.end (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\readable-stream\lib\_stream_writable.js:594:41)
at DestroyableTransform.onend (C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:523:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at DestroyableTransform.emit (events.js:208:7)
at C:\DevProjects\wordpress-fresh\wp-content\themes\toba\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:965:16
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Finally, here's my gulp task
gulp.task( 'pot', function() {
return gulp.src( './**/*.php' )
.pipe( wpPot({
domain: 'toba',
package: 'Toba Theme'
}) )
.pipe( gulp.dest( './languages/toba.pot' ) );
});
Branch | Build failing 🚨 |
---|---|
Dependency | wp-pot |
Current Version | 1.0.0 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
As wp-pot is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
The new version differs by 9 commits .
289dd02
1.1.0
750a37e
Earlier domain check and easier comment passing
f433203
Use php-parser for more parsing
15002ac
Some small eslint rule changes
53931b6
Small code syntax changes and some added rules
66b1d85
Update some code to es6
9717af2
Update readme.md
cee7587
Merge pull request #2 from rasmusbe/greenkeeper/php-parser-1.0.0
d0fd4ad
fix(package): update php-parser to version 1.0.0
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
Hello and thank you for your great plugin!
Unfortunately with the rewrite onto 2.0 it does not work anymore for twig files.
We are using Timber in our themes and this plugin was great in combination with it.
In our newest base theme we gave up on gulp and went straight to npm trying out https://github.com/rasmusbe/wp-pot and out of a sudden it would not find any strings in twig files anymore :(
Could you please have a look? Would be wonderful to get the functionality back as there isn't really any alternative available.
Keep up the great work!
14.0.1
to 14.1.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-config-standard is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Thanks in advance! Really, really useful stuff 😀.
Consider the following example:
<?php
/**
* The Copyright Message Template.
*/
?>
<p><?php
/* translators: 1: current year, 2: site title link. */
printf(
_x( '© %1$d %2$s', 'site copyright', 'textdomain' ),
date( 'Y' ),
'<a href="' . esc_url( home_url( '/' ) ) . '">' . esc_html( get_bloginfo( 'name' ) ) . '</a>'
);
?></p>
.pot: Missing translators:
comment.
#: template-parts/copyright.php:16
msgctxt "site copyright"
msgid "© %1$d %2$s"
msgstr ""
<?php
/**
* The Copyright Message Template.
*/
/* translators: 1: current year, 2: site title link. */
printf(
_x( '© %1$d %2$s', 'site copyright', 'textdomain' ),
date( 'Y' ),
'<a href="' . esc_url( home_url( '/' ) ) . '">' . esc_html( get_bloginfo( 'name' ) ) . '</a>'
);
.pot: All is well here.
#. translators: 1: current year, 2: site title link.
#: template-parts/copyright.php:8
msgctxt "site copyright"
msgid "© %1$d %2$s"
msgstr ""
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-standard |
Current Version | 2.1.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-standard is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
Full Log:
[12:46:31] Starting 'generate_pot'...
/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/wp-pot/index.js:361
text = text.replace(/\\([\s\S])|(")/g, '\\$1$2');
^
TypeError: text.replace is not a function
at escapeQuotes (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/wp-pot/index.js:361:15)
at getPotMsgId (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/wp-pot/index.js:378:13)
at translationToPot (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/wp-pot/index.js:434:32)
at generatePot (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/wp-pot/index.js:475:28)
at wpPot (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/wp-pot/index.js:514:23)
at DestroyableTransform._flush (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/gulp-wp-pot/index.js:51:25)
at DestroyableTransform.<anonymous> (/Users/joelworsham/Sites/www/wordpress-develop/public_html/src/wp-content/plugins/learndash-gradebook/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:115:49)
at DestroyableTransform.g (events.js:260:16)
at emitNone (events.js:67:13)
at DestroyableTransform.emit (events.js:166:7)
Process finished with exit code 1
__("Hello\nWorld", 'test') becomes
msgid "HellonWorld"
instead of
msgid "Hello\n"
"World"
in pot-file
How about constants as domain?
I'm usually: _x( 'text, 'context', PLUGIN_TEXTDOMAIN );
Instead of _x( 'text, 'context', 'plugin-textdomain' );
Differently than https://i18n.svn.wordpress.org/tools/trunk/ seems wp-pot doesn't include in the pot file the plugin description.
Am I missing something in the configuration?
I have a WordPress theme and I'm trying to update all the methods to Gulp 4.
Dependencies:
const autoprefixer = require('autoprefixer');
const babel = require('gulp-babel');
const bourbon = require( 'bourbon' ).includePaths;
const browserSync = require('browser-sync').create();
const concat = require('gulp-concat');
const cssnano = require('cssnano');
const fs = require('fs');
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const packagejson = JSON.parse(fs.readFileSync('./package.json'));
const mqpacker = require( 'css-mqpacker' );
const plumber = require('gulp-plumber');
const postcss = require('gulp-postcss');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const sassGlob = require('gulp-sass-glob');
const sort = require( 'gulp-sort' );
const sourcemaps = require('gulp-sourcemaps');
const svgmin = require( 'gulp-svgmin' );
const uglify = require('gulp-uglify');
const wpPot = require('wp-pot');
Config:
const config = {
styles: {
front_end: 'assets/sass/*.scss',
main: 'sass/**/*.scss',
srcDir: 'assets/sass',
front_end_dest: 'assets/css',
main_dest: './'
},
scripts: {
main: './assets/js/src/**/*.js',
uglify: [ 'assets/js/*.js', '!assets/js/*.min.js', '!assets/js/customizer.js' ],
dest: './assets/js'
},
images: {
main: './assets/img/**/*',
dest: './assets/img/'
},
languages: {
src: [ './*.php', '!vendor/**/*.php' ],
dest: './languages/'
},
browserSync: {
active: false,
localURL: 'mylocalsite.local'
}
};
I've tried various things for config.languages.src
ranging from what is there currently to just functions.php
but that value doesn't appear to change the result.
Then the translation method:
function translation() {
return gulp.src(config.languages.src)
.pipe(plumber())
.pipe(sort())
.pipe(wpPot( {
domain: packagejson.name,
package: packagejson.name,
} ) )
.pipe(gulp.dest(config.languages.dest));
}
I've tried to add the method both of these ways:
exports.translation = translation;
gulp.task('translation', translation);
When I run gulp translation
, I get the following:
[14:25:45] Using gulpfile ~/wp-content/themes/minnpost-largo/gulpfile.js
[14:25:45] Starting 'translation'...
[14:25:47] 'translation' errored after 2.37 s
[14:25:47] TypeError: dest.on is not a function
at DestroyableTransform.Readable.pipe (/wp-content/themes/minnpost-largo/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:564:8)
at DestroyableTransform.pipe2 (/wp-content/themes/minnpost-largo/node_modules/gulp-plumber/index.js:72:14)
at translation (/wp-content/themes/minnpost-largo/gulpfile.js:213:8)
at taskWrapper (/wp-content/themes/minnpost-largo/node_modules/undertaker/lib/set-task.js:13:15)
at bound (domain.js:425:14)
at runBound (domain.js:438:12)
at asyncRunner (/wp-content/themes/minnpost-largo/node_modules/async-done/index.js:55:18)
at processTicksAndRejections (internal/process/task_queues.js:79:9)
Can you point me in a direction here?
Branch | Build failing 🚨 |
---|---|
Dependency | wp-pot |
Current Version | 1.6.1 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
wp-pot is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
Updated dependencies for php-parser and matched
The new version differs by 4 commits.
fce4e65
1.6.2
92b29b3
Update deps
cd8d3a2
Merge pull request #43 from rasmusbe/dev-update
35e16c7
Updated dev packages and updated failed tests
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-node |
Current Version | 7.0.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
node/no-unsupported-features/node-builtins
reports the process.emitWarning
method on Node.js >=6 <8
. It was supported since Node.js 6.0.0.The new version differs by 3 commits.
a4a7ad2
7.0.1
44b57ed
Fix: false positive 'no-unsupported-features/node-builtins'
cde4c82
Docs: update README.md
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
gulp-wp-pot does not support extracted comments e.g. using the "translators:" (or other) keyword at the start of comments just prior to a translation function call, e.g.
your-translated-file.php:
<?php
/* translators: Limit to 32 characters or less */
$short_variable = __('Limited Length Phrase', 'sample-textdomain');
might produce a pot entry like so:
sample-textdomain.pot: (excerpt)
#. translators: Limit to 32 characters or less
#: your-translated-file.php:3
msgid "Limited Length Phrase"
msgstr ""
please consider the release bump :)
also some strings dropped from the pot file in node v8, but I'm not able to test with the last version of wp-pot.
This is my page.php template:
<?php
/**
* Default page template
* @package SG One
*/
get_header();
echo '<section>';
get_template_part('template-parts/nav/nav', 'sub');
echo '<div class="container grid-2xl">';
get_template_part('template-parts/components/component', 'breadcrumbs');
echo '</div>';
echo '</section>';
echo '<section class="section-margin hide-mp-top">';
echo '<div class="container grid-2xl">';
if(class_exists('woocommerce')):
if(is_cart()):
echo '<h1>' . get_the_title() . '</h1>';
echo do_shortcode('[woocommerce_cart]');
elseif(is_checkout()):
if(is_wc_endpoint_url('order-received')){
// This translation is not being picked up
echo '<h1 class="h2">' . __('Order confirmation', 'sg-one') . '</h1>';
}
echo do_shortcode('[woocommerce_checkout]');
elseif(is_account_page()):
echo '<h1>' . get_the_title() . '</h1>';
echo do_shortcode('[woocommerce_my_account]');
else:
echo '<h1>' . get_the_title() . '</h1>';
the_content();
endif;
else:
echo '<h1>' . get_the_title() . '</h1>';
the_content();
endif;
// This translation is being picked up
echo __('Test', 'sg-one');
echo '</div>';
echo '</section>';
get_footer();
?>
gulp-wp-pot is not generating the translation of __('Order confirmation', 'sg-one')
inside the WooCommerce conditionals. Outside the conditionals, translations works just fine.
These are my dev dependencies:
"devDependencies": {
"browser-sync": "^2.26.7",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-concat": "^2.6.1",
"gulp-ext-replace": "^0.3.0",
"gulp-imagemin": "^7.1.0",
"gulp-sass": "^4.0.2",
"gulp-sort": "^2.0.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"gulp-wp-pot": "^2.4.1",
"gulp-zip": "^5.0.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-webp": "^5.1.0",
"merge-stream": "^2.0.0",
"pump": "^3.0.0"
}
This is my gulp task:
gulp.task('translate', function() {
return gulp.src(themeDir + '**/*.php')
.pipe(sort())
.pipe(wpPot({
domain : 'sg-one',
package : 'SG One'
}))
.pipe(gulp.dest(themeDir + 'languages/en_GB.pot'))
});
I'm still having the issue without .pipe(sort()).
Make the codeclimate better by refactor transToPot
https://codeclimate.com/github/rasmusbe/gulp-wp-pot/issues/categories/complexity
In you documentation you state that domain can be omitted to scan for all textdomains but the plugin will throw an error if the domain options is not defined.
https://github.com/rasmusbe/gulp-wp-pot/blob/1a27316e4601400b5712baac1322a31c204d7c83/index.js#L257
Hi,
Please release a new version with the latest wp-pot JS parser features.
Version 2.5.0 is still using wp-pot 1.9.6, which doesn't support the JS parser yet.
Branch | Build failing 🚨 |
---|---|
Dependency | wp-pot |
Current Version | 1.2.0 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
wp-pot is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
The new version differs by 12 commits.
772eaed
1.3.0
a0a72f6
Add support for template name headers
c46b8cb
Add support for metadata in file headers
76bba6b
Keep comments when processing same line
140b364
Make headers function better
44b1b01
Improve code style
488cf04
Better looping in pot maker
22d5214
Split code into classes to improve code quality
e6ba169
Add tests for node 4 since its still maintained
6791e85
Set temporary path on travis to avoid failures
e0053ff
Merge pull request #18 from rasmusbe/greenkeeper/eslint-plugin-node-5.0.0
a144c51
chore(package): update eslint-plugin-node to version 5.0.0
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
Branch | Build failing 🚨 |
---|---|
Dependency | eslint |
Current Version | 3.12.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
no-unneeded-ternary
(#7540) (Teddy Katz)padded-blocks
never
case (fixes #7868) (#7878) (alberto)operator-linebreak
(#7702) (Teddy Katz)return
argument (fixes #7594) (#7595) (Dalton Santos)semi
false positive before regex/template literals (fixes #7782) (#7783) (Teddy Katz)prefer-destructuring
rule (fixes #6053) (#7741) (Alex LaFroscia)The new version differs by 43 commits .
8571ab8
3.13.0
d54e0c1
Build: package.json and changelog update for 3.13.0
cd4c025
Update: add fixer for no-extra-label (#7840)
aa75c92
Fix: Ensure prefer-const fixes destructuring assignments (fixes #7852) (#7859)
4008022
Chore: Refactor to use ES6 Classes (Part 3)(refs #7849) (#7865)
c9ba40a
Update: add fixer for no-unneeded-ternary
(#7540)
dd56d87
Update: add object-shorthand option for arrow functions (fixes #7564) (#7746)
fbafdc0
Docs: padded-blocks
never
case (fixes #7868) (#7878)
ca1f841
Fix: no-useless-return stack overflow on loops after throw (fixes #7855) (#7856)
d80d994
Update: add fixer for object-property-newline (fixes #7740) (#7808)
bf3ea3a
Fix: capitalized-comments: Ignore consec. comments if first is invalid (#7835)
616611a
Chore: Refactor to use ES6 Classes (Part 2)(refs #7849) (#7847)
856084b
Chore: Refactor to use ES6 Classes (Part 1)(refs #7849) (#7846)
bf45893
Docs: Clarify that we only support Stage 4 proposals (#7845)
0fc24f7
Fix: adapt new-paren rule so it handles TypeScript (fixes #7817) (#7820)
There are 43 commits in total. See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
using:
_nx_noop( 'Singular', 'Plural', 'context', PLUGIN_TEXTDOMAIN );
getting:
#: includes/file.php:xx
msgctxt "PLUGIN_TEXTDOMAIN"
msgid "Singular"
msgid_plural "Plural"
msgstr[0] ""
msgstr[1] ""
must be:
#: includes/file.php:xx
msgctxt "context"
msgid "Singular"
msgid_plural "Plural"
msgstr[0] ""
msgstr[1] ""
WordPress is:
function _nx_noop( $singular, $plural, $context, $domain = null ) {
...
}
Revision Date is not updated in the generated POT file.
It is always "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
.
It looks like gulp-wp-pot
is not picking up translations inside (some?) filters or functions.
I have two local sites. Site 1 is running gulp-wp-pot
2.3.6 and site 2 is 2.4.0. They're using the exact same gulp file, packages, theme and structure except all packages are up to date on site 2.
Site 1, running gulp-wp-pot
2.3.6 , is correctly picking up translations inside this function from mytheme/woocommerce/checkout/form-coupon.php:
<?php wc_print_notice( apply_filters( 'woocommerce_checkout_coupon_message', esc_html__( 'Have a gift card?', 'sg-one' ) . ' <a href="#" class="showcoupon">' . esc_html__( 'Click here to use your gift card', 'sg-one' ) . '</a>' ), 'notice' ); ?>
This function is the same as the WooCommerce core function - i just replaced the translatable strings and translation domain.
The exact same translations are however not generated for site 2, running gulp-wp-pot
2.4.0.
This simple string is also in the same template file:
<p><?php esc_html_e( 'If you have a gift card code, please apply it below.', 'sg-one' ); ?></p>.
Both versions generate this string just fine. That's why I suspect that there is some bug with functions/filters.
These are my dev dependencies:
"devDependencies": {
"browser-sync": "^2.26.7",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-concat": "^2.6.1",
"gulp-ext-replace": "^0.3.0",
"gulp-imagemin": "^7.1.0",
"gulp-sass": "^4.0.2",
"gulp-sort": "^2.0.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"gulp-wp-pot": "^2.4.0",
"gulp-zip": "^5.0.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-webp": "^5.1.0",
"merge-stream": "^2.0.0",
"pump": "^3.0.0"
}
This is my gulp task:
gulp.task('translate', function() {
return gulp.src(themeDir + '**/*.php')
.pipe(sort())
.pipe(wpPot({
domain : 'sg-one',
package : 'SG One'
}))
.pipe(gulp.dest(themeDir + 'languages/en_GB.pot'))
});
I'm still having the issue without .pipe(sort())
.
Ignores code like:
__(
'Hello World.',
'test'
);
I think this requires a lot of changes to the code unfortunately.
When the gulpfile setup lives outside the project folder, the translation file gets messed up.
Let's say for example I have the following setup:
Gulpfile etc sits in
wp-content/themes/gulp-dev
Actual theme sits in
wp-content/themes/mytheme
The Gulp task looks like this (simplified):
var root = '../mytheme/';
var languages = root + 'languages/';
gulp.task('i18n', function () {
return gulp.src(root + '**/*.php')
.pipe(sort())
.pipe(wppot( {
domain: 'mytheme',
destFile: languages + 'mytheme.pot',
package: themename
} ))
.pipe(gulp.dest(languages));
});
The resulting output in the .pot file gets this:
#: ../mytheme/404.php:17
msgid "hmmm. Oops! That page can’t be found."
msgstr ""
The URL reference contains the relative link to the theme folder. It still works (because the URI just points back to itself) but it's not clean.
Add support for adding custom headers in pot file or at least add the headers for poedit. (See PR #4)
As WordPress now has internationalization support in JavaScript, it would help to support it in gulp-wp-pot.
5.15.3
to 5.16.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
dfef227
Build: gensite passes rulesMeta to formatter rendering (#11567) (Kevin Partington)c06d38c
Fix: Allow HTML formatter to handle no meta data (#11566) (Ilya Volodin)87a5c03
Docs: func-style
: clarify when allowArrowFunctions
is used (#11548) (Oliver Joseph Ash)bc3e427
Update: pass rule meta to formatters RFC 10 (#11551) (Chris Meyer)b452f27
Chore: Update README to pull in reviewer data (#11506) (Nicholas C. Zakas)afe3d25
Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550) (Vernon de Goede)4fe7eb7
Chore: use nyc instead of istanbul (#11532) (Toru Nagashima)f16af43
Chore: fix formatters/table test (#11534) (Toru Nagashima)78358a8
Docs: fix duplicate punctuation in CLI docs (#11528) (Teddy Katz)The new version differs by 11 commits.
ded2f94
5.16.0
ea36e13
Build: changelog update for 5.16.0
dfef227
Build: gensite passes rulesMeta to formatter rendering (#11567)
c06d38c
Fix: Allow HTML formatter to handle no meta data (#11566)
87a5c03
Docs: func-style
: clarify when allowArrowFunctions
is used (#11548)
bc3e427
Update: pass rule meta to formatters RFC 10 (#11551)
b452f27
Chore: Update README to pull in reviewer data (#11506)
afe3d25
Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550)
4fe7eb7
Chore: use nyc instead of istanbul (#11532)
f16af43
Chore: fix formatters/table test (#11534)
78358a8
Docs: fix duplicate punctuation in CLI docs (#11528)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi, I have a pretty basic project setup.
Gulp version 3.9.1
Node version 6.5.0
src/
dist/
gulpfile.js
using the sample task
gulp.task('pot', function () {
return gulp.src('src/*.php')
.pipe(sort())
.pipe(wpPot( {
domain: 'XXXX',
destFile:'file.pot',
package: 'XXXX',
bugReport: 'http://example.com',
lastTranslator: 'John Doe <[email protected]>',
team: 'Team Team <[email protected]>'
} ))
.pipe(gulp.dest('dist'));
});
It generates the file.pot but it's empty of translations
`# Copyright (C) 2016 XXXX
msgid ""
msgstr ""
"Project-Id-Version: XXXX\n"
"Report-Msgid-Bugs-To: http://example.com\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
"Last-Translator: John Doe [email protected]\n"
"Language-Team: Team Team [email protected]\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: ;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"`
I've used poedit to open the file and it finds no translations. it'll then search the directory and populate the file.
is there an incompatibility with the newer node/gulp version?
Hi, excuse my basic understanding of gulp.
I have been successfully generating pot files for php
gulp.task('translatePHP', () => { return gulp.src(['src/**/*.php', '!src/{vendor,vendor/**}']) .pipe(sort()) .pipe(wpPot({ domain: project, package: project })) .on('error', gutil.log) .pipe(gulp.dest('src/languages/' + project + '.pot')) .pipe(notify({message: 'TASK: "translate" Completed! 💯', onLast: true})); });
but with my attempt at JS
gulp.task('translateJS', () => { return gulp.src(['src/**/*.js', '!src/{vendor,vendor/**}']) .pipe(sort()) .pipe(wpPot({ parser: 'js', parserOptions: { ecmaVersion: 6, }, })) .on('error', gutil.log) .pipe(gulp.dest('src/languages/' + project + '.js.pot')) .pipe(notify({message: 'TASK: "translate" Completed! 💯', onLast: true})); });
I just get an error and no clue as what is erroring
[08:45:51] Using gulpfile ~/projects/github.com/alanef/plugin-widget-for-eventbrite-api-project/gulpfile.js [08:45:51] Starting 'translateJS'... [08:45:53] error [08:45:53] The following tasks did not complete: translateJS
Any help with how to investigate would be fantastic.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.