WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
269 stars 3 forks source link

[i18n] Make theme sniffer fully translatable #163

Open fr-laurentn opened 5 years ago

fr-laurentn commented 5 years ago

Hi,

Thanks for this great plugin.

I translated the plugin to fr_FR, however not all the strings are translatable from translate.wordpress.org.

For instance, the standards name are not translatable, therefore we can't apply local typographical rules: image (we're supposed to have an non-breaking space before the : )

It would also be nice if we could translate the results.

Thanks in advance.

dingo-d commented 5 years ago

Thanks for the reported issue.

The standards name are not translatable, as they are the official names of the standards (like you wouldn't translate Zend, PSR etc.). I'd have to look into the non-breaking space before the :, not 100% sure what the issue is with this.

The results are derived from the PHP_CodeSniffer, and I'm not 100% sure it's possible to translate these. The results are passed down to JS, and then back to PHP via AJAX.

Maybe it would be possible to translate these, but I'm currently out of ideas how to do this.

Suggestions are welcomed of course 🙂

fr-laurentn commented 5 years ago

Thanks for your quick answer.

I understand the issue with the standards names, my concern is only with the non-breaking space.

For the results, I'm not a developer, so I won't be helpful here ^^ Can't you use https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress?

Thanks,

dingo-d commented 5 years ago

I'll look into the issue with the non-breaking space 🙂

As for the results, the issue is that the error and warning strings (in most cases) are coming from the phpcs script. So it's the script output that's just being consumed. Theme Sniffer is registering some of the error messages, but those coming from the phpcs, I have (yet) no idea how to handle.

I'll have more time for cleaning up the issues and releasing the new version in the coming weeks so I'll look into this 🙂

fr-laurentn commented 5 years ago

Thanks for taking the time to look into this! I appreciate that.

Good luck and let me know if you need help to do some testing.

fr-laurentn commented 5 years ago

Hi Denis,

I'm not sure if this helps but I asked for ideas on the French WP Slack and someone sent me this link: https://developer.wordpress.org/reference/functions/wp_set_script_translations.