admin管理员组

文章数量:1287579

I'm prepping my theme for translation. I've added the following line to my functions.php, and added the text domain within my theme files.

<?php /*** LOAD THEME TEXTDOMAIN ***/
load_theme_textdomain( 'mytheme', get_template_directory() . '/languages' );

$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";

if ( is_readable( $locale_file ) ) {
    require_once( $locale_file );
}

?>

I've used poedit to generate my po files. It is finding some of the strings that are labeled with the text domain, but it's not finding my menu items, categories, or tags. Guessing I'm missing something?

I did some digging and I couldn't find any answers. Ultimately this is for a front-end translation - wp admin will remain in english.

BTW, the menu is based on wp-bootstrap-navwalker

I'm prepping my theme for translation. I've added the following line to my functions.php, and added the text domain within my theme files.

<?php /*** LOAD THEME TEXTDOMAIN ***/
load_theme_textdomain( 'mytheme', get_template_directory() . '/languages' );

$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";

if ( is_readable( $locale_file ) ) {
    require_once( $locale_file );
}

?>

I've used poedit to generate my po files. It is finding some of the strings that are labeled with the text domain, but it's not finding my menu items, categories, or tags. Guessing I'm missing something?

I did some digging and I couldn't find any answers. Ultimately this is for a front-end translation - wp admin will remain in english.

BTW, the menu is based on wp-bootstrap-navwalker

Share Improve this question edited Aug 4, 2014 at 14:14 Pieter Goosen 55.4k23 gold badges115 silver badges210 bronze badges asked Aug 4, 2014 at 14:08 roybattyroybatty 1131 gold badge1 silver badge12 bronze badges 2
  • ok, so i did a wp export using the default functionality in wp admin, and i noticed that my categories are included in the xml file. but i don't see the strings contained in my menu items. where do these live? seems they're not being pulled into my export or my .po files. i had a look at the translation docs at wordpress, and they seem to deal mainly with translating wordpress itself, but i'm not finding much about translating the actual content for a front-end translation. thanks for your help! – roybatty Commented Aug 6, 2014 at 15:00
  • 7 years later, I am in the same situation. Anyone can help? Thanks – Badr Louachama Commented Sep 18, 2021 at 15:36
Add a comment  | 

1 Answer 1

Reset to default 0

check this link: https://wiesmann.codiferes/wordpress/?p=25829

for translater your themes add Xili... Plugins that is multilanguages plugin. in there you can make po. file in Languages folder in themes folder, and translater it to any languages you want.

good luck

本文标签: textdomainHow to get menu stringscategories and tags into po file for translation