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

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

  • 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 – Mark Kaplun Aug 14 '17 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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