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

text-domain is not parsed correctly when theme has no i18n translation #430

Open
latracal opened this issue Sep 13, 2022 · 2 comments
Open

Comments

@latracal
Copy link

latracal commented Sep 13, 2022

Initially reported in #themereview channel - https://wordpress.slack.com/archives/C02RP4Y3K/p1662993132324669 (requires login).

When theme has no i18n translation, the Theme Check fails with the message -
REQUIRED: This theme text domain does not match the theme's slug. The text domain used: This theme's correct slug and text-domain is no-i18n.

Further, the INFO log for text-domain seems to be rendering an empty text-domain (Notice the 'domain found is .' part) -
INFO: Only one text-domain is being used in this theme. Make sure it matches the theme's slug correctly so that the theme will be compatible with WordPress.org language packs. The domain found is .

== Testing Environment ==
PHP Version: 8.1.4
WordPress Version: 6.0.2
Theme Check Version: 20211203
Theme Slug: no-i18n

== To Replicate ==
I've created a basic theme with no translation to test this out quickly.
Repository - no-i18n
Theme Download Link - no-i18n.zip

@justintadlock
Copy link
Contributor

justintadlock commented Nov 16, 2022

I'll try to dive into this a bit more when I get a chance, but I believe we need to check whether $domains is empty here: https://github.com/WordPress/theme-check/blob/master/checks/class-textdomain-check.php#L215

Probably something like:

if ( ! empty( $domains ) && ! in_array( $correct_domain, $domains ) ) {

I'm not familiar enough with the internals of TC to know if that'll blow something else up yet.

justintadlock added a commit to justintadlock/theme-check that referenced this issue Nov 17, 2022
This commit addresses issue WordPress#430. When a theme doesn't use any of the internationalization functions, the `TextDomain_Check` class doesn't account for an empty array of found domains.
@dd32
Copy link
Member

dd32 commented Apr 17, 2023

Was this resolved by #435?

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

No branches or pull requests

3 participants