Why should I use a domain for l18n?

I’m creating a WordPress theme, and I’m wondering why I should even use a domain parameter for my calls to __() and _e()? Can’t I just use the default domain; what will happen if I use the default domain? What happens when I do use a custom domain? Is it just so that you can choose two different languages for two separate themes? Why would I need that? Please someone explain what this domain is for and how it’s used.

Please don’t just send me links to the codex. I’d really appreciate it if someone could just be straight forward and explain it out right. Thanks. 🙂

Related posts

Leave a Reply

2 comments

  1. If you only use standard texts that are already included in the WP default .po files, there is no need to use a custom domain. In fact using the default domain would be a better idea, as your theme will be automatically be translated using the default .po files of any local WP version.

    Using your own domain will allow you to use your own words and enable users to write there own .po file to translate it to their language. You might want to combine the usage of the default domain and your own domain, to get the best of the two variants. Although the result might be, that in languages you don’t offer a .po file and the user haven’t translated the file himself, he will have a partly translated theme.

    But to I18n is a very good idea, no matter if you use your own domain or the default domain. Every power user will highly appreciate that. I had to I18n the theme I used myself and so I know how much work it might be.

  2. A gettext text domain is a namespace for messages. When looking up a message, gettext will only consider messages in the domain you asked for (either explicitly specified, or setup earlier in a call to textdomain()).

    Text domains are also used for file names; lookup of a catalog will use language and domain to locate the file.