Locale simplification

This commit is contained in:
Romain Neutron
2013-12-03 15:01:57 +01:00
parent 9310e10674
commit e9e9d149a1
97 changed files with 200 additions and 262 deletions

View File

@@ -137,6 +137,7 @@ use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Translation\Loader\MoFileLoader;
use Symfony\Component\Translation\Loader\PoFileLoader;
use Symfony\Component\Translation\Translator;
use Unoconv\UnoconvServiceProvider;
use XPDF\PdfToText;
@@ -162,10 +163,10 @@ class Application extends SilexApplication
use TranslationTrait;
private static $availableLanguages = [
'de_DE' => 'Deutsch',
'en_GB' => 'English',
'fr_FR' => 'Français',
'nl_NL' => 'Dutch',
'de' => 'Deutsch',
'en' => 'English',
'fr' => 'Français',
'nl' => 'Dutch',
];
private static $flashTypes = ['warning', 'info', 'success', 'error'];
private $environment;
@@ -308,15 +309,15 @@ class Application extends SilexApplication
]);
$this->register(new TranslationServiceProvider(), [
'locale_fallbacks' => ['fr_FR'],
'locale_fallbacks' => ['fr'],
]);
$this['translator'] = $this->share($this->extend('translator', function(Translator $translator, $app) {
$translator->addLoader('mo', new MoFileLoader());
$translator->addResource('mo', __DIR__.'/../../../resources/locales/messages.fr.mo', 'fr_FR', 'messages');
$translator->addResource('mo', __DIR__.'/../../../resources/locales/messages.en.mo', 'en_GB', 'messages');
$translator->addResource('mo', __DIR__.'/../../../resources/locales/messages.de.mo', 'de_DE', 'messages');
$translator->addResource('mo', __DIR__.'/../../../resources/locales/messages.nl.mo', 'nl_NL', 'messages');
$translator->addLoader('po', new PoFileLoader());
$translator->addResource('po', __DIR__.'/../../../resources/locales/messages.fr.po', 'fr', 'messages');
$translator->addResource('po', __DIR__.'/../../../resources/locales/messages.en.po', 'en', 'messages');
$translator->addResource('po', __DIR__.'/../../../resources/locales/messages.de.po', 'de', 'messages');
$translator->addResource('po', __DIR__.'/../../../resources/locales/messages.nl.po', 'nl', 'messages');
return $translator;
}));

View File

@@ -61,7 +61,7 @@ class RecordAdd extends Command
if (!$input->getOption('yes')) {
do {
$continue = strtolower($dialog->ask($output, sprintf("Will add record <info>%s</info> (%s) on collection <info>%s</info>\n<question>Continue ? (y/N)</question>", $file, $media->getType(), $collection->get_label($this->container['locale.I18n'])), 'N'));
$continue = strtolower($dialog->ask($output, sprintf("Will add record <info>%s</info> (%s) on collection <info>%s</info>\n<question>Continue ? (y/N)</question>", $file, $media->getType(), $collection->get_label($this->container['locale'])), 'N'));
} while ( ! in_array($continue, ['y', 'n']));
if (strtolower($continue) !== 'y') {
@@ -113,7 +113,7 @@ class RecordAdd extends Command
if ($elementCreated instanceof \record_adapter) {
$output->writeln(
sprintf(
"Record id <info>%d</info> on collection `%s` (databox `%s`) has been created", $elementCreated->get_record_id(), $elementCreated->get_collection()->get_label($this->container['locale.I18n']), $elementCreated->get_databox()->get_label($this->container['locale.I18n'])
"Record id <info>%d</info> on collection `%s` (databox `%s`) has been created", $elementCreated->get_record_id(), $elementCreated->get_collection()->get_label($this->container['locale']), $elementCreated->get_databox()->get_label($this->container['locale'])
)
);
$this->container['phraseanet.SE']->addRecord($elementCreated);

View File

@@ -741,7 +741,7 @@ class Collection implements ControllerProviderInterface
$success = true;
try {
foreach ($app['locales.I18n.available'] as $code => $language) {
foreach ($app['locales.available'] as $code => $language) {
if (!isset($labels[$code])) {
continue;
}

View File

@@ -262,7 +262,7 @@ class Databox implements ControllerProviderInterface
$success = true;
try {
foreach ($app['locales.I18n.available'] as $code => $language) {
foreach ($app['locales.available'] as $code => $language) {
if (!isset($labels[$code])) {
continue;
}

View File

@@ -296,7 +296,7 @@ class Root implements ControllerProviderInterface
"printable" => false,
];
foreach ($app['locales.I18n.available'] as $code => $language) {
foreach ($app['locales.available'] as $code => $language) {
$status['labels_on'][$code] = null;
$status['labels_off'][$code] = null;
}

View File

@@ -246,9 +246,9 @@ class Root implements ControllerProviderInterface
$renderTopics = '';
if ($app['phraseanet.registry']->get('GV_client_render_topics') == 'popups') {
$renderTopics = \queries::dropdown_topics($app['translator'], $app['locale.I18n']);
$renderTopics = \queries::dropdown_topics($app['translator'], $app['locale']);
} elseif ($app['phraseanet.registry']->get('GV_client_render_topics') == 'tree') {
$renderTopics = \queries::tree_topics($app['locale.I18n']);
$renderTopics = \queries::tree_topics($app['locale']);
}
return new Response($app['twig']->render('client/index.html.twig', [

View File

@@ -64,7 +64,7 @@ class Edit implements ControllerProviderInterface
'_sgval' => [],
'required' => $meta->is_required(),
/** @Ignore */
'label' => $meta->get_label($app['locale.I18n']),
'label' => $meta->get_label($app['locale']),
'readonly' => $meta->is_readonly(),
'type' => $meta->get_type(),
'format' => '',
@@ -122,8 +122,8 @@ class Edit implements ControllerProviderInterface
if (isset($dbstatus[$databox->get_sbas_id()])) {
foreach ($dbstatus[$databox->get_sbas_id()] as $n => $statbit) {
$status[$n] = [];
$status[$n]['label0'] = $statbit['labels_off_i18n'][$app['locale.I18n']];
$status[$n]['label1'] = $statbit['labels_on_i18n'][$app['locale.I18n']];
$status[$n]['label0'] = $statbit['labels_off_i18n'][$app['locale']];
$status[$n]['label1'] = $statbit['labels_on_i18n'][$app['locale']];
$status[$n]['img_off'] = $statbit['img_off'];
$status[$n]['img_on'] = $statbit['img_on'];
$status[$n]['_value'] = 0;

View File

@@ -77,9 +77,9 @@ class Root implements ControllerProviderInterface
$queries_topics = '';
if ($app['phraseanet.registry']->get('GV_client_render_topics') == 'popups') {
$queries_topics = \queries::dropdown_topics($app['translator'], $app['locale.I18n']);
$queries_topics = \queries::dropdown_topics($app['translator'], $app['locale']);
} elseif ($app['phraseanet.registry']->get('GV_client_render_topics') == 'tree') {
$queries_topics = \queries::tree_topics($app['locale.I18n']);
$queries_topics = \queries::tree_topics($app['locale']);
}
$sbas = $bas2sbas = [];

View File

@@ -90,7 +90,7 @@ class TOU implements ControllerProviderInterface
continue;
}
$data[$databox->get_label($app['locale.I18n'])] = $cgus[$app['locale']]['value'];
$data[$databox->get_label($app['locale'])] = $cgus[$app['locale']]['value'];
}
return new Response($app['twig']->render('/prod/TOU.html.twig', [

View File

@@ -70,6 +70,6 @@ class Root implements ControllerProviderInterface
public function getAvailableLanguages(Application $app, Request $request)
{
return $app->json($app['locales.I18n.available']);
return $app->json($app['locales.available']);
}
}

View File

@@ -74,10 +74,10 @@ class PhraseaLocaleSubscriber implements EventSubscriberInterface
$this->app['locale'] = $this->app->share(function (Application $app) use ($event) {
if (isset($app['phraseanet.registry'])) {
$event->getRequest()->setDefaultLocale(
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB')
$app['phraseanet.registry']->get('GV_default_lng', 'en')
);
$event->getRequest()->setLocale(
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB')
$app['phraseanet.registry']->get('GV_default_lng', 'en')
);
}
@@ -93,8 +93,8 @@ class PhraseaLocaleSubscriber implements EventSubscriberInterface
foreach ($event->getRequest()->getLanguages() as $code) {
$data = preg_split('/[-_]/', $code);
if (array_key_exists($data[0], $app['locales.mapping'])) {
$event->getRequest()->setLocale($app['locales.mapping'][$data[0]]);
if (in_array($data[0], array_keys($app['locales.available']), true)) {
$event->getRequest()->setLocale($data[0]);
$localeSet = true;
break;
}

View File

@@ -20,19 +20,7 @@ class LocaleServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['locale'] = $app->share(function (Application $app) {
return $app['phraseanet.registry']->get('GV_default_lng', 'en_GB');
});
$app['locale.I18n'] = $app->share(function (Application $app) {
$data = explode('_', $app['locale']);
return $data[0];
});
$app['locale.l10n'] = $app->share(function (Application $app) {
$data = explode('_', $app['locale']);
return $data[1];
return $app['phraseanet.registry']->get('GV_default_lng', 'en');
});
$app['locales.available'] = $app->share(function (Application $app) {
@@ -46,10 +34,6 @@ class LocaleServiceProvider implements ServiceProviderInterface
if (in_array($code, $languages)) {
continue;
}
$data = explode('_', $code);
if (in_array($data[0], $languages)) {
continue;
}
unset($enabledLanguages[$code]);
}
@@ -64,27 +48,6 @@ class LocaleServiceProvider implements ServiceProviderInterface
return $availableLanguages;
}
});
$app['locales.mapping'] = $app->share(function (Application $app) {
$codes = [];
foreach ($app['locales.available'] as $code => $language) {
$data = explode('_', $code);
$codes[$data[0]] = $code;
}
return $codes;
});
$app['locales.I18n.available'] = $app->share(function (Application $app) {
$locales = [];
foreach ($app['locales.available'] as $code => $language) {
$data = explode('_', $code);
$locales[$data[0]] = $language;
}
return $locales;
});
}
public function boot(Application $app)

View File

@@ -259,11 +259,11 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
foreach ($status as $bit => $datas) {
$tbits_left[$bit]["nset"] = 0;
$tbits_left[$bit]["name"] = $datas['labels_off_i18n'][$this->app['locale.I18n']];
$tbits_left[$bit]["name"] = $datas['labels_off_i18n'][$this->app['locale']];
$tbits_left[$bit]["icon"] = $datas["img_off"];
$tbits_right[$bit]["nset"] = 0;
$tbits_right[$bit]["name"] = $datas['labels_on_i18n'][$this->app['locale.I18n']];
$tbits_right[$bit]["name"] = $datas['labels_on_i18n'][$this->app['locale']];
$tbits_right[$bit]["icon"] = $datas["img_on"];
}

View File

@@ -331,7 +331,7 @@ class PDF
$str = $databox->get_sxml_structure();
$vn = (string) ($str->pdfPrintLogo);
if (($vn * 1) == 1) {
$LEFT__TEXT = $databox->get_label($this->app['locale.I18n']);
$LEFT__TEXT = $databox->get_label($this->app['locale']);
}
}

View File

@@ -617,7 +617,7 @@ class SearchEngineOptions
$options = new static();
$options->disallowBusinessFields();
$options->setLocale($app['locale.I18n']);
$options->setLocale($app['locale']);
if (is_array($request->get('bases'))) {
$bas = array_map(function ($base_id) use ($app) {

View File

@@ -16,7 +16,7 @@ use Alchemy\Phrasea\Application as PhraseaApplication;
class LocalesRequirements extends RequirementCollection implements RequirementInterface
{
public function __construct($locale = 'en_GB')
public function __construct($locale = 'en')
{
$this->setName('Locales');
@@ -28,7 +28,7 @@ class LocalesRequirements extends RequirementCollection implements RequirementIn
if (class_exists('Collator')) {
$this->addRecommendation(
null !== new \Collator('fr_FR'),
null !== new \Collator('fr'),
'intl extension should be correctly configured',
'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
);

View File

@@ -204,7 +204,7 @@ class RecordMoverJob extends AbstractJob
try {
$dbox = $app['phraseanet.appbox']->get_databox($sbas_id);
$ret['basename'] = $dbox->get_label($app['locale.I18n']);
$ret['basename'] = $dbox->get_label($app['locale']);
$ret['basename_htmlencoded'] = htmlentities($ret['basename']);
switch ($ret['action']) {
case 'UPDATE':

View File

@@ -656,7 +656,7 @@ class API_V1_adapter extends API_V1_Abstract
$collection = \collection::get_from_base_id($this->app, $request->get('base_id'));
if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->get('base_id'), 'canaddrecord')) {
throw new API_V1_exception_forbidden(sprintf('You do not have access to collection %s', $collection->get_label($this->app['locale.I18n'])));
throw new API_V1_exception_forbidden(sprintf('You do not have access to collection %s', $collection->get_label($this->app['locale'])));
}
$media = $app['mediavorus']->guess($file->getPathname());

View File

@@ -27,12 +27,12 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
* @var Array
*/
public static $locales = [
'ar_SA' => 'العربية'
, 'de_DE' => 'Deutsch'
, 'nl_NL' => 'Dutch'
, 'en_GB' => 'English'
, 'es_ES' => 'Español'
, 'fr_FR' => 'Français'
'ar' => 'العربية'
, 'de' => 'Deutsch'
, 'nl' => 'Dutch'
, 'en' => 'English'
, 'es' => 'Español'
, 'fr' => 'Français'
];
/**
@@ -1242,7 +1242,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_locale()
{
return $this->locale ?: $this->app['phraseanet.registry']->get('GV_default_lng', 'en_GB');
return $this->locale ?: $this->app['phraseanet.registry']->get('GV_default_lng', 'en');
}
public function set_locale($locale)

View File

@@ -356,7 +356,7 @@ class appbox extends base
* Step 7
*/
foreach ($this->get_databoxes() as $s) {
$upgrader->set_current_message($this->app->trans('Upgrading %databox_name%', array('%databox_name%' => $s->get_label($this->app['locale.I18n']))));
$upgrader->set_current_message($this->app->trans('Upgrading %databox_name%', array('%databox_name%' => $s->get_label($this->app['locale']))));
$advices = array_merge($advices, $s->upgradeDB(true, $upgrader, $app));
$upgrader->add_steps_complete(1);
}

View File

@@ -367,7 +367,7 @@ class caption_Field_Value implements cache_cacheableInterface
$nodes = $XPATH_thesaurus->cache_query($q, $DOM_branch);
$lngfound = false;
foreach ($nodes as $node) {
if ($node->getAttribute("lng") == $this->app['locale.I18n']) {
if ($node->getAttribute("lng") == $this->app['locale']) {
// le terme est dans la bonne langue, on le rend cliquable
list($term, $context) = $this->splitTermAndContext($fvalue);
$term = str_replace(["<em>", "</em>"], ["", ""], $term);
@@ -382,7 +382,7 @@ class caption_Field_Value implements cache_cacheableInterface
break;
}
$synonyms = $XPATH_thesaurus->query("sy[@lng='" . $this->app['locale.I18n'] . "']", $node->parentNode);
$synonyms = $XPATH_thesaurus->query("sy[@lng='" . $this->app['locale'] . "']", $node->parentNode);
foreach ($synonyms as $synonym) {
$k = $synonym->getAttribute("k");
if ($synonym->getAttribute("w") != $term_noacc || $k != $context_noacc) {

View File

@@ -311,7 +311,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
$fields[$field->get_name()] = [
'value' => $value,
/** @Ignore */
'label' => $field->get_databox_field()->get_label($this->app['locale.I18n']),
'label' => $field->get_databox_field()->get_label($this->app['locale']),
'separator' => $field->get_databox_field()->get_separator(),
];
}

View File

@@ -52,7 +52,7 @@ class databox_cgu
if ( ! isset($cgus[$app['locale']]))
throw new Exception('No CGus for this locale');
$name = $databox->get_label($app['locale.I18n']);
$name = $databox->get_label($app['locale']);
$update = $cgus[$app['locale']]['updated_on'];
$value = $cgus[$app['locale']]['value'];

View File

@@ -80,7 +80,7 @@ class databox_status
$this->status[$bit]["labeloff"] = (string) $sb['labelOff'];
$this->status[$bit]["labelon"] = (string) $sb['labelOn'];
foreach ($app['locales.I18n.available'] as $code => $language) {
foreach ($app['locales.available'] as $code => $language) {
$this->status[$bit]['labels_on'][$code] = null;
$this->status[$bit]['labels_off'][$code] = null;
}
@@ -89,7 +89,7 @@ class databox_status
$this->status[$bit]['labels_'.$label['switch']][(string) $label['code']] = (string) $label;
}
foreach ($app['locales.I18n.available'] as $code => $language) {
foreach ($app['locales.available'] as $code => $language) {
$this->status[$bit]['labels_on_i18n'][$code] = '' !== trim($this->status[$bit]['labels_on'][$code]) ? $this->status[$bit]['labels_on'][$code] : $this->status[$bit]["labelon"];
$this->status[$bit]['labels_off_i18n'][$code] = '' !== trim($this->status[$bit]['labels_off'][$code]) ? $this->status[$bit]['labels_off'][$code] : $this->status[$bit]["labeloff"];
}

View File

@@ -81,7 +81,7 @@ function giveMeBases(Application $app, $usr = null)
$inscriptions[$sbas_id]['CollsNonactif'] = null;
foreach ($databox->get_collections() as $key => $coll) {
$collname[$key] = $coll->get_label($app['locale.I18n']);
$collname[$key] = $coll->get_label($app['locale']);
$basname[$key] = $coll->get_coll_id();
}
$sbpcgu = '';
@@ -131,7 +131,7 @@ function giveMeBases(Application $app, $usr = null)
$cguSpec = true;
} else {
if ( ! isset($usrerRegis[$databox->get_dbname()][$collection->get_coll_id()]))
$inscriptions[$sbas_id]['Colls'][$collection->get_coll_id()] = $collection->get_label($app['locale.I18n']);
$inscriptions[$sbas_id]['Colls'][$collection->get_coll_id()] = $collection->get_label($app['locale']);
}
}
}
@@ -151,9 +151,9 @@ function giveMeBases(Application $app, $usr = null)
elseif ($usrerRegis[$databox->get_dbname()][$collection->get_coll_id()] === true)
$inscriptions[$sbas_id]['CollsRegistered'][$collection->get_coll_id()] = $lacgu;
} elseif (! $cguSpec && $collInscript) {//ne va pas.. si l'inscriptio na la coll est explicitement non autorise, je refuse'
$inscriptions[$sbas_id]['Colls'][$collection->get_coll_id()] = $collection->get_label($app['locale.I18n']);
$inscriptions[$sbas_id]['Colls'][$collection->get_coll_id()] = $collection->get_label($app['locale']);
} elseif ($cguSpec) {
$inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['name'] = $collection->get_label($app['locale.I18n']);
$inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['name'] = $collection->get_label($app['locale']);
$inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['CGU'] = $cguColl;
$inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['CGUrelease'] = $cguCollRelease;
}

View File

@@ -32,7 +32,7 @@ class module_console_fieldsList extends Command
$output->writeln(
sprintf(
"\n ---------------- \nOn databox %s (sbas_id %d) :\n"
, $databox->get_label($this->container['locale.I18n'])
, $databox->get_label($this->container['locale'])
, $databox->get_sbas_id()
)
);

View File

@@ -46,7 +46,7 @@ class module_console_sphinxGenerateSuggestion extends Command
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);
$output->writeln("process Databox " . $databox->get_label($this->container['locale.I18n']) . " / $index\n");
$output->writeln("process Databox " . $databox->get_label($this->container['locale']) . " / $index\n");
if ( ! is_executable("/usr/local/bin/indexer")) {
$output->writeln("<error>'/usr/local/bin/indexer' is not executable</error>");

View File

@@ -120,7 +120,7 @@ class module_console_systemExport extends Command
$total = $errors = 0;
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_label($this->container['locale.I18n'])));
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_label($this->container['locale'])));
if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) {
$output->writeln(sprintf("Databox not selected, bypassing ..."));

View File

@@ -248,13 +248,13 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
$sbas_id = $databox->get_sbas_id();
if ( ! isset($all_coll[$sbas_id])) {
$all_coll[$sbas_id] = [];
$all_coll[$sbas_id]['name_sbas'] = $databox->get_label($this->app['locale.I18n']);
$all_coll[$sbas_id]['name_sbas'] = $databox->get_label($this->app['locale']);
}
$all_coll[$sbas_id]['sbas_collections'][] = [
'base_id' => $base_id,
'sbas_id' => $sbas_id,
'coll_id' => $collection->get_base_id(),
'name' => $collection->get_label($this->app['locale.I18n'])
'name' => $collection->get_label($this->app['locale'])
];
}

View File

@@ -218,8 +218,8 @@ class phrasea
}
}
if (isset(self::$_sbas_labels[$sbas_id]) && isset(self::$_sbas_labels[$sbas_id][$app['locale.I18n']])) {
return self::$_sbas_labels[$sbas_id][$app['locale.I18n']];
if (isset(self::$_sbas_labels[$sbas_id]) && isset(self::$_sbas_labels[$sbas_id][$app['locale']])) {
return self::$_sbas_labels[$sbas_id][$app['locale']];
}
return 'Unknown database';
@@ -246,8 +246,8 @@ class phrasea
}
}
if (isset(self::$_bas_labels[$base_id]) && isset(self::$_bas_labels[$base_id][$app['locale.I18n']])) {
return self::$_bas_labels[$base_id][$app['locale.I18n']];
if (isset(self::$_bas_labels[$base_id]) && isset(self::$_bas_labels[$base_id][$app['locale']])) {
return self::$_bas_labels[$base_id][$app['locale']];
}
return 'Unknown collection';

View File

@@ -43,11 +43,11 @@ class phraseadate
{
switch ($this->app['locale']) {
default:
case 'fr_FR':
case 'de_DE':
case 'fr':
case 'de':
$time = $date->format('H:i');
break;
case 'en_GB':
case 'en':
$time = $date->format('h:iA');
break;
}
@@ -141,7 +141,7 @@ class phraseadate
switch ($locale) {
default:
case 'fr_FR':
case 'fr':
switch ($format) {
default:
case 'DAY_MONTH':
@@ -152,7 +152,7 @@ class phraseadate
break;
}
break;
case 'en_GB':
case 'en':
switch ($format) {
default:
case 'DAY_MONTH':
@@ -163,7 +163,7 @@ class phraseadate
break;
}
break;
case 'de_DE':
case 'de':
switch ($format) {
default:
case 'DAY_MONTH':

View File

@@ -424,11 +424,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$status .= '<img style="margin:1px;' . $style1 . '" ' .
'class="STAT_' . $this->base_id . '_'
. $this->record_id . '_' . $n . '_1" ' .
'src="' . $source1 . '" title="' . $statbit['labels_on_i18n'][$this->app['locale.I18n']] . '"/>';
'src="' . $source1 . '" title="' . $statbit['labels_on_i18n'][$this->app['locale']] . '"/>';
$status .= '<img style="margin:1px;' . $style0 . '" ' .
'class="STAT_' . $this->base_id . '_'
. $this->record_id . '_' . $n . '_0" ' .
'src="' . $source0 . '" title="' . $statbit['labels_off_i18n'][$this->app['locale.I18n']] . '"/>';
'src="' . $source0 . '" title="' . $statbit['labels_off_i18n'][$this->app['locale']] . '"/>';
}
}
@@ -890,7 +890,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$fields_to_retrieve = [];
foreach ($fields as $field) {
if (in_array($field->get_thumbtitle(), ['1', $this->app['locale.I18n']])) {
if (in_array($field->get_thumbtitle(), ['1', $this->app['locale']])) {
$fields_to_retrieve [] = $field->get_name();
}
}

View File

@@ -157,7 +157,7 @@ class record_exportElement extends record_adapter
if (trim($label) == '')
continue;
if ($lang == $this->app['locale.I18n']) {
if ($lang == $this->app['locale']) {
$subdef_label = $label;
break;
}

View File

@@ -41,7 +41,7 @@ return call_user_func_array(function(Application $app) {
'type' => \registry::TYPE_ENUM,
'name' => 'GV_default_lng',
'comment' => $app->trans('Default language'),
'default' => 'fr_FR',
'default' => 'fr',
'available' => $avLanguages,
'required' => true
],

View File

@@ -2760,7 +2760,7 @@
</field>
<field>
<name>locale</name>
<type>enum('fr_FR','en_GB','en_US','ar_SA','de_DE','es_LA','zh_CN','nb_NO')</type>
<type>enum('fr','en','ar','de','es','zh','nb','nl')</type>
<null>YES</null>
<extra></extra>
<default></default>
@@ -4642,25 +4642,25 @@
<default>
<data key="prop">ToU</data>
<data key="value"></data>
<data key="locale">fr_FR</data>
<data key="locale">fr</data>
<data key="created_on">NOW()</data>
</default>
<default>
<data key="prop">ToU</data>
<data key="value"></data>
<data key="locale">ar_SA</data>
<data key="locale">ar</data>
<data key="created_on">NOW()</data>
</default>
<default>
<data key="prop">ToU</data>
<data key="value"></data>
<data key="locale">de_DE</data>
<data key="locale">de</data>
<data key="created_on">NOW()</data>
</default>
<default>
<data key="prop">ToU</data>
<data key="value"></data>
<data key="locale">en_GB</data>
<data key="locale">en</data>
<data key="created_on">NOW()</data>
</default>
</defaults>

View File

@@ -14,7 +14,7 @@ msgstr ""
"X-Generator: Launchpad (build 15901)\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-Basepath: /Users/romain/Documents/workspace/Phraseanet\n"
"Language: ar_SA\n"
"Language: ar\n"
"X-Poedit-KeywordsList: _e;__\n"
"X-Poedit-SearchPath-0: config\n"
"X-Poedit-SearchPath-1: lib/classes\n"

View File

@@ -13,7 +13,7 @@ msgstr ""
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-Basepath: /Users/romain/Documents/workspace/Phraseanet\n"
"Language: de_DE\n"
"Language: de\n"
"X-Poedit-KeywordsList: _e;__\n"
"X-Poedit-SearchPath-0: config\n"
"X-Poedit-SearchPath-1: lib/classes\n"

View File

@@ -13,7 +13,7 @@ msgstr ""
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-Basepath: /Users/romain/Documents/workspace/Phraseanet\n"
"Language: en_GB\n"
"Language: en\n"
"X-Poedit-KeywordsList: _e;__\n"
"X-Poedit-SearchPath-0: config\n"
"X-Poedit-SearchPath-1: lib/classes\n"

View File

@@ -13,7 +13,7 @@ msgstr ""
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-Basepath: /Users/romain/Documents/workspace/Phraseanet\n"
"Language: fr_FR\n"
"Language: fr\n"
"X-Poedit-KeywordsList: _e;__\n"
"X-Poedit-SearchPath-0: config\n"
"X-Poedit-SearchPath-1: lib/classes\n"

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<meta charset="UTF-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />

View File

@@ -8,7 +8,7 @@
<div class="page-header">
<h1>
{{ 'phraseanet:: collection' | trans }} {{ collection.get_label(app['locale.I18n']) }}
{{ 'phraseanet:: collection' | trans }} {{ collection.get_label(app['locale']) }}
</h1>
</div>
@@ -81,14 +81,14 @@
<form class="form-inline" method="post" action="{{ path('admin_collection_labels', { 'bas_id' : bas_id }) }}" style="margin:0;">
<div class="input-append">
<div class="row">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<h6>{{ language }}</h6>
</div>
{% endfor %}
</div>
<div class="row">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<input name="labels[{{ code }}]" value="{{ collection.get_label(code, false) }}" class="span2" type="text">
</div>

View File

@@ -36,7 +36,7 @@
<select id="othcollsel" name="othcollsel" disabled>
<option>{{ "choisir" | trans }}</option>
{% for collection in app['acl'].get(app['authentication'].getUser()).get_granted_base(["canadmin"]) %}
<option value="{{ collection.get_base_id() }}">{{ collection.get_label(app['locale.I18n']) }}</option>
<option value="{{ collection.get_base_id() }}">{{ collection.get_label(app['locale']) }}</option>
{% endfor %}
</select>
{% endif %}

View File

@@ -1,5 +1,5 @@
<div class="header">
<h1>{{ collection.get_label(app['locale.I18n']) }} <small style="font-size:16px">{{ "Details" | trans }}</small></h1>
<h1>{{ collection.get_label(app['locale']) }} <small style="font-size:16px">{{ "Details" | trans }}</small></h1>
</div>
<table class="table table-bordered">
@@ -42,4 +42,4 @@
<div>
<a style="text-decoration:none" class="btn" href="{{ path('admin_display_collection', { 'bas_id' : collection.get_base_id() }) }}">{{ 'boutton::retour' | trans }}</a>
</div>
</div>

View File

@@ -79,7 +79,7 @@
<select name=usrbases id="nomchamPH" onKeyUp="javascript:write_valsug();" onChange="javascript:savenomaff();makeRestrict();maketextaffich();makeEmpty();write_valsug();" onclick="javascript: makeRestrict();desactivall4VS(); write_valsug();" >
{% for field in databox.get_meta_structure() %}
{% if not field.is_readonly %}
<option value='{{ field.get_name() }}'> {{ field.get_label(app['locale.I18n']) }} </option>
<option value='{{ field.get_name() }}'> {{ field.get_label(app['locale']) }} </option>
{% endif %}
{% endfor %}
</select>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title> </title>
@@ -10,4 +10,4 @@
<body>
{% block content %}{% endblock %}
</body>
</html>
</html>

View File

@@ -26,7 +26,7 @@
</tr>
{% for databox in app['acl'].get(user).get_granted_sbas() %}
<tr>
<td colspan="2" style="overflow:hidden;" >{{ databox.get_label(app['locale.I18n']) }}</td>
<td colspan="2" style="overflow:hidden;" >{{ databox.get_label(app['locale']) }}</td>
</tr>
{% endfor %}
<tr>

View File

@@ -29,7 +29,7 @@
</li>
<li>
{{ 'admin::base: Alias' | trans }} : <span id="viewname">{{ databox.get_label(app['locale.I18n']) }}</span>
{{ 'admin::base: Alias' | trans }} : <span id="viewname">{{ databox.get_label(app['locale']) }}</span>
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
<img src="/skins/icons/edit_0.gif" id="show-view-name" />
<div class="well well-small" id="change-view-name" style="display:none;">
@@ -101,14 +101,14 @@
<form class="form-inline" method="post" action="{{ path('admin_databox_labels', { 'databox_id' : databox.get_sbas_id() }) }}" style="margin:0;">
<div class="input-append">
<div class="row">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<h6>{{ language }}</h6>
</div>
{% endfor %}
</div>
<div class="row">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<input name="labels[{{ code }}]" value="{{ databox.get_label(code, false) }}" class="span2" type="text">
</div>

View File

@@ -145,7 +145,7 @@
</th>
<th colspan="26">
<img src="/skins/lng/inclin-{{app['locale.I18n']}}.png" style="width:698px"/>
<img src="/skins/lng/inclin-{{app['locale']}}.png" style="width:698px"/>
</th>
</tr>
</thead>
@@ -168,7 +168,7 @@
</th>
<th colspan="26">
<img src="/skins/lng/inclin-{{app['locale.I18n']}}.gif" >
<img src="/skins/lng/inclin-{{app['locale']}}.gif" >
</th>
</tr>
</thead>-->

View File

@@ -1,6 +1,6 @@
<h1>Masks</h1>
<div>
Base {{ collection.get_databox().get_label(app['locale.I18n']) }}
Base {{ collection.get_databox().get_label(app['locale']) }}
</div>
<div>
Collection {{base_id|bas_labels(app)}}

View File

@@ -38,7 +38,7 @@
<h1>{{ 'Quotas' | trans }}</h1>
<div>
{% set base = collection.get_databox().get_label(app['locale.I18n']) %}
{% set base = collection.get_databox().get_label(app['locale']) %}
{% trans with {'%base%' : base} %}Base %base%{% endtrans %}
</div>
<div>

View File

@@ -1,6 +1,6 @@
<h1>{{ 'Limite temporelle' | trans }}</h1>
<div>
{% set base = collection.get_databox().get_label(app['locale.I18n']) %}
{% set base = collection.get_databox().get_label(app['locale']) %}
{% trans with {'%base%' : base} %}Base %base%{% endtrans %}
</div>
<div>

View File

@@ -102,7 +102,7 @@
<select id="edit_pub_base_id" class="input-large" name="base_id" {% if feed.isPublic() %}disabled="disabled"{% endif %}>
<option value="">{{ 'Non-Restreinte (publique)' | trans }}</option>
{% for databox in app['acl'].get(app['authentication'].getUser()).get_granted_sbas('bas_chupub') %}
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
<optgroup label="{{ databox.get_label(app['locale']) }}">
{% for collection in databox.get_collections() %}
<option {% if feed.getBaseId() and feed.getCollection(app).get_base_id() == collection.get_base_id() %}selected="selected"{% endif %} value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
{% endfor %}

View File

@@ -24,7 +24,7 @@
<select id="add_pub_base_id" class="input-large" name="base_id">
<option value="">{{ 'Non-Restreinte (publique)' | trans }}</option>
{% for databox in app['acl'].get(app['authentication'].getUser()).get_granted_sbas('bas_chupub') %}
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
<optgroup label="{{ databox.get_label(app['locale']) }}">
{% for collection in databox.get_collections() %}
<option value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
{% endfor %}
@@ -80,7 +80,7 @@
</td>
<td valign="center" align="center">
{% if feed.getCollection() != null %}
{{ feed.getCollection().get_databox().get_label(app['locale.I18n']) }} /
{{ feed.getCollection().get_databox().get_label(app['locale']) }} /
{{ feed.getCollection().get_name() }}
{% endif %}
</td>

View File

@@ -42,14 +42,14 @@
{% set statusbit = attribute(status, bit) %}
<td>
{% if statusbit['img_off'] %}
<img title='{{ statusbit['labels_off_i18n'][app['locale.I18n']] }}' src='{{ statusbit['img_off'] }}' />
<img title='{{ statusbit['labels_off_i18n'][app['locale']] }}' src='{{ statusbit['img_off'] }}' />
{% endif %}
{{ statusbit['labels_off_i18n'][app['locale.I18n']] }}
{{ statusbit['labels_off_i18n'][app['locale']] }}
/
{% if statusbit['img_on'] %}
<img title='{{ statusbit['labels_on_i18n'][app['locale.I18n']] }}' src='{{ statusbit['img_on'] }}' />
<img title='{{ statusbit['labels_on_i18n'][app['locale']] }}' src='{{ statusbit['img_on'] }}' />
{% endif %}
{{ statusbit['labels_on_i18n'][app['locale.I18n']] }}
{{ statusbit['labels_on_i18n'][app['locale']] }}
</td>
<td>{{ statusbit['searchable'] is defined and statusbit['searchable'] == '1' ? 'oui'| trans : 'non'| trans }}</td>
<td>{{ statusbit['printable'] is defined and statusbit['printable'] == '1' ? 'oui'| trans : 'non'| trans }}</td>
@@ -84,4 +84,4 @@
});
});
});
</script>
</script>

View File

@@ -25,7 +25,7 @@
<label class="control-label">
</label>
<div class="controls">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<h6>{{ language }}</h6>
</div>
@@ -37,7 +37,7 @@
{{ 'Labels' | trans }}
</label>
<div class="controls">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<input name="labels_off[{{ code }}]" value="{{ status['labels_off'][code] }}" class="span12" type="text">
</div>
@@ -89,7 +89,7 @@
<label class="control-label">
</label>
<div class="controls">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<h6>{{ language }}</h6>
</div>
@@ -101,7 +101,7 @@
{{ 'Labels' | trans }}
</label>
<div class="controls">
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<div class="span2">
<input name="labels_on[{{ code }}]" value="{{ status['labels_on'][code] }}" class="span12" type="text">
</div>

View File

@@ -214,7 +214,7 @@
<td></td>
</tr>
{% for code, language in app['locales.I18n.available'] %}
{% for code, language in app['locales.available'] %}
<tr>
<td>{{ language }}</td>
<td><input type="text" name="{{subdefgroup}}_{{subdefname}}_label[{{ code }}]" value="{{ subdef.get_label(code, false) }}" /></td>

View File

@@ -8,7 +8,7 @@
<option value="">...</option>
{% for databox in app['phraseanet.appbox'].get_databoxes() %}
{% for collection in databox.get_collections() %}
<option value="{{ collection.get_base_id() }}">{{ databox.get_label(app['locale.I18n']) }} / {{ collection.get_label(app['locale.I18n']) }}</option>
<option value="{{ collection.get_base_id() }}">{{ databox.get_label(app['locale']) }} / {{ collection.get_label(app['locale']) }}</option>
{% endfor %}
{% endfor %}
</select>

View File

@@ -98,7 +98,7 @@
<div style="padding:0 0 2px 0;" class="{% if this_is_selected %}selected{% endif %}">
<a target="right" href="{{ path('admin_database', { 'databox_id' : sbas_id }) }}" class="ajax">
<img src="/skins/admin/Database.png"/>
<span>{{ databox.get_label(app['locale.I18n']) }}</span>
<span>{{ databox.get_label(app['locale']) }}</span>
</a>
</div>
<ul>

View File

@@ -1,7 +1,7 @@
{% if app['locale.I18n'] not in ['fr', 'en', 'us'] %}
{% if app['locale'] not in ['fr', 'en', 'us'] %}
{% set lng = 'fr' %}
{% else %}
{% set lng = app['locale.I18n'] %}
{% set lng = app['locale'] %}
{% endif %}
{% if lng == 'fr' %}

View File

@@ -1,4 +1,4 @@
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ app['phraseanet.registry'].get('GV_homeTitle') }} Client</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
@@ -117,8 +117,8 @@
{% set databox = databoxWrapper['databoxes'] %}
{% set collections = databoxWrapper['collections'] %}
{% if collections|length > 0 %}
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
<option value="{{ collection|keys|join(';') }}">{{ databox.get_label(app['locale.I18n']) }}</option>
<optgroup label="{{ databox.get_label(app['locale']) }}">
<option value="{{ collection|keys|join(';') }}">{{ databox.get_label(app['locale']) }}</option>
{% for collId, collection in collections %}
<option value="{{ collId }}" checked="checked">{{ collection.get_name() }}</option>
{% endfor %}
@@ -191,7 +191,7 @@
<div class="basContTitle">
<div class="basTitle">
<input class="basChecker checkbox" id="basChecker{{ sbasId }}" type="checkbox" onclick="chkSbas({{ sbasId }},this)" />
<label for="basChecker{{ sbasId }}">{{ databox.get_label(app['locale.I18n']) }}</label>
<label for="basChecker{{ sbasId }}">{{ databox.get_label(app['locale']) }}</label>
<img onclick="removeFilters({{ sbasId }});" id="filter_danger{{ sbasId }}" class="filter_danger" src="/skins/icons/alert.png" title="{{ "client::recherche: cliquez ici pour desactiver tous les filtres de cette base" | trans }}" style="vertical-align:bottom;width:12px;height:12px;display:none;"/>
</div>
{% set status_bit_filters = '' %}
@@ -202,11 +202,11 @@
<tr>
<td style="width:50%" nowrap>
<input class="checkbox" db="{{ sbasId }}" onchange="checkFilters();" type="checkbox" name="status[]" id="statusfil_{{ sbasId }}_off{{ sbasId }}" value="{{ sbasId }}_of{{ sbasId }}"/>
<label title="{{ data['labels_off_i18n'][app['locale.I18n']] }}" for="statusfil_{{ sbasId }}_off{{ bit }}">{% if data['img_off'] %}<img src="'{{ datas['img_off'] }}" title="{{ datas['labels_off_i18n'][app['locale.I18n']] }}" style="width:16px;height:16px;vertical-align:bottom" />{% endif %}{{ data['labels_off_i18n'][app['locale.I18n']] }}</label>
<label title="{{ data['labels_off_i18n'][app['locale']] }}" for="statusfil_{{ sbasId }}_off{{ bit }}">{% if data['img_off'] %}<img src="'{{ datas['img_off'] }}" title="{{ datas['labels_off_i18n'][app['locale']] }}" style="width:16px;height:16px;vertical-align:bottom" />{% endif %}{{ data['labels_off_i18n'][app['locale']] }}</label>
</td>
<td style="width:50%" nowrap>
<input class="checkbox" db="{{ sbasId }}" onchange="checkFilters();" type="checkbox" name="status[]" id="statusfil_{{ sbasId }}_on{{ sbasId }}" value="{{ sbasId }}_on{{ sbasId }}"/>
<label title="{{ data['labels_on_i18n'][app['locale.I18n']] }}" for="statusfil_{{ sbasId }}_on{{ bit }}">{% if data['img_on']%}<img src="{{ datas['img_on'] }}" title="{{ datas['labels_on_i18n'][app['locale.I18n']] }}" style="width:16px;height:16px;vertical-align:bottom" />{% endif %}{{ data['labels_on_i18n'][app['locale.I18n']] }}</label>
<label title="{{ data['labels_on_i18n'][app['locale']] }}" for="statusfil_{{ sbasId }}_on{{ bit }}">{% if data['img_on']%}<img src="{{ datas['img_on'] }}" title="{{ datas['labels_on_i18n'][app['locale']] }}" style="width:16px;height:16px;vertical-align:bottom" />{% endif %}{{ data['labels_on_i18n'][app['locale']] }}</label>
</td>
</tr>
</table>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ app['locale.I18n'] }}" style="overflow:hidden;">
<html lang="{{ app['locale'] }}" style="overflow:hidden;">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>{% if local_title is defined%}{{local_title}} | {% endif %}{{ app['phraseanet.registry'].get('GV_homeTitle') }} {% if module_name is defined %} - {{ module_name }} {% endif %}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>{% if local_title is defined%}{{local_title}} | {% endif %}{{ app['phraseanet.registry'].get('GV_homeTitle') }} - {{ module_name }} </title>

View File

@@ -3,7 +3,7 @@
<label>{{ 'Collection' | trans }}</label>
<select name="base_id">
{% for collection in app['acl'].get(app['authentication'].getUser()).get_granted_base(['canaddrecord']) %}
<option value="{{ collection.get_base_id() }}">{{ collection.get_databox().get_label(app['locale.I18n']) }} / {{ collection.get_label(app['locale.I18n']) }}</option>
<option value="{{ collection.get_base_id() }}">{{ collection.get_databox().get_label(app['locale']) }} / {{ collection.get_label(app['locale']) }}</option>
{% endfor %}
</select>

View File

@@ -1,7 +1,7 @@
{% extends 'prod/Tooltip/Tooltip.html.twig' %}
{% set title %}
{{ field.get_label(app['locale.I18n']) }}
{{ field.get_label(app['locale']) }}
{% if field.get_type() == 'text' %}
({{ 'Type texte' | trans }})

View File

@@ -1,6 +1,6 @@
{% extends 'prod/Tooltip/Tooltip.html.twig' %}
{% set title %} {{ field.get_label(app['locale.I18n']) }} ({{ field.get_tag().getTagname() }}) {% endset %}
{% set title %} {{ field.get_label(app['locale']) }} ({{ field.get_tag().getTagname() }}) {% endset %}
{% set width = 600 %}
{% set maxwidth = null %}

View File

@@ -47,7 +47,7 @@
<thead>
<tr>
<th colspan="6">
{{ databox.get_label(app['locale.I18n'])|title }}
{{ databox.get_label(app['locale'])|title }}
</th>
</tr>
</thead>
@@ -80,7 +80,7 @@
</td>
<td style='text-align:right'>
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}" {% if inverse == 2 %}style='color:#FF3333'{% endif%}>
{{ values['labels_off_i18n'][app['locale.I18n']] }}
{{ values['labels_off_i18n'][app['locale']] }}
</label>
</td>
<td style='text-align:right'>
@@ -91,7 +91,7 @@
</td>
<td style='text-align:left'>
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}" {% if inverse == 2 %}style='color:#FF3333'{% endif%}>
{{ values['labels_on_i18n'][app['locale.I18n']] }}
{{ values['labels_on_i18n'][app['locale']] }}
</label>
</td>
<td style='text-align:left'>

View File

@@ -39,7 +39,7 @@
<div class="well-small">
<select name="base_id">
{% for collection in collections %}
<option value="{{ collection.get_base_id() }}">{{ collection.get_label(app['locale.I18n']) }}</option>
<option value="{{ collection.get_base_id() }}">{{ collection.get_label(app['locale']) }}</option>
{% endfor %}
</select>
</div>

View File

@@ -87,7 +87,7 @@
<img src="/skins/icons/titre16.png" title="{{ 'This field represents the title of the document' | trans }}" />
{% endif %}
<span id="spanidEditFieldBox_{{i}}">
{{field.get_label(app['locale.I18n'])}} {% if field.is_required() %}<span style="font-weight:bold;font-size:16px;"> * </span>{% endif %} :
{{field.get_label(app['locale'])}} {% if field.is_required() %}<span style="font-weight:bold;font-size:16px;"> * </span>{% endif %} :
</span>
<span class="fieldvalue" id="idEditField_{{i}}" >???</span>
</div>
@@ -245,7 +245,7 @@
<div id='TH_Ofull'>
<div class='thesaurus' ondblclick='return(edit_dblclickThesaurus(event));' onclick='return(edit_clickThesaurus(event));'>
<p id='TH_T.{{ databox.get_sbas_id() }}.T'>
<u id='TH_P.{{ databox.get_sbas_id() }}.T'>+</u><a id='GL_W.{{ databox.get_sbas_id() }}.T' style='FONT-WEIGHT: bold;'>{{ databox.get_label(app['locale.I18n']) }}</a>
<u id='TH_P.{{ databox.get_sbas_id() }}.T'>+</u><a id='GL_W.{{ databox.get_sbas_id() }}.T' style='FONT-WEIGHT: bold;'>{{ databox.get_label(app['locale']) }}</a>
</p>
<div id='TH_K.{{ databox.get_sbas_id() }}.T' class='c'>{{ 'phraseanet::chargement' | trans }}</div>
</div>
@@ -268,7 +268,7 @@
<select id="EditSRField" class="input-xlarge">
<option value="">{{ 'prod::editing::replace: remplacer dans tous les champs' | trans }}</option>
{% for field in fields %}
<option value="{{ field.get_id() }}">{{ field.get_label(app['locale.I18n']) }}</option>
<option value="{{ field.get_id() }}">{{ field.get_label(app['locale']) }}</option>
{% endfor %}
</select>
</td>
@@ -291,11 +291,11 @@
<input type="checkbox" class="checkbox" id="EditSROptionRX" value="regexp" onchange="changeReplaceMode(this);">
{{ 'prod::editing:remplace::option : utiliser une expression reguliere' | trans }}
{% set help_link = 'https://secure.wikimedia.org/wikipedia/en/wiki/Regular_expression' %}
{% if app['locale.I18n'] == 'de' %}
{% if app['locale'] == 'de' %}
{% set help_link = 'https://secure.wikimedia.org/wikipedia/de/wiki/Regul%C3%A4rer_Ausdruck' %}
{% elseif app['locale.I18n'] == 'fr' %}
{% elseif app['locale'] == 'fr' %}
{% set help_link = 'https://secure.wikimedia.org/wikipedia/fr/wiki/Expression_rationnelle' %}
{% elseif app['locale.I18n'] == 'ar' %}
{% elseif app['locale'] == 'ar' %}
{% set help_link = 'https://secure.wikimedia.org/wikipedia/ar/wiki/%D8%AA%D8%B9%D8%A7%D8%A8%D9%8A%D8%B1_%D9%86%D9%85%D8%B7%D9%8A%D8%A9' %}
{% endif %}
<a href="{{help_link}}" target="_blank">

View File

@@ -377,24 +377,24 @@
<tr>
<td>
{% if s['imgoff'] %}
<img src="{{s['imgoff']}}" title="{{s['labels_off_i18n'][app['locale.I18n']]}}" />
<img src="{{s['imgoff']}}" title="{{s['labels_off_i18n'][app['locale']]}}" />
{% endif %}
<label class="checkbox inline">
<input onchange="checkFilters(true);" class="field_switch field_{{s['sbas']|join(' field_')}}"
type="checkbox" value="{{s['sbas']|join(' field_')}}"
n="{{n}}" name="status[{{n}}][off][]" />
{{s['labels_off_i18n'][app['locale.I18n']]}}
{{s['labels_off_i18n'][app['locale']]}}
</label>
</td>
<td>
{% if s['imgoff'] %}
<img src="{{s['imgon']}}" title="{{s['labels_on_i18n'][app['locale.I18n']]}}" />
<img src="{{s['imgon']}}" title="{{s['labels_on_i18n'][app['locale']]}}" />
{% endif %}
<label class="checkbox inline">
<input onchange="checkFilters(true);" class="field_switch field_{{s['sbas']|join(' field_')}}"
type="checkbox" value="{{s['sbas']|join(' field_')}}"
n="{{n}}" name="status[{{n}}][on][]"/>
{{s['labels_on_i18n'][app['locale.I18n']]}}
{{s['labels_on_i18n'][app['locale']]}}
</label>
</td>
</tr>

View File

@@ -20,7 +20,7 @@
{% set th_size = app['authentication'].getUser().getPrefs('images_size')%}
{% if app['locale.I18n'] == 'fr' %}
{% if app['locale'] == 'fr' %}
<div class="client_help">
<h5>{{ 'La recherche s\'effectue grâce à la boîte de dialogue qui se trouve en haut à gauche de l\'écran.' | trans }}
{{ 'Sachez que vous pouvez utiliser les opérateurs ou caractères spéciaux suivants :' | trans }}</h5>

View File

@@ -272,7 +272,7 @@
{% trans with {'%username%' : username} %}Uploaded by : %username%{% endtrans %}
</p>
{% endif %}
<p>{{ "Collection" | trans }} : <span class="info">{{ file.getCollection(app).get_label(app['locale.I18n']) }}</span></p>
<p>{{ "Collection" | trans }} : <span class="info">{{ file.getCollection(app).get_label(app['locale']) }}</span></p>
</div>
<div class="caption">
{% for check in file.getChecks() %}

View File

@@ -52,9 +52,9 @@
{% if collections|length > 0 %}
<select name="base_id" class="span3" style="margin-left: 10px;">
{% for sbasId, availableCollections in collections %}
<optgroup label="{{ availableCollections['databox'].get_label(app['locale.I18n']) }}" class="select-label">
<optgroup label="{{ availableCollections['databox'].get_label(app['locale']) }}" class="select-label">
{% for collection in availableCollections['databox_collections'] %}
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale.I18n']) }}</option>
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale']) }}</option>
{% endfor %}
</optgroup>
{% endfor %}
@@ -72,12 +72,12 @@
{% if status['img_off'] is not empty %}
<img src="{{ status['img_off'] }}" width="16" height="16" />
{% endif %}
<span>{{ status['labels_off_i18n'][app['locale.I18n']]|default('off') }}</span>
<span>{{ status['labels_off_i18n'][app['locale']]|default('off') }}</span>
<input type="radio" name="status[{{ collection.get_base_id() }}][{{ bit }}]" value="0" checked="checked"/>
</td>
<td class="status-tab-right">
<input type="radio" name="status[{{ collection.get_base_id() }}][{{ bit }}]" value="1" />
<span for="labelon">{{ status['labels_on_i18n'][app['locale.I18n']]|default('on') }}</span>
<span for="labelon">{{ status['labels_on_i18n'][app['locale']]|default('on') }}</span>
{% if status['img_on'] is not empty %}
<img src="{{ status['img_on'] }}" width="16" height="16" />
{% endif %}

View File

@@ -57,9 +57,9 @@
{# collections list #}
<select name="base_id" class="span3" style="margin-left: 10px;">
{% for sbasId, availableCollections in collections %}
<optgroup label="{{ availableCollections['databox'].get_label(app['locale.I18n']) }}" class="select-label">
<optgroup label="{{ availableCollections['databox'].get_label(app['locale']) }}" class="select-label">
{% for collection in availableCollections['databox_collections'] %}
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale.I18n']) }}</option>
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale']) }}</option>
{% endfor %}
</optgroup>
{% endfor %}
@@ -77,12 +77,12 @@
{% if status['img_off'] is not empty %}
<img src="{{ status['img_off'] }}" width="16" height="16" />
{% endif %}
<span>{{ status['labels_off_i18n'][app['locale.I18n']]|default('off') }}</span>
<span>{{ status['labels_off_i18n'][app['locale']]|default('off') }}</span>
<input type="radio" name="status[{{ collection.get_base_id() }}][{{ bit }}]" value="0" checked="checked"/>
</td>
<td class="status-tab-right">
<input type="radio" name="status[{{ collection.get_base_id() }}][{{ bit }}]" value="1" />
<span for="labelon">{{ status['labels_on_i18n'][app['locale.I18n']]|default('on') }}</span>
<span for="labelon">{{ status['labels_on_i18n'][app['locale']]|default('on') }}</span>
{% if status['img_on'] is not empty %}
<img src="{{ status['img_on'] }}" width="16" height="16" />
{% endif %}

View File

@@ -1,10 +1,10 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="{{ app['locale.I18n'] }}"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="{{ app['locale.I18n'] }}"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="{{ app['locale.I18n'] }}"> <![endif]-->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="{{ app['locale'] }}"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="{{ app['locale'] }}"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="{{ app['locale'] }}"> <![endif]-->
<!--[if gt IE 8]>
<!-->
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<!--<![endif]-->
<head>
{% block head %}

View File

@@ -4,7 +4,7 @@
{% set opener = "opener" %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: accepter...' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: export au format texte' | trans }}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: export au format texte' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: export en topics' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: export en topics' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -4,7 +4,7 @@
{% set opener = "opener" %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<base target="_self">
<title>{{ 'thesaurus:: Importer' | trans }}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<body onload='parent.importDone("{{ err | e('js') }}");'>
</body>
</html>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>{{ app['phraseanet.registry'].get('GV_homeTitle') }} - {{ 'phraseanet:: thesaurus' | trans }}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: Lier la branche de thesaurus au champ' | trans }}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: Lier la branche de thesaurus' | trans }}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: Lier la branche de thesaurus' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -9,7 +9,7 @@
{% set label = '' %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ title }}</title>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{% if typ == "TS" %}{{ 'thesaurus:: Nouveau terme specifique' | trans }}{% else %}{{ 'thesaurus:: Nouveau synonyme' | trans }}{% endif %}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -4,7 +4,7 @@
{% set opener = "opener" %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'thesaurus:: Proprietes' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ 'Chercher' | trans }}</title>
<link REL="stylesheet" TYPE="text/css" href="{{ path('minifier', { 'f' : 'skins/thesaurus/thesaurus.css' }) }}" />

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app['locale'] }}">
<head>
<title>{{ app['phraseanet.registry'].get('GV_homeTitle') }} - {{ 'phraseanet:: thesaurus' | trans }}</title>
<style id="STYLES">

View File

@@ -2,6 +2,7 @@
namespace Alchemy\Tests\Phrasea\Application;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Manager;
use Alchemy\Phrasea\Core\PhraseaEvents;
@@ -838,7 +839,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
foreach ($content['response']['termsOfUse'] as $terms) {
$this->assertTrue(is_array($terms), 'Une bloc cgu est un objet');
$this->assertArrayHasKey('locale', $terms);
$this->assertTrue(in_array($terms['locale'], ['fr_FR', 'nl_NL', 'en_GB', 'ar_SA', 'de_DE', 'es_ES']));
$this->assertTrue(in_array($terms['locale'], array_keys(Application::getAvailableLanguages())));
$this->assertArrayHasKey('terms', $terms);
}
}

View File

@@ -111,7 +111,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
*/
public function testCookieLocale()
{
foreach (['fr_FR', 'en_GB', 'de_DE'] as $locale) {
foreach (array_keys(Application::getAvailableLanguages()) as $locale) {
$client = $this->getClientWithCookie( $this->getAppThatReturnLocale(), $locale);
$client->request('GET', '/');
@@ -243,7 +243,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
}
/**
* @expectedException Alchemy\Phrasea\Exception\InvalidArgumentException
* @expectedException \Alchemy\Phrasea\Exception\InvalidArgumentException
*/
public function testAddSetFlashWithInvalidArgument()
{

View File

@@ -166,7 +166,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$collection = $this->createOneCollection();
self::$DI['client']->request('POST', '/admin/databox/' . $collection->get_sbas_id() . '/cgus/', [
'TOU' => ['fr_FR' => 'Test update CGUS']
'TOU' => ['fr' => 'Test update CGUS']
]);
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
@@ -187,14 +187,14 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$cgusUpdate = 'Test update CGUS';
$this->XMLHTTPRequest('POST', '/admin/databox/' . self::$DI['collection']->get_sbas_id() . '/cgus/', [
'TOU' => ['fr_FR' => $cgusUpdate]
'TOU' => ['fr' => $cgusUpdate]
]);
$this->checkRedirection(self::$DI['client']->getResponse(), '/admin/databox/' . self::$DI['collection']->get_sbas_id() . '/cgus/?success=1');
$databox = self::$DI['app']['phraseanet.appbox']->get_databox(self::$DI['collection']->get_sbas_id());
$cgus = $databox->get_cgus();
$this->assertEquals($cgus['fr_FR']['value'], $cgusUpdate);
$this->assertEquals($cgus['fr']['value'], $cgusUpdate);
unset($databox);
}

View File

@@ -18,7 +18,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
foreach ($feeds as $feed) {
$this->assertRegExp('/\/admin\/publications\/feed\/' . $feed->getId() . '/', $pageContent);
if ($feed->getCollection() != null) {
$this->assertRegExp('/' . $feed->getCollection()->get_label(self::$DI['app']['locale.I18n']) . '/', $pageContent);
$this->assertRegExp('/' . $feed->getCollection()->get_label(self::$DI['app']['locale']) . '/', $pageContent);
}
if ($feed->isOwner(self::$DI['user'])) {
$this->assertEquals(1, $crawler->filterXPath("//form[@action='/admin/publications/feed/" . $feed->getId() . "/delete/']")->count());

View File

@@ -13,7 +13,7 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testRouteSetLocale()
{
$cookieJar = new CookieJar();
$cookieJar->set(new BrowserCookie('locale', 'de_DE'));
$cookieJar->set(new BrowserCookie('locale', 'de'));
$client = new Client(self::$DI['app'], [], null, $cookieJar);
$crawler = $client->request('GET', '/language/fr_CA/');
@@ -50,7 +50,7 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = self::$DI['client']->request('GET', '/available-languages');
$response = self::$DI['client']->getResponse();
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals((array) json_decode($response->getContent()), self::$DI['app']['locales.I18n.available']);
$this->assertEquals((array) json_decode($response->getContent()), self::$DI['app']['locales.available']);
}
public function testRouteRobots()

View File

@@ -16,12 +16,12 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
{
$app = $this->getAppThatReturnLocale();
$this->mockRegistryAndReturnLocale($app, 'fr_FR');
$this->mockRegistryAndReturnLocale($app, 'fr');
$client = new Client($app);
$client->request('GET', '/', [], [], ['HTTP_accept-language' => '']);
$this->assertEquals('fr_FR', $client->getResponse()->getContent());
$this->assertEquals('fr', $client->getResponse()->getContent());
}
public function testWithCookie()
@@ -29,12 +29,12 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
$app = $this->getAppThatReturnLocale();
$cookieJar = new CookieJar();
$cookieJar->set(new BrowserCookie('locale', 'de_DE'));
$cookieJar->set(new BrowserCookie('locale', 'de'));
$client = new Client($app, [], null, $cookieJar);
$client->request('GET', '/', [], [], ['HTTP_accept-language' => '']);
$this->assertEquals('de_DE', $client->getResponse()->getContent());
$this->assertEquals('de', $client->getResponse()->getContent());
}
public function testWithHeaders()
@@ -44,7 +44,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
$client = new Client($app);
$client->request('GET', '/', [], [], ['HTTP_ACCEPT_LANGUAGE' => 'fr_FR,fr;q=0.9']);
$this->assertEquals('fr_FR', $client->getResponse()->getContent());
$this->assertEquals('fr', $client->getResponse()->getContent());
}
public function testWithHeadersUsingMinus()
@@ -54,7 +54,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
$client = new Client($app);
$client->request('GET', '/', [], [], ['HTTP_ACCEPT_LANGUAGE' => 'fr-FR,fr;q=0.9']);
$this->assertEquals('fr_FR', $client->getResponse()->getContent());
$this->assertEquals('fr', $client->getResponse()->getContent());
}
public function testCookieIsSet()
@@ -71,7 +71,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
}
$this->assertNotNull($settedCookie);
$this->assertEquals('fr_FR', $settedCookie->getValue());
$this->assertEquals('fr', $settedCookie->getValue());
}
/**
@@ -128,7 +128,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
->will($this->returnValue($locale));
}
private function getClientWithCookie(Application $app, $locale = 'fr_FR')
private function getClientWithCookie(Application $app, $locale = 'fr')
{
$cookieJar = new CookieJar();
if ($locale) {

View File

@@ -25,11 +25,11 @@ class LocaleServiceProvidertest extends \PhraseanetPHPUnitAbstract
$app->register(new LocaleServiceProvider());
$app['root.path'] = __DIR__ . '/../../../../../..';
$app->register(new ConfigurationServiceProvider());
$app['conf']->set(['main', 'languages'], ['fr_FR', 'en_US', 'de']);
$app['conf']->set(['main', 'languages'], ['fr', 'zh', 'de']);
$original = Application::getAvailableLanguages();
unset($original['en_GB']);
unset($original['nl_NL']);
unset($original['en']);
unset($original['nl']);
$this->assertEquals($original, $app['locales.available']);
}
@@ -52,33 +52,6 @@ class LocaleServiceProvidertest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($original, $app['locales.available']);
}
public function testLocalesI18nAvailable()
{
$app = new Application();
$app->register(new LocaleServiceProvider());
$this->assertEquals(array_values(Application::getAvailableLanguages()), array_values($app['locales.I18n.available']));
$this->assertEquals(['de', 'en', 'fr', 'nl'], array_keys($app['locales.I18n.available']));
}
public function testLocaleI18n()
{
$app = new Application();
$app->register(new LocaleServiceProvider());
$app['locale'] = 'de_CA';
$this->assertEquals('de', $app['locale.I18n']);
}
public function testLocalel10n()
{
$app = new Application();
$app->register(new LocaleServiceProvider());
$app['locale'] = 'de_CA';
$this->assertEquals('CA', $app['locale.l10n']);
}
public function testLocaleBeforeBoot()
{
$app = new Application();
@@ -88,9 +61,9 @@ class LocaleServiceProvidertest extends \PhraseanetPHPUnitAbstract
->getMock();
$app['phraseanet.registry']->expects($this->once())
->method('get')
->with('GV_default_lng', 'en_GB')
->will($this->returnValue('fr_FR'));
->with('GV_default_lng', 'en')
->will($this->returnValue('fr'));
$this->assertEquals('fr_FR', $app['locale']);
$this->assertEquals('fr', $app['locale']);
}
}