• Having trouble wrapping my brain around translations. To set it up, you do these steps (I think):

    Enable translations:

    load_theme_textdomain('my_domain_identifier', get_template_directory() . '/languages' );

    Create my .pot file with any text I want translatable, for example:

    #: functions.php:88
    msgid "Sidebar"
    msgstr ""

    …where the comment shows where it’s used in my code, and the text itself, labelled msgid (why is msgstr blank?)

    Then, in the code, rather than direct text, I use:

    __( 'Sidebar', 'my_domain_identifier' )

    or _e(...) if I want to echo it.

    What I don’t quite get is that my language file doesn’t say it’s English, for instance. It’s just called ‘domain.pot’

    What happens if I want a Spanish translation?

  • The topic ‘l10n and load_theme_textdomain’ is closed to new replies.