I18n: do not report `NonSingularStringLiteral` for low level functions
swissspidy opened this issue · 2 comments
Is your feature request related to a problem?
Right now, the i18n sniff reports NonSingularStringLiteral
errors to translate
and translate_with_gettext_context
functions.
The whole point of this sniff is to ensure string extraction works correctly when using the typical translation functions like __()
. However, translate
and translate_with_gettext_context
are not used for string extraction by tools like WP-CLI's i18n command, which is the tool translate.wordpress.org uses.
So I don't really see a reason for reporting this error for these two functions.
Describe the solution you'd like
Do not report NonSingularStringLiteral
errors for translate
and translate_with_gettext_context
functions.
Additional context (optional)
The sniff already reports LowLevelTranslationFunction
errors when using the low-level translate
and translate_with_gettext_context
functions. That is fine, plugins and themes don't really have a reason to use these. And if they do, they can suppress the errors.
While I get where you are coming from, WP-CLI's i18n command isn't the only way translation files are created...
There is gettext
, POEdit, grunt i18n
commands etc. And while those may not be commonly in use for WP related code hosted on WP.org, there is a huge market of commercial and proprietary plugins and themes where those other tools are being used.
@swissspidy Any response to my reply ? If not, I suggest we close this issue.