[theme-reviewers] Is this the best solution to translate a template name in WordPress

Otto otto at ottodestruct.com
Wed Aug 28 15:46:26 UTC 2013

On Wed, Aug 28, 2013 at 10:17 AM, Zen Oven <zenoven at gmail.com> wrote:
> Hi,
> I am a theme author and I know how to translate strings in WordPress with
> __(), _e and some other PHP functions, but I have no idea how to translate a
> template name because the template name is written with PHP comment in the
> header.
> I found this on stackoverflow >>
> http://stackoverflow.com/questions/13561410/how-to-translate-a-wordpress-template-name
> Is this the best solution ?

WordPress does allow for translation of the fields in the Headers via
the "Text Domain" and "Domain Path" headers. These should be the text
domain of the theme, and the relative path in the theme to the
translation files, respectively. Header fields are then passed through
those domains using the translate() functions.

However, dummy text isn't needed to put them into the translation POT
file. Look at Twenty Thirteen's POT file for example. It just has the
various headers added on at the end. If you're using the WordPress
makepot.php tools to generate your pot files, it will add these
headers into the POT file for you automatically.

See tools here: http://i18n.svn.wordpress.org/tools/trunk/

Now, for the specific case of "Template Name", I think it leaves that
one out. But you can add them manually to the POT file, or modify the
tool to add those as well. A dummy entry as suggested in the
stackexchange post will work too, but obviously isn't particularly


More information about the theme-reviewers mailing list