-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Implement Sniff] Check that only one - or at most two - text-domains are used in the theme #35
Comments
I'm in favor of creating a whitelist of allowed extra textdomains (or textdomains to ignore). I'd be happy to gather that list if the team agrees. I think that's a far better approach. And, we can always add new textdomains to the list if/when another framework pops up that needs to be accounted for. |
Here's the current list of exceptions (Twenty* textdomains copied from TC). I've sent out a few DMs to known framework authors to get their feedback.
|
@justintadlock Did you get any feedback from others? |
Here's a possible list that aristath and dovy help put together. I do not know whether these frameworks properly handle their own textdomains and/or language files when included in a theme though. That'd be the only reason we'd want to whitelist them.
|
We'd also like to have our framework added to this list: "cryout" that we use in all our currently live themes. Seeing the list Justin submitted I'd also have a far-fetched proposal, at least for the theme specific frameworks (tgmpa is not really a theme framework, is it?). They should all have a standard naming format (something like "name-framework") so it would be easier to identify and recognize when editing or reviewing themes. Also, something like "options-framework" seems far too generic, like having a "theme" text domain. And what if somebody uses one of these "whitelisted" textdomains in their themes for other purposes, unrelated to the frameworks. How will Theme Check sniff this out? And on the "no more than 2 theme domains" rule. What if you're using a theme framework and tgmpa for suggesting plugins? You'll be forced to either let one go or rename it, kind of missing the whole point of using frameworks and/or WordPress translations. |
We must have a requirement that the framework needs to fulfill to be whitelisted. e.g. "The framework must handle the text domain correctly and include translation files."
With a whitelist I expect we can will not need a limit on the number of text domains. |
Here's another one: |
I wanted to touch on this because there are 2 separate methods for making this work.
If the framework is not employing one of these two methods (can't think of any others), translations will not work. Edit: So, basically, if you want the framework whitelisted, you need to show that it's handling translations. |
Here's another one: meta-box |
@cristianraiber @rinkublog Please could you give a bit more information like where the framework can be found and show that it is handling translations. |
@grappler here is plugin https://wordpress.org/plugins/meta-box/ and i think here it is handling translation https://plugins.svn.wordpress.org/meta-box/trunk/inc/core.php But theme check: WARNING: The theme uses the add_shortcode() function. Custom post-content shortcodes are plugin-territory functionality. for this plugin. |
@grappler - you're right; how about |
Yes, that makes it clear what it is. |
@grappler - great, thanks! |
We'd like to have added to white list our Cherry Framework with |
Any news about this guys? Theme upload faiks because of duplicate text-domains |
@cristianraiber If you are running your own checks you can define the text domains. This is explained here: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#internationalization-setting-your-text-domain If you are talking about the new Theme Sniffer plugin, then you can contribute a file that will always exists in your framework and that we can check exists. |
@grappler - makes sense re. the new Theme Sniffer plugin, but I was under the impression that both theme check plugins will exist side by side... How do I get our text-domain approved in both? |
@cristianraiber I don't think |
Just noting that I've confirmed |
I think that prefix all globals sniff covers the use-case of multiple text domains. @jrfnl @justintadlock can you confirm this? If it's the case, we can close this issue 🙂 |
Nope, different sniff, not the same thing. |
Rule type:
Error
Rule:
From what I can see, there are actually 5 distinct i18n related rules which may need sniffs - this issue covers the third item on the list.
Refs:
https://make.wordpress.org/themes/handbook/review/required/#language
https://make.wordpress.org/themes/handbook/review/required/theme-check-plugin/#additional-checks
This requires a slightly different implementation, the existing
WordPress.WP.I18n
sniff can check whether all i18n functions use the same text domain. For that check, the text domain - at this moment - will have to be provided via the phpcs config file or programmatically. I suggest this text domain injection into the PHPCS configuration will be implemented in the Theme Check wrapper which will call PHPCS in order to enable this check.Note: it is being investigate upstream whether the text-domain can be determined from the files. If that would be implemented, no further action would be needed for the Theme Check plugin.
Currently the
WordPress.WP.I18n
sniff only checks against the one text domain and does not keep track of the found text domains (other than reporting them in the error message)Theme check file covering this rule:
https://github.com/Otto42/theme-check/blob/master/checks/textdomain.php
Decision Needed:
Request for decision: How should we deal with extra (allowed) text-domains ? Is there a white-list of extra text-domains related to frameworks which can be checked against ?
To do:
WordPress.WP.I18n
sniff to keep a count of all encountered text-domains and report if the count is more than two.The text was updated successfully, but these errors were encountered: