I am using Buttercream as my parent theme. I have translated the .mo file located in themes\buttercream\languages and saved it as nl_NL.mo and nl_NL.po. Now I want to display the parent theme in Dutch (nl_NL). I can't edit functions.php of the parent theme because if it gets updated I'll lose my changes.

What do I have to do to get the theme in another language?


I think you can just move the languages folder to /wp-content/languages/ then you prevent the theme to update your translations of the theme. And then you can add your own little plugin to change the load_theme_textdomain path to the new folder in wp-content:

Add this as a plugin in /wp-content/plugins/buttercream-lang.php

 * Plugin Name: Buttercream Custom Language
 * Plugin URI:  https://github.com/pontusab/buttercream-custom-language
 * Text Domain: buttercream
 * Domain Path: /wp-content/languages/
 * Description: Add your own languages to Buttercream without losing when update.
 * Author:      Pontus Abrahamsson <info@wdlinkoping.se>
 * Author URI:  http://pontusab.se
 * License:     MIT
 * License URI: http://www.opensource.org/licenses/mit-license.php

add_action( 'after_setup_theme', 'wpse_load_languages' );

function wpse_load_languages()
    load_theme_textdomain( 'buttercream', WP_CONTENT_DIR . '/languages' );

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.