Merge pull request #5589 from claudiosmweb/fix-languages-load

Improve the languages load
This commit is contained in:
Mike Jolley 2014-05-30 10:34:14 +01:00
commit 219728fb3b
2 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,7 @@ class WC_Language_Pack_Upgrader {
* *
* @var string * @var string
*/ */
protected $repo = 'https://github.com/woothemes/woocommerce-language-packs/blob/v'; protected $repo = 'https://github.com/woothemes/woocommerce-language-packs/raw/v';
/** /**
* Initialize the language pack upgrader * Initialize the language pack upgrader
@ -50,7 +50,7 @@ class WC_Language_Pack_Upgrader {
* @return string * @return string
*/ */
public function get_language_package_uri() { public function get_language_package_uri() {
return $this->repo . '/' . WC_VERSION . '/' . $this->get_language() . '.zip'; return $this->repo . WC_VERSION . '/packages/' . $this->get_language() . '.zip';
} }
/** /**

View File

@ -408,16 +408,17 @@ final class WooCommerce {
*/ */
public function load_plugin_textdomain() { public function load_plugin_textdomain() {
$locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce' ); $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce' );
$dir = trailingslashit( WP_LANG_DIR );
// Admin Locale // Admin Locale
if ( is_admin() ) { if ( is_admin() ) {
load_textdomain( 'woocommerce', WP_LANG_DIR . "/woocommerce/woocommerce-admin-$locale.mo" ); load_textdomain( 'woocommerce', $dir . 'woocommerce/woocommerce-admin-' . $locale . '.mo' );
load_textdomain( 'woocommerce', dirname( __FILE__ ) . "/i18n/languages/woocommerce-admin-$locale.mo" ); load_textdomain( 'woocommerce', $dir . 'plugins/woocommerce-admin-' . $locale . '.mo' );
} }
// Global + Frontend Locale // Global + Frontend Locale
load_textdomain( 'woocommerce', WP_LANG_DIR . "/woocommerce/woocommerce-$locale.mo" ); load_textdomain( 'woocommerce', $dir . 'woocommerce/woocommerce-' . $locale . '.mo' );
load_plugin_textdomain( 'woocommerce', false, plugin_basename( dirname( __FILE__ ) ) . "/i18n/languages" ); load_plugin_textdomain( 'woocommerce', false, $dir . 'plugins' );
} }
/** /**