The recent move to Composer for Known (and eventually Known plugins) has given me the opportunity to improve the experience for plugin developers.
Previously, generating a .pot file for languages would require a script in Known’s central language directory. This meant all sorts of “relative path” hijinks in your Gruntfile.js, and was generally bad.
So, I’ve taken this opportunity to package up the script into its own project that can be installed via composer as a development dependency into your plugin project.
How to use
- Create your CoolProject, and add your translation string hooks, and load them as described here.
- In your project, add
as a dependency usingknown-language-tools
composer require mapkyca/known-language-tools --dev
- In the project directory you’ll find a
file. Copy this to your project root asSample.package.json
and edit accordingly. Note your project name should be the name of your project.package.json
- In the project directory, you’ll find a
. Again, copy this into your project root.Sample.Gruntfile.js
- Create a
directorylanguages
- Run the grunt task,
(if grunt isn’t found,grunt build-lang
first.npm install --only=dev
Hope this is useful to you!