Skip to content

Commit

Permalink
Put back and enhance textdomain code. #12.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowgill committed Aug 12, 2016
1 parent bd73daf commit 6c39387
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions appthemes-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ function app_updater_init() {
register_activation_hook( __FILE__, 'app_updater_activate' );
}

/**
* Load the localization files.
*
* @since 1.4.0
*
* Note: the first-loaded translation file overrides any following ones if the same translation is present.
*
* Locales found in (unless WP_LANG_DIR is defined differently in wp-config.php:
* - wp-content/languages/appthemes-updater/appthemes-updater-LOCALE.mo
* - wp-content/languages/plugins/appthemes-updater-LOCALE.mo
*/
function app_updater_load_textdomain() {

$domain = 'appthemes-updater';

// Load the locale (e.g. de_DE) based on the WordPress site language set (wp-admin => Settings => General).
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );

// Load any custom .mo file first, if it's found.
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );

// Load the plugin's .mo file if it's found and no custom .mo file exists.
load_plugin_textdomain( $domain, false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'init', 'app_updater_load_textdomain' );

/**
* Adds plugin action links.
Expand Down

0 comments on commit 6c39387

Please sign in to comment.