Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Jan 17, 2025

Conversation

mi5t4n
Copy link
Member

@mi5t4n mi5t4n commented Dec 12, 2023

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 #396

Reference

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

@mi5t4n mi5t4n self-assigned this Dec 12, 2023
@mi5t4n mi5t4n requested a review from RahiDroid December 12, 2023 08:51
@divyarajmasani
Copy link
Contributor

@mi5t4n Could you resolve the conflicts and test the changes?

@mi5t4n
Copy link
Member Author

mi5t4n commented Jan 5, 2025

@divyarajmasani The merge conflicts have been resolved. But it seems there are issues with the package version, should I resolve that as well, or we simply set the PHP version to 8.2 in composer.json.

@divyarajmasani
Copy link
Contributor

@mi5t4n Please, go ahead and update the php version, v7.4 is no longer supported. Ensure all other necessary packages are also updated to support the new php version.

@mi5t4n mi5t4n force-pushed the enhance/use-wp-cli-for-pot-file-generation branch from 61912f8 to fc5f9ec Compare January 16, 2025 20:40
@mi5t4n
Copy link
Member Author

mi5t4n commented Jan 16, 2025

@divyarajmasani Updated following things since we last communicated:

  1. Set the minimum PHP version to 8.2 in the composer.json file.
  2. Se the PHP version to 8.2 in the .wp-env.json file as well. As we want to perform integrations tests in the minimum version.
  3. Set the PHP version in the test-measure.yml workflow to PHP 8.2 as well.
  4. Regenerated the composer.lock file.

@divyarajmasani divyarajmasani merged commit 3144f1d into main Jan 17, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate POT file using official WP CLI package.
2 participants