bemailr / wp-requirements

Check server and site conditions before activating your WordPress plugin or theme
http://bemailr.github.io/wp-requirements/
GNU General Public License v3.0
7 stars 1 forks source link

locale - do not use a variable for it #15

Closed slaFFik closed 7 years ago

slaFFik commented 8 years ago

Or use fallback, otherwise there will be problem with translations delivered from https://translate.wordpress.org

Example:

/**
 * Load translations.
 * Similar to the core function:
 *
 * @see load_plugin_textdomain
 */
protected static function load_translations() {

    $domain = 'some-domain';
    $locale = get_locale();
    $mofile = $domain . '-' . $locale . '.mo';

    // Try to load from the languages directory first.
    if ( ! load_textdomain( $domain, WP_LANG_DIR . '/' . $mofile ) ) {
        // Then try to load from our languages folder.
        load_textdomain( $domain, __DIR__ . '/../languages/' . $mofile );
    }
}
slaFFik commented 7 years ago

@tivnet Separate translation file for this lib, that is loaded from plugin folder?

tivnet commented 7 years ago

@slaFFik Loaded from

  1. From WP_LANGUAGES folder
  2. If not there then from the plugin folder.
tivnet commented 7 years ago

5b1786acc516c93990bb668e387730eaeabd49a2