From 813c76d3a2fe71c07b45ca5d9e400c0171eab0aa Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Thu, 12 Nov 2009 21:50:17 +0000 Subject: [PATCH] Add load_child_theme_textdomain() to allow child themes to have there own translation files. Fixes #11033 props load_child_theme_textdomain. git-svn-id: https://develop.svn.wordpress.org/trunk@12179 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/l10n.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 07d6e550b8..1bbe58171a 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -395,6 +395,27 @@ function load_theme_textdomain($domain, $path = false) { return load_textdomain($domain, $mofile); } +/** + * Loads the child themes translated strings. + * + * If the current locale exists as a .mo file in the child themes root directory, it + * will be included in the translated strings by the $domain. + * + * The .mo files must be named based on the locale exactly. + * + * @since 2.9.0 + * + * @param string $domain Unique identifier for retrieving translated strings + */ +function load_child_theme_textdomain($domain, $path = false) { + $locale = get_locale(); + + $path = ( empty( $path ) ) ? get_stylesheet_directory() : $path; + + $mofile = "$path/$locale.mo"; + return load_textdomain($domain, $mofile); +} + /** * Returns the Translations instance for a domain. If there isn't one, * returns empty Translations instance.