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

[Implement sniff] Verify that the i18n functions are used properly #31

Closed
1 of 2 tasks
jrfnl opened this issue Jul 18, 2016 · 2 comments
Closed
1 of 2 tasks

[Implement sniff] Verify that the i18n functions are used properly #31

jrfnl opened this issue Jul 18, 2016 · 2 comments

Comments

@jrfnl
Copy link

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 fifth 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 ([New Sniff] Check that style.css contain a text-domain entry. #34)
  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.

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

There is an existing sniff within WPCS which has extensive coverage in checking whether the i18n functions are used correctly.

Theme check file covering this rule:

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

To do:

  • Add existing WordPress.WP.I18n sniff to the ruleset.
  • Maybe add some more information to the handbook about what the correct usage is of the i18n functions ?
@grappler
Copy link
Member

The theme review handbook should only contain the requirements. The documentation for i18n for themes can be found in the theme development handbook https://developer.wordpress.org/themes/functionality/internationalization/

grappler pushed a commit that referenced this issue Jul 28, 2016
grappler pushed a commit that referenced this issue Sep 27, 2016
@grappler
Copy link
Member

grappler commented Dec 3, 2016

Closing as the PR is merged

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

2 participants