Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm building a new design into WP and so technically it is a theme, however it is only a design for one site and won't be a theme anyone can use and hence I don't want to bother with internationalization.

I have noticed WP makes use of internationalization in many functions by passing in the textdomain via functions such as..

_e( 'Featured', 'twentyeleven' );
esc_attr__( 'Permalink to %s', 'twentyeleven' )

How I have been told that it's a bad idea to remove the textdomain as it may end up with odd results, but if I'm not bothering with internationalization what do I do?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

It is only a design for one site and won't be a theme anyone can use and hence I don't want to bother with internationalization.

If the theme will only ever be used by you, internationalization isn't a huge deal. Unless, of course, you will want to use a different language version of your theme in the future.

However, it's a good idea to get in the practice of always internationalizing your work. This way, if you ever change your mind about the theme (i.e. decide to release it later) you've already got the work done.

Most often it's just replacing a few lines of code:

echo 'Some string';

Becomes:

_e( 'Some string', 'your-theme-textdomain' );

And:

return 'Some string';

Becomes:

__( 'Some string', 'your-theme-textdomain' );

How I have been told that it's a bad idea to remove the textdomain as it may end up with odd results.

If you omit the textdomain from either __() or _e(), WordPress will assume you're using the default textdomain that ships with core. And yes, some odd results will occur, but they aren't too bad.

For example, WordPress internally can translate "Post" and "Add New" but not "My super cool theme." When your theme is translated, anywhere you passed in "Post" and "Add New" without a textdomain will be translated, but "My super cool theme" won't.

If I'm not bothering with internationalization what do I do?

If you're not going to worry about internationalization at all, then just don't use __() or _e() at all and you won't need to worry about textdomains either.

share|improve this answer
    
Great answer - thanks! What about other functions that use it, such as _x? Just stop using them too or use the alternative function such as esc_attr over esc_attr__? –  Brett Sep 26 '12 at 15:49
    
If you're not internationalizing your theme, don't use any of the internationalization functions. –  EAMann Sep 26 '12 at 16:56
add comment

If you're not distributing it, then you don't really have to bother with internationalizing it unless the client wants to make it translatable.

In which case you don't need to use _e() or __() or any other functions like those. And in that case, the textdomain doesn't make any difference at all.

Themes like twentyeleven and such are distributed to millions of people. Translating those is rather more important.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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