FacetWP / use-child-theme

A WordPress class to ensure that a child theme is installed and active
65 stars 21 forks source link

Allow text domain to be overridable with a filter #15

Closed Nikschavan closed 8 years ago

Nikschavan commented 8 years ago

When using this class inside a theme, theme authors will want to localize the strings with their text domain to provide unified translations.

I suggest providing a filter that will allow theme authors to override the text domain without hacking into this class.

mgibbs189 commented 8 years ago

@Nikschavan thanks for this - see https://ulrich.pogson.ch/string-text-domain-must

webmandesign commented 8 years ago

Hi,

Filtering text domain is not allowed.

The text domain has to be plain text, and it equals to theme slug. Yes, indeed, no other value is allowed by WordPress.org (I have my experience...).

Using a filter in text domain is the same as using it as variable I think, which is not permitted.

But maybe I'm wrong and you have some valid usecase with filtered text domains approved by WPORG?

(Please note that I'm not native English speaker and I have quite a few experience with translating WordPress ;) )

Regards,

Oliver

Nikschavan commented 8 years ago

Thanks @webmandesign,

I did some searching about this, it seems a passing a variable in gettext functions does not work nicely with automated translations so only texts with single quotes are preferred. Learned something new today.

More info -

http://ottopress.com/2012/internationalization-youre-probably-doing-it-wrong/ https://markjaquith.wordpress.com/2011/10/06/translating-wordpress-plugins-and-themes-dont-get-clever/

webmandesign commented 8 years ago

So, I'd say we are left with #14 option only, unfortunately...