Title: Discussion: Theme Internationalization
Author: Chip Bennett
Published: February 10, 2011
Last modified: March 16, 2012

---

 [  ](https://profiles.wordpress.org/chipbennett/) [Chip Bennett](https://profiles.wordpress.org/chipbennett/)
11:11 pm _on_ February 10, 2011     
Tags: [Discussion Topic ( 5 )](https://make.wordpress.org/themes/tags/discussion-topic/),
[Guidelines ( 34 )](https://make.wordpress.org/themes/tags/guidelines/), Internationalization

# Discussion: Theme Internationalization

How should Themes handle Internationalization?

Currently, Internationalization is **recommended**, and if internationalization 
is incorporated, Themes are **required** to use _theme-slug_ as a unique textdomain.

What else should be considered? For example:

 1. If Themes include translation, should all strings be required to be translatable?
 2. If Themes do not include translation, should any strings be translatable?
 3. What else should be considered?

In other words: what constitutes best-practice, and what should be avoided, when
implementing Theme internationalization?

[#discussion-topic](https://make.wordpress.org/themes/tags/discussion-topic/), [#guidelines](https://make.wordpress.org/themes/tags/guidelines/),
[#internationalization](https://make.wordpress.org/themes/tags/internationalization/)

### Share this:

 * [  Threads ](https://make.wordpress.org/themes/2011/02/10/discussion-theme-internationalization/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/themes/2011/02/10/discussion-theme-internationalization/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/themes/2011/02/10/discussion-theme-internationalization/?share=bluesky)
 * [  Facebook ](https://make.wordpress.org/themes/2011/02/10/discussion-theme-internationalization/?share=facebook)
 * [  X ](https://make.wordpress.org/themes/2011/02/10/discussion-theme-internationalization/?share=x)
 * [  LinkedIn ](https://make.wordpress.org/themes/2011/02/10/discussion-theme-internationalization/?share=linkedin)

 1.  ![](https://secure.gravatar.com/avatar/250257111d1248c34046552bbcdf6999949ef56b2f992dd5eb39bf45cabeb18a?
     s=32&d=mm&r=g)
 2.   [Otto](https://profiles.wordpress.org/otto42/)  11:23 pm _on_ February 10, 2011
 3.  The only thing I would suggest watching out for is to make sure that it is correctly
     implemented. This can be trickier than it seems.
 4.  For example, this is wrong. Why it’s wrong is not necessarily immediately obvious.
 5.  _e(“Title: {$title}”, ‘example-theme’);
 6.  Things like that are not necessarily going to be immediately noticed by some theme
     developers. I see errors in this same manner in plugins all the time.
 7.  Another example of wrong:
 8.  $text = ‘whatever’;
      _e($text);
 9.  And so forth. All this is covered in the reference material on the codex, but 
     it would help everybody to give that a read through and to try to understand why
     it works the way it does. Then you can spot errors like these much quicker.
 10. [https://codex.wordpress.org/I18n_for_WordPress_Developers](https://codex.wordpress.org/I18n_for_WordPress_Developers)
 11. ![](https://secure.gravatar.com/avatar/d01d0aa0d7b7deb68832fe9c8565bae3a19464a4dd76e8a0ee675cec3b679758?
     s=32&d=mm&r=g)
 12.  [Sayontan](http://mynethome.net/blog)  11:38 pm _on_ February 10, 2011
 13. I would suggest drawing a line between front-end strings and back-end strings 
     for point #1. So basically if a theme has translation enabled, any public-facing
     string should be translatable, while a string visible in the admin panels might
     be optionally translatable. For themes that tend to have a lot of options, this
     will be of great benefit.
 14. Continuing along the same lines, themes with translation on the front-end and 
     the back-end might be allowed to use different domains for the two sets of strings,
     if required. E.g. theme-slug and theme-slug-admin. Of course, you could have just
     one domain, but this should be left to the theme author’s discretion.
 15. My line of thinking comes from doing the support for my theme, where all translations
     are provided by volunteers and lumping both front-end and back-end together will
     slam the volunteers with a lot more work.
 16. ![](https://secure.gravatar.com/avatar/a2293936b68aa6f07397754f9d1ae2b771b12ad56f868a980206b8d96f1bad31?
     s=32&d=mm&r=g)
 17.  [Michael Fields](http://wordpress.mfields.org/)  11:54 pm _on_ February 10, 2011
 18. One thing that I’ve been trying be more conscious about is escaping output. Might
     it be a good idea to suggest use of functions like esc_attr__() and esc_htm__()
     where appropriate?
 19. ![](https://secure.gravatar.com/avatar/ef868a4b45ef0263f49361744b8bb04e8f3cfcb8f3f79b274fc62823115ee596?
     s=32&d=mm&r=g)
 20.  [Justin Tadlock](http://justintadlock.com)  12:10 am _on_ February 11, 2011
 21. Crap. Tried to post this while logged in. Let me log out so I can actually post
     a comment.
 22. I don’t care about the theme template as the textdomain. For example, the theme“
     Super Duper Awesome Something” would have a template name of `super-duper-awesome-
     something`. I’d rather see the theme go with `sdas` for the textdomain.
 23. What’s important to me is that themes use the proper functions for translation(
     there are quite a few of them), use placeholders when necessary, and use a *unique*
     textdomain.
 24. 99% of the time though, themes should use their template name for the textdomain.
 25. ![](https://secure.gravatar.com/avatar/acdecddd34500ea3902e530d670395a027d4173672fc246a82c4f5b421c10a7f?
     s=32&d=mm&r=g)
 26.  [Frumph](https://profiles.wordpress.org/frumph/)  8:35 am _on_ February 11, 2011
 27. *most* of the reviewers just only care if its a derivative of the theme name, 
     acronym or otherwise as long as its distinct and unique and consistent.
 28. ![](https://secure.gravatar.com/avatar/5e52265402626dacf1e982ee9b7c2f0c7cbfc58f6fe8620d44cbb842cd83ddc6?
     s=32&d=mm&r=g)
 29.  [esmi](http://quirm.net/)  11:53 am _on_ February 11, 2011
 30. I’d like to see a lot more feedback from translators. Even using the Codex as 
     a guide, there is often more than one “correct” way to encode a string for translation.
     But I’ll bet that some methods make translation much more difficult when working
     with strings that are out of context. If there’s going to be any kind of best 
     practice guide, it needs to cover more than just the technical points.
 31. ![](https://secure.gravatar.com/avatar/ef868a4b45ef0263f49361744b8bb04e8f3cfcb8f3f79b274fc62823115ee596?
     s=32&d=mm&r=g)
 32.  [Justin Tadlock](http://justintadlock.com)  4:34 pm _on_ February 11, 2011
 33. Theme reviewers need to be aware of these things:
 34. 1) The use of placeholders is definitely something I see themes get wrong.
 35. Good example: `printf( __( '%s something', 'domain' ), $variable )`.
 36. Bad example: `printf( __( '%s something %s', 'domain' ), $variable, $variable_2)`.
 37. 2) Breaking strings up into separate sections is bad.
 38. Bad example: `_e( 'By', 'domain' ); the_author(); _e( 'on', 'domain' ); the_time();`.
 39. 3) All of the different translation functions and in what context to use each.
 40. Good example in an element attribute: `esc_attr_e( 'Title of link', 'domain' )`.
 41. ![](https://secure.gravatar.com/avatar/40fca12fbb1fdd069107780194c42d9f82cfff5d757e1f19a5d25edfb17bae28?
     s=32&d=mm&r=g)
 42.  [Lance Willett](http://simpledream.net/)  3:56 pm _on_ February 16, 2011
 43. From the “Best Practices” section on [https://codex.wordpress.org/I18n_for_WordPress_Developers](https://codex.wordpress.org/I18n_for_WordPress_Developers)
     I’d like to highlight:
 44. Wrap entire sentences—in most languages word order is different than that in English.
     
     Avoid unusual markup and unusual control characters—do not include tags that surround
     your text and do not leave URLs for translation, unless they could have version
     in another language. Do not leave leading or trailing whitespace in a translatable
     phrase.
 45. I would add to that:
 46. Do not try to translate empty strings: `_e( '', 'themename' );`
 47. ![](https://secure.gravatar.com/avatar/34368b9c92a4bfa3bd2a84a222147375526d5ccfbbb3afe32abfbd1bc37f5b58?
     s=32&d=mm&r=g)
 48.  [Peter Westwood](https://profiles.wordpress.org/westi/)  2:19 pm _on_ February
     17, 2011
 49. Some more from me:
 50. Don’t have leading or trailing space in the string to be translated as it too 
     often gets lost in the translation and then things get bunched up incorrectly
     
     Don’t translate things which don’t need translating – individual special chars
     for example like | – this can break the visuals on a theme quite a lot if they
     get incorrectly translated

Comments are closed.

# Post navigation

[← I updated Log Deprecated Notices to 0.2-…](https://make.wordpress.org/themes/2011/02/09/i-updated-log-deprecated-notices-to-0-2/)

[I’ve made a few changes to the theme up… →](https://make.wordpress.org/themes/2011/02/11/ive-made-a-few-changes-to-the-theme-up/)