=' ) ) { return ''; } $locale = determine_locale(); return self::has_pack( $locale ) ? '' : self::dir(); } /** * Whether the plugin ships a translation for a locale. * * @param string $locale Locale. * @return bool */ public static function has_bundled( $locale ) { $base = self::dir() . self::DOMAIN . '-' . $locale; return file_exists( $base . '.l10n.php' ) || file_exists( $base . '.mo' ); } /** * Whether WordPress has a language pack for this plugin in a locale. * * @param string $locale Locale. * @return bool */ private static function has_pack( $locale ) { $base = WP_LANG_DIR . '/plugins/' . self::DOMAIN . '-' . $locale; return file_exists( $base . '.l10n.php' ) || file_exists( $base . '.mo' ); } /** * The bundled languages folder, with a trailing slash. * * @return string */ private static function dir() { return RECAST_DIR . 'languages/'; } }