You appear to be a bot. Output may be restricted
Description
Plugin specific text-domain loader.
Usage
$void = EDD_Requirements_Check::load_textdomain();
Parameters
Returns
void
Source
File name: easy-digital-downloads/includes/class-edd-requirements-check.php
Lines:
1 to 71 of 71
public function load_textdomain() { /* * Due to the introduction of language packs through translate.wordpress.org, * loading our textdomain is complex. * * In v2.4.6, our textdomain changed from "edd" to "easy-digital-downloads". * * To support existing translation files from before the change, we must * look for translation files in several places and under several names. * * - wp-content/languages/plugins/easy-digital-downloads (introduced with language packs) * - wp-content/languages/edd/ (custom folder we have supported since 1.4) * - wp-content/plugins/easy-digital-downloads/languages/ * * In wp-content/languages/edd/ we must look for: * - "easy-digital-downloads-{lang}_{country}.mo" * * In wp-content/languages/edd/ we must look for: * - "edd-{lang}_{country}.mo" as that was the old file naming convention * * In wp-content/languages/plugins/easy-digital-downloads/ we only need to look for: * - "easy-digital-downloads-{lang}_{country}.mo" as that is the new structure * * In wp-content/plugins/easy-digital-downloads/languages/, we must look for: * - both naming conventions. This is done by filtering "load_textdomain_mofile" */ add_filter( 'load_textdomain_mofile', array( $this, 'load_old_textdomain' ), 10, 2 ); // Set filter for plugin's languages directory. $edd_lang_dir = dirname( $this->base ) . '/languages/'; $edd_lang_dir = apply_filters( 'edd_languages_directory', $edd_lang_dir ); unload_textdomain( 'easy-digital-downloads' ); /** * Defines the plugin language locale used in Easy Digital Downloads. * * @var $get_locale The locale to use. */ $locale = apply_filters( 'plugin_locale', get_user_locale(), 'easy-digital-downloads' ); $mofile = sprintf( '%1$s-%2$s.mo', 'easy-digital-downloads', $locale ); // Look for wp-content/languages/edd/easy-digital-downloads-{lang}_{country}.mo $mofile_global1 = WP_LANG_DIR . "/edd/easy-digital-downloads-{$locale}.mo"; // Look for wp-content/languages/edd/edd-{lang}_{country}.mo $mofile_global2 = WP_LANG_DIR . "/edd/edd-{$locale}.mo"; // Look in wp-content/languages/plugins/easy-digital-downloads $mofile_global3 = WP_LANG_DIR . "/plugins/easy-digital-downloads/{$mofile}"; // Try to load from first global location if ( file_exists( $mofile_global1 ) ) { load_textdomain( 'easy-digital-downloads', $mofile_global1 ); // Try to load from next global location } elseif ( file_exists( $mofile_global2 ) ) { load_textdomain( 'easy-digital-downloads', $mofile_global2 ); // Try to load from next global location } elseif ( file_exists( $mofile_global3 ) ) { load_textdomain( 'easy-digital-downloads', $mofile_global3 ); // Load the default language files } else { load_plugin_textdomain( 'easy-digital-downloads', false, $edd_lang_dir ); } }