Community Forums › Forums › Internationalization and Translations › Some strings doesn't translate if MO file placed within themes' language folder
- This topic has 3 replies, 2 voices, and was last updated 3 years ago by 123satchipanda.
-
AuthorPosts
-
July 18, 2019 at 6:59 pm #492427123satchipandaMember
Hello,
I'm trying to translate the child theme, Academy Pro to be specific, but there are some strings that are not translated.
If I place the MO file inside wp-content/language folder as "wp-content/languages/themes/academy-pro-ja.mo", then it translates the whole theme, but if I place it within theme folder as "wp-content/themes/academy-pro/languages/ja.mo", then there are some strings left behind as English.
I believe this is due to how WordPress loads translation file, but is there any solution to this problem? I want the translations to be loaded even when PO/MO files are in theme-name/languages folder.
For example, the override of the menu name from Academy Pro's function.php doesn't get translated:
// Renames primary and secondary navigation menus. add_theme_support( 'genesis-menus', array( 'primary' => __( 'Header Menu', 'academy-pro' ), 'secondary' => __( 'Footer Menu', 'academy-pro' ), ) );
The "Header Menu" and "Footer Menu" shows as it is, and doesn't get translated even though I have those strings in my PO/MO files.
Looking forward to hearing any advice to solve this.
Thanks,
Satoshi O.July 19, 2019 at 6:31 am #492431Victor FontModeratorIf you change the language files location, you also have to change the textdomain by editing this function in functions.php:
function academy_localization_setup() { load_child_theme_textdomain( 'academy-pro', get_stylesheet_directory() . '/languages' ); }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 20, 2019 at 8:22 am #492437123satchipandaMemberHello Victor,
Thank you for your prompted reply.
Actually, I didn't change the location from the default.
I've followed the instruction of this page for locating the PO/MO files for the theme, which tells you to install the PO/MO files/wp-content/themes/your-theme/languages
.In this case, I believe that isn't the actual issue for this case since other parts from the themes are translated correctly (even the strings from the child theme).
To be more specific, I haven't checked all of the child themes, but they tend not to get translated in the "Menu" section and "Widget" section from the customizer.
The Menu names like "Header Menu" or "Footer Menu", and also the Widget section names like "Footer 1", Footer 2"... doesn't get translated when PO/MO files are installed within/wp-content/themes/your-theme/languages
.Am I clear enough on explaining what's going on here?
Please let me know if something's missing.Thanks,
Satoshi O. -
AuthorPosts
- You must be logged in to reply to this topic.