Make WordPress Core

Changeset 12179


Ignore:
Timestamp:
11/12/2009 09:50:17 PM (14 years ago)
Author:
westi
Message:

Add load_child_theme_textdomain() to allow child themes to have there own translation files. Fixes #11033 props load_child_theme_textdomain.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/l10n.php

    r12080 r12179  
    397397
    398398/**
     399 * Loads the child themes translated strings.
     400 *
     401 * If the current locale exists as a .mo file in the child themes root directory, it
     402 * will be included in the translated strings by the $domain.
     403 *
     404 * The .mo files must be named based on the locale exactly.
     405 *
     406 * @since 2.9.0
     407 *
     408 * @param string $domain Unique identifier for retrieving translated strings
     409 */
     410function load_child_theme_textdomain($domain, $path = false) {
     411        $locale = get_locale();
     412
     413        $path = ( empty( $path ) ) ? get_stylesheet_directory() : $path;
     414
     415        $mofile = "$path/$locale.mo";
     416        return load_textdomain($domain, $mofile);
     417}
     418
     419/**
    399420 * Returns the Translations instance for a domain. If there isn't one,
    400421 * returns empty Translations instance.
Note: See TracChangeset for help on using the changeset viewer.