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

[New Sniff] Check that style.css contain a text-domain entry. #34

Open
2 tasks
jrfnl opened this issue Jul 18, 2016 · 4 comments
Open
2 tasks

[New Sniff] Check that style.css contain a text-domain entry. #34

jrfnl opened this issue Jul 18, 2016 · 4 comments

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Jul 18, 2016

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 second item on the list.

  1. All theme text strings are to be translatable. (Check that all text strings are translated and in the same language #33)
  2. Include a text domain in style.css
  3. Use a single unique theme slug – as the theme slug appears in style.css. If it uses a framework then no more than 2 unique slugs. ([Implement Sniff] Check that only one - or at most two - text-domains are used in the theme #35)
  4. Can use any language for text, but only use the same one for all text. (Check that all text strings are translated and in the same language #33)
  5. Correct usage of the WP i18n functions. ([Implement sniff] Verify that the i18n functions are used properly #31)

Refs:
https://make.wordpress.org/themes/handbook/review/required/#language
https://make.wordpress.org/themes/handbook/review/required/theme-check-plugin/#additional-checks

The second item should be quite doable to implement as a sniff which checks the CSS files until it finds the one called style.css and only then searches for the required text string.

Theme check file covering this rule:

https://github.com/Otto42/theme-check/blob/master/checks/textdomain.php

To do:

  • Create unit tests -> this will be the hard part in this case
  • Create new sniff
@khacoder
Copy link
Contributor

The text domain in style.css needs to be the theme slug as well. It would be good if this could be checked at the same time I think. Though getting the theme slug might prove tricky.

@jrfnl
Copy link
Contributor Author

jrfnl commented Jul 19, 2016

The text domain in style.css needs to be the theme slug as well. It would be good if this could be checked at the same time I think. Though getting the theme slug might prove tricky.

That's in point 3 / #35, but yes these two items might possible be combined implementation wise.

@khacoder
Copy link
Contributor

khacoder commented Aug 12, 2016

I have included action item 2 above in Issue #50

@dingo-d
Copy link
Member

dingo-d commented May 18, 2019

Is this something we want to work on, any volunteers? Or should I leave this for the Theme Sniffer?

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

No branches or pull requests

3 participants