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

Strings from WordPress core's components.js are not extracted #297

Closed
2 tasks done
ocean90 opened this issue Jan 4, 2022 · 4 comments · Fixed by #299
Closed
2 tasks done

Strings from WordPress core's components.js are not extracted #297

ocean90 opened this issue Jan 4, 2022 · 4 comments · Fixed by #299

Comments

@ocean90
Copy link
Contributor

ocean90 commented Jan 4, 2022

Bug Report

Describe the current, buggy behavior

The translation project for WordPress 5.9 is missing some strings, particularly from components.js.

Describe how other contributors can replicate this bug

  • Download components.js
  • Create a new folder with components.js
  • cd into the new folder
  • run wp i18n make-pot . --ignore-domain (or php -d memory_limit=1G $(which wp) i18n make-pot . --ignore-domain in case of memory limit issues)
  • Open the POT file and notice that no strings are extracted

Describe what you would expect as the correct outcome

The resulting POT file should include all strings from components.js.

Let us know what environment you are running this on

❯ wp cli info
OS:	Darwin 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64
Shell:	/bin/zsh
PHP binary:	/usr/local/opt/php@7.4/bin/php
PHP version:	7.4.27
php.ini used:	/usr/local/etc/php/7.4/php.ini
MySQL binary:	/usr/local/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.3.32-MariaDB, for osx10.17 (x86_64) using readline 5.1
SQL modes:
WP-CLI root dir:	/Users/Dominik/Development/git/wp-cli
WP-CLI vendor dir:	/Users/Dominik/Development/git/wp-cli/vendor
WP_CLI phar path:
WP-CLI packages dir:	/Users/Dominik/Development/git/wp-cli/packages/
WP-CLI global config:	/Users/Dominik/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version:	2.5.1-alpha

Provide additional context/Screenshots

The debug message:

Debug (make-pot): Could not parse file components.js: Unexpected: 05 (line 38659, column 2225) (3.207s)

js-source

The source of this seems to be https://github.com/omgovich/react-colorful/blob/8681e3cbf6c7ca0c8ef3861a3c68d1a0ef1161fb/src/components/common/Interactive.tsx#L122-L123.

Might be a similar issue as in #255 and requires an upstream fix.

@swissspidy
Copy link
Member

I was just about to open an issue on the Peast repo, but you beat me to it :-)

Not sure what would be a good workaround for the meantime. Maybe some build config to retain the leading zeros?

ocean90 added a commit to ocean90/i18n-command that referenced this issue Jan 8, 2022
@swissspidy
Copy link
Member

Now that the upstream bug has been fixed, I think all that‘s needed is updating the dependency here / in the final bundle

@wojsmol
Copy link
Contributor

wojsmol commented Jan 8, 2022

@swissspidy For now there is not release of Peast with this fix.

@wojsmol
Copy link
Contributor

wojsmol commented Jan 11, 2022

@swissspidy Peast library was updated to version with fixes for this issue in #299.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants