1

I am working on a plugin for myself, so, it's totally useless to load textdomain. But most of codes I copied from others are using the __(' ','') I copied the codes from several plugins. So, even if I load textdomain, it's going to be useless as well,posibly slow down the performence. My question is-- What's going to happen when WP read those __(' ','') without a textdomain loaded ? Will it become a problem?

2 Answers 2

1

I've actually been in the exact situation you're in before, all you need to do is drop the __()s and the _e()s and replace them with their first parameter, you can pretty easily do this by regex if there are a lot, and it's quick to do by hand if there aren't...I'm not sure what the performance penalty on them is, especially if they're empty, but I'm a bit of a performance hound, so it wasn't something I was going to risk.

2
  • That's a lot of job if I try to remove the textdomain signs. but if I don't remove it, I fear WP might get confused and searching around for the texdomain.
    – Jenny
    Jan 24, 2012 at 14:52
  • Nope, you're good to go just leaving them in. You can just regex for them using your favorite text editor, a regex along the lines of _[_e]\([ ]?\'[^\']*\'([ ]?,[ ]?\'[^\']*\')?[ ]?\) should get them all (I drew that up in the comment box, so don't be surprised if you needa tweak it lol)
    – mor7ifer
    Jan 24, 2012 at 21:47
2

If you are not localizing your theme/plugin, then these functions are quite useless. Their main purpose is to search through the localization module for translated text.

To answer your question, it will not become a problem I don't believe, but is pretty useless if you are not translating your theme or plugin into a different language - but somebody else might want to if they get their hands on your plugin/theme, so it is good to include if your product is going out to the public.

See here for more info on these:

http://codex.wordpress.org/Translating_WordPress#Localization_Technology

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.