-
Notifications
You must be signed in to change notification settings - Fork 5
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
Introduce $piglatin_domains and piglatin_domains filter #6
Conversation
@nb Spacing fixed up. |
Thank you for the contribution, @rmccue! I am still thinking what would be the best way to enable/disable the plugin in different situations. See, for example #3 for another example of this problem. Could you explain in what use case did you need to filter by domain? Few notes about the code:
|
Thanks for the fantastic plugin! :)
Yeah, I'm not too concerned about disabling on the fly. For me, it's a local development thing, so toggling one line in
Sure! When developing plugins, it helps to be able to visually check that you've included the correct domain in your translations. Pig Latin is great for finding untranslated strings, but not for checking that. It's really easy (and really common) to accidentally leave the domain out. I also use Pig Latin to help visually check translation on projects with more than one text domain; for example, Happytables's dashboard has the domain
I agree. The alternative is to pass it into
Alas, a global is the only way to get it to work with adding things into |
I agree. Though I not entirely agree that it should do that. In general add-textdomain.php is pretty good at this. In your case, since one file has more than one domain using this tool might be tricky. I don’t think we should include this change, because the majority of the users of the plugin won’t benefit from it. However, I think it would be great if we add a filter, which will let you selectively disable the plugin – either based on domain, on an UI option, on the current environment (dev/translate/production), or on anything you’d like. Pull requests are, again, welcome :-) |
FYI our team is often using the piglatin plugin to verify that we're internationalizing our plugins. But it of course doesn't catch problems when we accidentally leave off our textdomain from the i18n method calls (eg, when we do |
Fixes #4. Adds both the
$piglatin_domains
global variable and apiglatin_domains
filter.By default, allows all domains unless either of the above is used, in which case, only uses domains set in that variable. To use, add something like this to your
wp-config.php
: