예제 #1
0
<?php

namespace Transvision;

/*
 * This file initializes l10n support: locale detection, rtl/ltr variables
 */
if (isset($_GET['repo'])) {
    $repo = Project::isValidRepository($_GET['repo']) ? $_GET['repo'] : 'aurora';
} else {
    if (!isset($repo)) {
        $repo = 'aurora';
    }
}
$all_locales = Project::getRepositoryLocales($repo);
$l10n = new \tinyl10n\ChooseLocale($all_locales);
$l10n->setDefaultLocale('fr');
$l10n->mapLonglocales = true;
$locale = $l10n->getCompatibleLocale();
$locale2 = $locale;
$source_locale = Project::getReferenceLocale($repo);
// Bypass locale & source locale detection if there are COOKIES stored with them
if (isset($_COOKIE['default_source_locale'])) {
    $source_locale = $_COOKIE['default_source_locale'];
}
if (isset($_COOKIE['default_target_locale'])) {
    $locale = $_COOKIE['default_target_locale'];
}
// 3 locales view
if (isset($_COOKIE['default_target_locale2'])) {
    $locale2 = $_COOKIE['default_target_locale2'];
예제 #2
0
<?php

namespace Transvision;

$locales_list = [];
$javascript_include = ['/js/show_hide_tabs.js'];
foreach (Project::getRepositories() as $repo) {
    $locales_list = array_merge($locales_list, Project::getRepositoryLocales($repo));
}
$ignored_locales = ['es', 'gu-IN', 'ja-JP-mac'];
$locales_list = array_unique(array_diff($locales_list, $ignored_locales));
// Sort by locale name
sort($locales_list);
if (isset($_GET['locale'])) {
    $page_locale = Utils::getOrSet($locales_list, $_GET['locale'], 'en-US');
} else {
    $l10n = new \tinyl10n\ChooseLocale($locales_list);
    $page_locale = $l10n->getCompatibleLocale();
}
include MODELS . 'health_status.php';
include VIEWS . 'health_status.php';
예제 #3
0
 public function test_getDefaultLocale()
 {
     $obj = new \tinyl10n\ChooseLocale();
     $this->assert->string($obj->getDefaultLocale())->isEqualTo('en-US');
 }