Giter Site home page Giter Site logo

Comments (9)

bradyvercher avatar bradyvercher commented on June 11, 2024

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.

ntwb avatar ntwb commented on June 11, 2024

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.

bradyvercher avatar bradyvercher commented on June 11, 2024

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 run npm clean cache before running npm 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.

ntwb avatar ntwb commented on June 11, 2024

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.

bradyvercher avatar bradyvercher commented on June 11, 2024

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.

ntwb avatar ntwb commented on June 11, 2024

Thanks, greatly appreciated :)

from grunt-wp-i18n.

ntwb avatar ntwb commented on June 11, 2024

Added grunt-wp-i18n to bbPress r5295

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 11, 2024

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.

ntwb avatar ntwb commented on June 11, 2024

@zedejose sent me this way after the gettext dependency issues I was having on Windows

from grunt-wp-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.