rtCamp / blank-theme

Customized Blank theme based on Underscore and Foundation
25 stars 23 forks source link

Use offical WP-CLI i18n package to generate POT file. #88

Open mi5t4n opened 7 months ago

mi5t4n commented 7 months ago

Description

This PR adds a composer script to generate POT files.

Technical Details

  1. Utilize the wp-cli/i18n-command tool for the generation of POT files, as it is the official tool capable of translating both PHP and JS files. Given that Gutenberg introduced localization functions in JS files, this tool ensures comprehensive coverage.

  2. The generation process will result in the creation of a POT file within the languages directory.

  3. Abstain from creating a GitHub action workflow for POT file generation due to the resource-intensive nature of the task, involving both high memory and CPU usage. This complexity can lead to potential failures within the GitHub action workflow.

Commands

  1. Run composer run pot to generate POT files.
  2. Run npm run pot to generate POT file. It's an alias to composer run pot.

How to test

  1. Run npm install to install JS packages.
  2. Run composer update to install PHP packages.
  3. Run npm run init to initialize the plugin.
  4. Run composer run pot to generate POT file.

Fixes/Covers issue

Fixes #87

Reference

https://github.com/rtCamp/features-plugin-skeleton/pull/482