Esempio n. 1
0
 static function initialize()
 {
     self::hooks();
     self::$active_locales = (array) glob(get_template_directory() . '/languages/*.mo');
     foreach (self::$active_locales as &$mo_file) {
         $mo_file = basename($mo_file, '.mo');
     }
     unset($mo_file);
     self::$active_locales[] = 'en_US';
     if (isset($_GET['locale'])) {
         $get_locale = preg_replace('/[^A-Z_-]/i', '', $_GET['locale']);
     }
     if (isset($get_locale) && ($maybe = self::check_variants($get_locale))) {
         self::$locale = $maybe;
     } elseif (self::$locale = self::guess_locale()) {
         self::$guessed = true;
     } else {
         self::$locale = 'en_US';
     }
 }
Esempio n. 2
0
function browsehappy_locale_notice()
{
    if (0 === strpos(Browse_Happy_Locale::locale(), 'en')) {
        // && Browse_Happy_Locale::$guessed )
        return;
    }
    ?>
	<div id="i18n-alert">
		<p><?php 
    printf(__('Browse Happy is also available in English. <a href="%s">Click here to change the language to English</a>.', 'browsehappy'), '/?locale=en');
    ?>
</p>
	</div>
	<?php 
}