The MU forums have moved to

Localization for themes not working (9 posts)

  1. Konstan
    Posted 17 years ago #

    I have translated several themes using poEdit, creating all the necessary files and stuff and named them es_ES for each theme.

    But, they are not being picked up by the themes :(

    I installed the theme freshy which comes internationalized and had its own es_ES file already, and to my surprise it did work! But none of the ones I translated seems to be picking up the es_ES file in the respective theme folder.

    I tried load_theme_textdomain('theme')?> but it didnt work either.

    What else can I try?

    Edit: the freshy theme came with several po/mo files, I deleted them all except the one I needed, es_ES. I uploaded the theme and it was translated.

    Then I went ahead and translated other themes, and did the same. Upload the theme and the respective es_ES file. But no worky :(

    If one theme works, why wont all the other behave the same? WPLANG is set to es_ES

  2. Konstan
    Posted 17 years ago #

    Nevermind, I managed to get it working.

    I am now localizing all my themes and then finish the translations.

  3. enseignement
    Posted 17 years ago #

    How have you managed this ??
    Do not hesitate to share your tips !

  4. Konstan
    Posted 17 years ago #

    I had to edit the templates to include a ,TEMPLATE_DOMAIN after the phrases in all instantces of _e and __

    And I had to add 2 lines of code to each header with the name of the template so it would read the es_ES.

  5. enseignement
    Posted 17 years ago #

    could you post here both examples ?
    the header and one example of the instance.
    Then, where did you put the .mo ?

  6. Konstan
    Posted 17 years ago #

    Ok, here is what I did to get it working:

    First, you have to add ,TEMPLATE_DOMAIN to all instances of _e and __, like this:

    <?php _e('Comments are closed.',TEMPLATE_DOMAIN); ?>

    Then in header.php, you have to add this at the top:

    <?php load_theme_textdomain(TEMPLATE_DOMAIN); ?>

    The PUT_THE_TEMPLATE_FOLDER_NAME_HERE means that if you uploaded a theme folder /my-theme/ to /wp-content/wp-theme/, you put my-theme as the name.

    Then you have to upload the .mo file to the same directory where your theme is. You must have defined the language file in your config.php

    You need to name the .mo file accordingly. If you have es_ES as your language, all your .mo files should be

    Thats it, I think.

  7. enseignement
    Posted 17 years ago #

    Looks like a lot of time ... Do you have done this job for some themes ?

    I could translate your work in French.


  8. Konstan
    Posted 17 years ago #

    I have a few themes nearly 100% translated like this, but then I got lazy and only translated a little bit more, hard coding all the language stuff.

  9. mzeecedric
    Posted 16 years ago #

    Sorry, I still can't get this to work. I have K2-Theme running. What I did is:

    1. set de_DE in wp-config
    2. put in wp-content/themes/k2 folder.
    3. add code to header.php:

    <?php define ('TEMPLATE_DOMAIN','k2'); ?>
    <?php load_theme_textdomain('TEMPLATE_DOMAIN'); ?>


    3. edit the template-domain in the loop from ,k2_domain to TEMPLATE_DOMAIN

    -> No results.
    Did I really get you right? Do I have to replace the existing domain (k2_domain) with the term "TEMPLATE_DOMAIN"? Any hints what I am missing?

About this Topic

  • Started 17 years ago by Konstan
  • Latest reply from mzeecedric