0

I am using Yoast' method to build an HTML site map. But it needs to be translated.

It uses a page template page-sitemap.php that uses a template part

<?php get_template_part('/partials/sitemap');  ?>

In this template part I...

load_textdomain( 'site-map', TEMPLATEPATH.'/partials/languages' );

The path is right for I list the files of the folder TEMPLATEPATH.'/partials/languages' and it shows my language files.

As you see my domain name is 'site-map'. My .mo file is site-map-fr_FR.mo.

Why can't it be loaded?

Thanks for any clue, nicolas

6
  • 1
    Try Debug Translations. Do you get any useful output?
    – fuxia
    Commented Nov 28, 2013 at 13:11
  • load_textdomain returns boolean value. Can you check what it returns in your case? Commented Nov 28, 2013 at 17:20
  • thanks for your answers, @Chittaranjan : It return false ! (sorry i forgot to mention this important point.)
    – Nicolas
    Commented Nov 29, 2013 at 9:31
  • @Toscho : i go for the plugin, I didn't it ! :)
    – Nicolas
    Commented Nov 29, 2013 at 9:31
  • So either the mo file is not readable or the import fails. Check here codex.wordpress.org/Function_Reference/load_textdomain Commented Nov 29, 2013 at 10:24

1 Answer 1

-1

I found the answer: load_textdomain( 'site-map', TEMPLATEPATH.'/partials/languages' ); ... gives the path of the folder containing the .mo file. but the path of every individual mo file should be used in its own load_textdomain instruction :

load_textdomain('site-map', TEMPLATEPATH.'/partials/languages/site-map-fr_FR.mo'); 
load_textdomain('site-map', TEMPLATEPATH.'/partials/languages/site-map-en_US.mo'); 
load_textdomain('site-map', TEMPLATEPATH.'/partials/languages/site-map-es_ES.mo'); 
load_textdomain('site-map', TEMPLATEPATH.'/partials/languages/site-map-ru_RU.mo'); 
load_textdomain('site-map', TEMPLATEPATH.'/partials/languages/site-map-de_DE.mo');

Shame on me it is a very obvious and useless thread ... Sorry!

1
  • this is obviously wrong, as wordpress is supposed to find the relevant file based on the "current" locale. You are not supposed to find the right file by yourself Commented Aug 14, 2017 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.