Use symfony translator

This commit is contained in:
Romain Neutron
2013-11-25 09:07:16 +01:00
parent 71df6e96a3
commit 2ba164701d
325 changed files with 1946 additions and 2145 deletions

View File

@@ -125,6 +125,7 @@ use Neutron\ReCaptcha\ReCaptchaServiceProvider;
use PHPExiftool\PHPExiftoolServiceProvider;
use Silex\Application as SilexApplication;
use Silex\Application\UrlGeneratorTrait;
use Silex\Application\TranslationTrait;
use Silex\Provider\FormServiceProvider;
use Silex\Provider\MonologServiceProvider;
use Silex\Provider\SessionServiceProvider;
@@ -157,6 +158,7 @@ use Symfony\Component\Form\Exception\FormException;
class Application extends SilexApplication
{
use UrlGeneratorTrait;
use TranslationTrait;
private static $availableLanguages = [
'de_DE' => 'Deutsch',
@@ -332,7 +334,10 @@ class Application extends SilexApplication
$this->register(new PluginServiceProvider());
$this['phraseanet.exception_handler'] = $this->share(function ($app) {
return PhraseaExceptionHandler::register($app['debug']);
$handler = PhraseaExceptionHandler::register($app['debug']);
$handler->setTranslator($app['translator']);
return $handler;
});
$this['swiftmailer.transport'] = $this->share(function ($app) {
@@ -617,7 +622,9 @@ class Application extends SilexApplication
$twig->addFilter('count', new \Twig_Filter_Function('count'));
$twig->addFilter('formatOctets', new \Twig_Filter_Function('p4string::format_octets'));
$twig->addFilter('base_from_coll', new \Twig_Filter_Function('phrasea::baseFromColl'));
$twig->addFilter('AppName', new \Twig_Filter_Function('Alchemy\Phrasea\Controller\Admin\ConnectedUsers::appName'));
$twig->addFilter(new \Twig_SimpleFilter('AppName', function ($value) use ($app) {
return ConnectedUsers::appName($app['translator'], $value);
}));
$twig->addFilter(new \Twig_SimpleFilter('escapeSimpleQuote', function ($value) {
$ret = str_replace("'", "\'", $value);

View File

@@ -62,7 +62,7 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app->mount('/api/oauthv2', new Oauth2());
$app->mount('/api/v1', new V1());
$app['dispatcher']->addSubscriber(new ApiOauth2ErrorsSubscriber($app['phraseanet.exception_handler']));
$app['dispatcher']->addSubscriber(new ApiOauth2ErrorsSubscriber($app['phraseanet.exception_handler'], $app['translator']));
$app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_END, new ApiLoadEndEvent());
return $app;

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/**
* The checker interface
@@ -39,6 +40,10 @@ interface CheckerInterface
/**
* Get a localized message about the Checker
*
* @param TranslatorInterface $translator A translator
*
* @return string
*/
public static function getMessage();
public static function getMessage(TranslatorInterface $translator);
}

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
class Colorspace extends AbstractChecker
{
@@ -60,8 +61,8 @@ class Colorspace extends AbstractChecker
return new Response($boolean, $this);
}
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('The file does not match available color');
return $translator->trans('The file does not match available color');
}
}

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
class Dimension extends AbstractChecker
{
@@ -52,8 +53,8 @@ class Dimension extends AbstractChecker
return new Response($boolean, $this);
}
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('The file does not match required dimension');
return $translator->trans('The file does not match required dimension');
}
}

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
class Extension extends AbstractChecker
{
@@ -40,8 +41,8 @@ class Extension extends AbstractChecker
return new Response($boolean, $this);
}
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('The file does not match available extensions');
return $translator->trans('The file does not match available extensions');
}
}

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/**
* Checks if a file with the same filename already exists in the destination databox
@@ -53,8 +54,8 @@ class Filename extends AbstractChecker
/**
* {@inheritdoc}
*/
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('A file with the same filename already exists in database');
return $translator->trans('A file with the same filename already exists in database');
}
}

View File

@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use MediaVorus\Media\MediaInterface;
use Symfony\Component\Translation\TranslatorInterface;
class MediaType extends AbstractChecker
{
@@ -48,8 +49,8 @@ class MediaType extends AbstractChecker
return new Response($boolean, $this);
}
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('The file does not match required media type');
return $translator->trans('The file does not match required media type');
}
}

View File

@@ -11,6 +11,8 @@
namespace Alchemy\Phrasea\Border\Checker;
use Symfony\Component\Translation\TranslatorInterface;
/**
* The response of a check
*/
@@ -54,9 +56,9 @@ class Response
*
* @return string
*/
public function getMessage()
public function getMessage(TranslatorInterface $translator)
{
return $this->checker->getMessage();
return $this->checker->getMessage($translator);
}
/**

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/**
* Checks if a file with the same Sha256 checksum already exists in the
@@ -42,8 +43,8 @@ class Sha256 extends AbstractChecker
/**
* {@inheritdoc}
*/
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('A file with the same checksum already exists in database');
return $translator->trans('A file with the same checksum already exists in database');
}
}

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/**
* Checks if a file with the same UUID already exists in the destination databox
@@ -41,8 +42,8 @@ class UUID extends AbstractChecker
/**
* {@inheritdoc}
*/
public static function getMessage()
public static function getMessage(TranslatorInterface $translator)
{
return _('A file with the same UUID already exists in database');
return $translator->trans('A file with the same UUID already exists in database');
}
}

View File

@@ -142,16 +142,16 @@ class Collection implements ControllerProviderInterface
switch ($errorMsg = $request->query->get('error')) {
case 'file-error':
$errorMsg = _('Error while sending the file');
$errorMsg = $app->trans('Error while sending the file');
break;
case 'file-invalid':
$errorMsg = _('Invalid file format');
$errorMsg = $app->trans('Invalid file format');
break;
case 'file-file-too-big':
$errorMsg = _('The file is too big');
$errorMsg = $app->trans('The file is too big');
break;
case 'collection-not-empty':
$errorMsg = _('Empty the collection before removing');
$errorMsg = $app->trans('Empty the collection before removing');
break;
}
@@ -227,17 +227,17 @@ class Collection implements ControllerProviderInterface
public function emptyCollection(Application $app, Request $request, $bas_id)
{
$success = false;
$msg = _('An error occurred');
$msg = $app->trans('An error occurred');
$collection = \collection::get_from_base_id($app, $bas_id);
try {
if ($collection->get_record_amount() <= 500) {
$collection->empty_collection(500);
$msg = _('Collection empty successful');
$msg = $app->trans('Collection empty successful');
} else {
$app['manipulator.task']->createEmptyCollectionJob($collection);
$msg = _('A task has been creted, please run it to complete empty collection');
$msg = $app->trans('A task has been creted, please run it to complete empty collection');
}
$success = true;
@@ -283,7 +283,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
'bas_id' => $collection->get_base_id()
]);
}
@@ -318,7 +318,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
'bas_id' => $collection->get_base_id()
]);
}
@@ -353,7 +353,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
'bas_id' => $collection->get_base_id()
]);
}
@@ -389,7 +389,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
'bas_id' => $collection->get_base_id()
]);
}
@@ -609,18 +609,18 @@ class Collection implements ControllerProviderInterface
public function delete(Application $app, Request $request, $bas_id)
{
$success = false;
$msg = _('An error occured');
$msg = $app->trans('An error occured');
$collection = \collection::get_from_base_id($app, $bas_id);
try {
if ($collection->get_record_amount() > 0) {
$msg = _('Empty the collection before removing');
$msg = $app->trans('Empty the collection before removing');
} else {
$collection->unmount_collection($app);
$collection->delete();
$success = true;
$msg = _('Successful removal');
$msg = $app->trans('Successful removal');
}
} catch (\Exception $e) {
@@ -679,7 +679,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('The publication has been stopped') : _('An error occured')
'msg' => $success ? $app->trans('The publication has been stopped') : $app->trans('An error occured')
]);
}
@@ -700,7 +700,7 @@ class Collection implements ControllerProviderInterface
public function rename(Application $app, Request $request, $bas_id)
{
if (trim($name = $request->request->get('name')) === '') {
$app->abort(400, _('Missing name parameter'));
$app->abort(400, $app->trans('Missing name parameter'));
}
$success = false;
@@ -717,7 +717,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured')
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured')
]);
}
@@ -731,10 +731,10 @@ class Collection implements ControllerProviderInterface
public function labels(Application $app, Request $request, $bas_id)
{
if (null === $labels = $request->request->get('labels')) {
$app->abort(400, _('Missing labels parameter'));
$app->abort(400, $app->trans('Missing labels parameter'));
}
if (false === is_array($labels)) {
$app->abort(400, _('Invalid labels parameter'));
$app->abort(400, $app->trans('Invalid labels parameter'));
}
$collection = \collection::get_from_base_id($app, $bas_id);
@@ -755,7 +755,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured')
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured')
]);
}
@@ -794,7 +794,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured')
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured')
]);
}
@@ -828,7 +828,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured')
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured')
]);
}
@@ -862,7 +862,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured')
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured')
]);
}
@@ -961,7 +961,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'bas_id' => $collection->get_base_id()
]);
}

View File

@@ -15,6 +15,7 @@ use Alchemy\Geonames\Exception\ExceptionInterface as GeonamesExceptionInterface;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\TranslatorInterface;
class ConnectedUsers implements ControllerProviderInterface
{
@@ -115,18 +116,18 @@ class ConnectedUsers implements ControllerProviderInterface
* @return string
* @return null
*/
public static function appName($appId)
public static function appName(TranslatorInterface $translator, $appId)
{
$appRef = [
'0' => _('admin::monitor: module inconnu'),
'1' => _('admin::monitor: module production'),
'2' => _('admin::monitor: module client'),
'3' => _('admin::monitor: module admin'),
'4' => _('admin::monitor: module report'),
'5' => _('admin::monitor: module thesaurus'),
'6' => _('admin::monitor: module comparateur'),
'7' => _('admin::monitor: module validation'),
'8' => _('admin::monitor: module upload'),
'0' => $translator->trans('admin::monitor: module inconnu'),
'1' => $translator->trans('admin::monitor: module production'),
'2' => $translator->trans('admin::monitor: module client'),
'3' => $translator->trans('admin::monitor: module admin'),
'4' => $translator->trans('admin::monitor: module report'),
'5' => $translator->trans('admin::monitor: module thesaurus'),
'6' => $translator->trans('admin::monitor: module comparateur'),
'7' => $translator->trans('admin::monitor: module validation'),
'8' => $translator->trans('admin::monitor: module upload'),
];
return isset($appRef[$appId]) ? $appRef[$appId] : null;

View File

@@ -60,10 +60,10 @@ class Dashboard implements ControllerProviderInterface
{
switch ($emailStatus = $request->query->get('email')) {
case 'sent';
$emailStatus = _('Mail sent');
$emailStatus = $app->trans('Mail sent');
break;
case 'error':
$emailStatus = _('Could not send email');
$emailStatus = $app->trans('Could not send email');
break;
}

View File

@@ -166,13 +166,13 @@ class Databox implements ControllerProviderInterface
switch ($errorMsg = $request->query->get('error')) {
case 'file-error':
$errorMsg = _('Error while sending the file');
$errorMsg = $app->trans('Error while sending the file');
break;
case 'file-invalid':
$errorMsg = _('Invalid file format');
$errorMsg = $app->trans('Invalid file format');
break;
case 'file-too-big':
$errorMsg = _('The file is too big');
$errorMsg = $app->trans('The file is too big');
break;
}
@@ -212,18 +212,18 @@ class Databox implements ControllerProviderInterface
public function deleteBase(Application $app, Request $request, $databox_id)
{
$success = false;
$msg = _('An error occured');
$msg = $app->trans('An error occured');
try {
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
if ($databox->get_record_amount() > 0) {
$msg = _('admin::base: vider la base avant de la supprimer');
$msg = $app->trans('admin::base: vider la base avant de la supprimer');
} else {
$databox->unmount_databox();
$app['phraseanet.appbox']->write_databox_pic($app['media-alchemyst'], $app['filesystem'], $databox, null, \databox::PIC_PDF);
$databox->delete();
$success = true;
$msg = _('Successful removal');
$msg = $app->trans('Successful removal');
}
} catch (\Exception $e) {
@@ -252,10 +252,10 @@ class Databox implements ControllerProviderInterface
public function setLabels(Application $app, Request $request, $databox_id)
{
if (null === $labels = $request->request->get('labels')) {
$app->abort(400, _('Missing labels parameter'));
$app->abort(400, $app->trans('Missing labels parameter'));
}
if (false === is_array($labels)) {
$app->abort(400, _('Invalid labels parameter'));
$app->abort(400, $app->trans('Invalid labels parameter'));
}
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
@@ -276,7 +276,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured')
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured')
]);
}
@@ -305,7 +305,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}
@@ -338,7 +338,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}
@@ -493,7 +493,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}
@@ -526,7 +526,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}
@@ -548,7 +548,7 @@ class Databox implements ControllerProviderInterface
public function changeViewName(Application $app, Request $request, $databox_id)
{
if (null === $viewName = $request->request->get('viewname')) {
$app->abort(400, _('Missing view name parameter'));
$app->abort(400, $app->trans('Missing view name parameter'));
}
$success = false;
@@ -563,7 +563,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}
@@ -598,7 +598,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('The publication has been stopped') : _('An error occured'),
'msg' => $success ? $app->trans('The publication has been stopped') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}
@@ -618,7 +618,7 @@ class Databox implements ControllerProviderInterface
*/
public function emptyDatabase(Application $app, Request $request, $databox_id)
{
$msg = _('An error occurred');
$msg = $app->trans('An error occurred');
$success = false;
$taskCreated = false;
@@ -633,11 +633,11 @@ class Databox implements ControllerProviderInterface
}
}
$msg = _('Base empty successful');
$msg = $app->trans('Base empty successful');
$success = true;
if ($taskCreated) {
$msg = _('A task has been created, please run it to complete empty collection');
$msg = $app->trans('A task has been created, please run it to complete empty collection');
}
} catch (\Exception $e) {
@@ -668,14 +668,14 @@ class Databox implements ControllerProviderInterface
public function progressBarInfos(Application $app, Request $request, $databox_id)
{
if (!$app['request']->isXmlHttpRequest() || 'json' !== $app['request']->getRequestFormat()) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, $app->trans('Bad request format, only JSON is allowed'));
}
$app['phraseanet.appbox'] = $app['phraseanet.appbox'];
$ret = [
'success' => false,
'msg' => _('An error occured'),
'msg' => $app->trans('An error occured'),
'sbas_id' => null,
'indexable' => false,
'records' => 0,
@@ -690,7 +690,7 @@ class Databox implements ControllerProviderInterface
$datas = $databox->get_indexed_record_amount();
$ret['indexable'] = $app['phraseanet.appbox']->is_databox_indexable($databox);
$ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname());
$ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? $app->trans('admin::base: aucun alias') : $databox->get_viewname());
$ret['records'] = $databox->get_record_amount();
$ret['sbas_id'] = $databox_id;
$ret['xml_indexed'] = $datas['xml_indexed'];
@@ -701,7 +701,7 @@ class Databox implements ControllerProviderInterface
}
$ret['success'] = true;
$ret['msg'] = _('Successful update');
$ret['msg'] = $app->trans('Successful update');
} catch (\Exception $e) {
}
@@ -747,7 +747,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),
'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id
]);
}

View File

@@ -74,7 +74,7 @@ class Databoxes implements ControllerProviderInterface
'version' => 'unknown',
'image' => '/skins/icons/db-remove.png',
'server_info' => '',
'name' => _('Unreachable server')
'name' => $app->trans('Unreachable server')
];
try {
@@ -93,31 +93,31 @@ class Databoxes implements ControllerProviderInterface
switch ($errorMsg = $request->query->get('error')) {
case 'scheduler-started' :
$errorMsg = _('Veuillez arreter le planificateur avant la mise a jour');
$errorMsg = $app->trans('Veuillez arreter le planificateur avant la mise a jour');
break;
case 'already-started' :
$errorMsg = _('The upgrade is already started');
$errorMsg = $app->trans('The upgrade is already started');
break;
case 'unknow' :
$errorMsg = _('An error occured');
$errorMsg = $app->trans('An error occured');
break;
case 'bad-email' :
$errorMsg = _('Please fix the database before starting');
$errorMsg = $app->trans('Please fix the database before starting');
break;
case 'special-chars' :
$errorMsg = _('Database name can not contains special characters');
$errorMsg = $app->trans('Database name can not contains special characters');
break;
case 'base-failed' :
$errorMsg = _('Base could not be created');
$errorMsg = $app->trans('Base could not be created');
break;
case 'database-failed' :
$errorMsg = _('Database does not exists or can not be accessed');
$errorMsg = $app->trans('Database does not exists or can not be accessed');
break;
case 'no-empty' :
$errorMsg = _('Database can not be empty');
$errorMsg = $app->trans('Database can not be empty');
break;
case 'mount-failed' :
$errorMsg = _('Database could not be mounted');
$errorMsg = $app->trans('Database could not be mounted');
break;
}

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Metadata\TagProvider;
use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController;
use JMS\TranslationBundle\Annotation\Ignore;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -113,7 +114,7 @@ class Fields implements ControllerProviderInterface
$fields[] = $field->toArray();
} catch (\Exception $e) {
$connection->rollback();
$app->abort(500, _(sprintf('Field %s could not be saved, please try again or contact an admin.', $jsonField['name'])));
$app->abort(500, $app->trans('Field %name% could not be saved, please try again or contact an admin.', array('%name%' => $jsonField['name'])));
break;
}
}
@@ -126,16 +127,16 @@ class Fields implements ControllerProviderInterface
public function getLanguage(Application $app, Request $request)
{
return $app->json([
'something_wrong' => _('Something wrong happened, please try again or contact an admin.'),
'created_success' => _('%s field has been created with success.'),
'deleted_success' => _('%s field has been deleted with success.'),
'are_you_sure_delete' => _('Do you really want to delete the field %s ?'),
'validation_blank' => _('Field can not be blank.'),
'validation_name_exists' => _('Field name already exists.'),
'validation_name_invalid' => _('Field name is not valid.'),
'validation_tag_invalid' => _('Field source is not valid.'),
'field_error' => _('Field %s contains errors.'),
'fields_save' => _('Your configuration has been successfuly saved.'),
'something_wrong' => $app->trans('Something wrong happened, please try again or contact an admin.'),
'created_success' => $app->trans('%s field has been created with success.'),
'deleted_success' => $app->trans('%s field has been deleted with success.'),
'are_you_sure_delete' => $app->trans('Do you really want to delete the field %s ?'),
'validation_blank' => $app->trans('Field can not be blank.'),
'validation_name_exists' => $app->trans('Field name already exists.'),
'validation_name_invalid' => $app->trans('Field name is not valid.'),
'validation_tag_invalid' => $app->trans('Field source is not valid.'),
'field_error' => $app->trans('Field %s contains errors.'),
'fields_save' => $app->trans('Your configuration has been successfuly saved.'),
]);
}
@@ -201,6 +202,7 @@ class Fields implements ControllerProviderInterface
$res[] = [
'id' => $namespace . '/' . $tagname,
/** @Ignore */
'label' => $datas['namespace'] . ' / ' . $datas['tagname'],
'value' => $datas['namespace'] . ':' . $datas['tagname'],
];
@@ -233,7 +235,7 @@ class Fields implements ControllerProviderInterface
$this->updateFieldWithData($app, $field, $data);
$field->save();
} catch (\Exception $e) {
$app->abort(500, _(sprintf('Field %s could not be created, please try again or contact an admin.', $data['name'])));
$app->abort(500, $app->trans('Field %name% could not be created, please try again or contact an admin.', array('%name%' => $data['name'])));
}
return $app->json($field->toArray(), 201, [
@@ -371,7 +373,7 @@ class Fields implements ControllerProviderInterface
private function validateNameField(\databox_descriptionStructure $metaStructure, array $field)
{
if (null !== $metaStructure->get_element_by_name($field['name'])) {
throw new BadRequestHttpException(_(sprintf('Field %s already exists.', $field['name'])));
throw new BadRequestHttpException(sprintf('Field %s already exists.', $field['name']));
}
}
@@ -380,7 +382,7 @@ class Fields implements ControllerProviderInterface
try {
\databox_field::loadClassFromTagName($field['tag'], true);
} catch (\Exception_Databox_metadataDescriptionNotFound $e) {
throw new BadRequestHttpException(_(sprintf('Provided tag %s is unknown.', $field['tag'])));
throw new BadRequestHttpException(sprintf('Provided tag %s is unknown.', $field['tag']));
}
}

View File

@@ -107,7 +107,7 @@ class Publications implements ControllerProviderInterface
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $request->attributes->get('id'));
if (!$feed->isOwner($app['authentication']->getUser())) {
return $app->redirectPath('admin_feeds_feed', ['id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it')]);
return $app->redirectPath('admin_feeds_feed', ['id' => $request->attributes->get('id'), 'error' => $app->trans('You are not the owner of this feed, you can not edit it')]);
}
})
->bind('admin_feeds_feed_update')
@@ -179,7 +179,7 @@ class Publications implements ControllerProviderInterface
$datas['success'] = true;
} catch (\Exception $e) {
$datas['message'] = _('Unable to add file to Phraseanet');
$datas['message'] = $app->trans('Unable to add file to Phraseanet');
}
return $app->json($datas);

View File

@@ -160,15 +160,15 @@ class Root implements ControllerProviderInterface
$controllers->get('/test-paths/', function (Application $app, Request $request) {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, $app->trans('Bad request format, only JSON is allowed'));
}
if (0 !== count($tests = $request->query->get('tests', []))) {
$app->abort(400, _('Missing tests parameter'));
$app->abort(400, $app->trans('Missing tests parameter'));
}
if (null !== $path = $request->query->get('path')) {
$app->abort(400, _('Missing path parameter'));
$app->abort(400, $app->trans('Missing path parameter'));
}
foreach ($tests as $test) {
@@ -198,7 +198,7 @@ class Root implements ControllerProviderInterface
$databox = $app['phraseanet.appbox']->get_databox((int) $databox_id);
$structure = $databox->get_structure();
$errors = \databox::get_structure_errors($structure);
$errors = \databox::get_structure_errors($app['translator'], $structure);
if ($updateOk = !!$request->query->get('success', false)) {
$updateOk = true;
@@ -224,10 +224,10 @@ class Root implements ControllerProviderInterface
}
if (null === $structure = $request->request->get('structure')) {
$app->abort(400, _('Missing "structure" parameter'));
$app->abort(400, $app->trans('Missing "structure" parameter'));
}
$errors = \databox::get_structure_errors($structure);
$errors = \databox::get_structure_errors($app['translator'], $structure);
$domst = new \DOMDocument('1.0', 'UTF-8');
$domst->preserveWhiteSpace = false;
@@ -266,19 +266,19 @@ class Root implements ControllerProviderInterface
switch ($errorMsg = $request->query->get('error')) {
case 'rights':
$errorMsg = _('You do not enough rights to update status');
$errorMsg = $app->trans('You do not enough rights to update status');
break;
case 'too-big':
$errorMsg = _('File is too big : 64k max');
$errorMsg = $app->trans('File is too big : 64k max');
break;
case 'upload-error':
$errorMsg = _('Status icon upload failed : upload error');
$errorMsg = $app->trans('Status icon upload failed : upload error');
break;
case 'wright-error':
$errorMsg = _('Status icon upload failed : can not write on disk');
$errorMsg = $app->trans('Status icon upload failed : can not write on disk');
break;
case 'unknow-error':
$errorMsg = _('Something wrong happend');
$errorMsg = $app->trans('Something wrong happend');
break;
}
@@ -312,7 +312,7 @@ class Root implements ControllerProviderInterface
$controllers->post('/statusbit/{databox_id}/status/{bit}/delete/', function (Application $app, Request $request, $databox_id, $bit) {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, $app->trans('Bad request format, only JSON is allowed'));
}
if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_sbas($databox_id, 'bas_modify_struct')) {

View File

@@ -52,9 +52,9 @@ class Setup implements ControllerProviderInterface
if (null !== $update = $request->query->get('update')) {
if (!!$update) {
$update = _('Update succeed');
$update = $app->trans('Update succeed');
} else {
$update = _('Update failed');
$update = $app->trans('Update failed');
}
}

View File

@@ -290,20 +290,20 @@ class Users implements ControllerProviderInterface
$buffer[] = [
'ID'
, 'Login'
, _('admin::compte-utilisateur nom')
, _('admin::compte-utilisateur prenom')
, _('admin::compte-utilisateur email')
, $app->trans('admin::compte-utilisateur nom')
, $app->trans('admin::compte-utilisateur prenom')
, $app->trans('admin::compte-utilisateur email')
, 'CreationDate'
, 'ModificationDate'
, _('admin::compte-utilisateur adresse')
, _('admin::compte-utilisateur ville')
, _('admin::compte-utilisateur code postal')
, _('admin::compte-utilisateur pays')
, _('admin::compte-utilisateur telephone')
, _('admin::compte-utilisateur fax')
, _('admin::compte-utilisateur poste')
, _('admin::compte-utilisateur societe')
, _('admin::compte-utilisateur activite')
, $app->trans('admin::compte-utilisateur adresse')
, $app->trans('admin::compte-utilisateur ville')
, $app->trans('admin::compte-utilisateur code postal')
, $app->trans('admin::compte-utilisateur pays')
, $app->trans('admin::compte-utilisateur telephone')
, $app->trans('admin::compte-utilisateur fax')
, $app->trans('admin::compte-utilisateur poste')
, $app->trans('admin::compte-utilisateur societe')
, $app->trans('admin::compte-utilisateur activite')
];
do {
$elligible_users->limit($offset, 20);
@@ -558,10 +558,10 @@ class Users implements ControllerProviderInterface
if (($accept != '' || $deny != '')) {
$message = '';
if ($accept != '') {
$message .= "\n" . _('login::register:email: Vous avez ete accepte sur les collections suivantes : ') . implode(', ', $accept). "\n";
$message .= "\n" . $app->trans('login::register:email: Vous avez ete accepte sur les collections suivantes :') . implode(', ', $accept). "\n";
}
if ($deny != '') {
$message .= "\n" . _('login::register:email: Vous avez ete refuse sur les collections suivantes : ') . implode(', ', $deny) . "\n";
$message .= "\n" . $app->trans('login::register:email: Vous avez ete refuse sur les collections suivantes :') . implode(', ', $deny) . "\n";
}
$receiver = new Receiver(null, $row['usr_mail']);
@@ -656,12 +656,12 @@ class Users implements ControllerProviderInterface
if ($sqlField === 'usr_login') {
$loginToAdd = $value;
if ($loginToAdd === "") {
$out['errors'][] = sprintf(_("Login line %d is empty"), $nbLine + 1);
$out['errors'][] = $app->trans("Login line %line% is empty", array('%line%' => $nbLine + 1));
} elseif (in_array($loginToAdd, $loginNew)) {
$out['errors'][] = sprintf(_("Login %s is already defined in the file at line %d"), $loginToAdd, $nbLine);
$out['errors'][] = $app->trans("Login %login% is already defined in the file at line %line%", array('%login%' => $loginToAdd, '%line%' => $nbLine));
} else {
if (\User_Adapter::get_usr_id_from_login($app, $loginToAdd)) {
$out['errors'][] = sprintf(_("Login %s already exists in database"), $loginToAdd);
$out['errors'][] = $app->trans("Login %login% already exists in database", array('%login%' => $loginToAdd));
} else {
$loginValid = true;
}
@@ -672,9 +672,9 @@ class Users implements ControllerProviderInterface
$mailToAdd = $value;
if ($mailToAdd === "") {
$out['errors'][] = sprintf(_("Mail line %d is empty"), $nbLine + 1);
$out['errors'][] = $app->trans("Mail line %line% is empty", array('%line%' => $nbLine + 1));
} elseif (false !== \User_Adapter::get_usr_id_from_email($app, $mailToAdd)) {
$out['errors'][] = sprintf(_("Email '%s' for login '%s' already exists in database"), $mailToAdd, $loginToAdd);
$out['errors'][] = $app->trans("Email '%email%' for login '%login%' already exists in database", array('%email%' => $mailToAdd, '%login%' => $loginToAdd));
} else {
$mailValid = true;
}
@@ -684,7 +684,7 @@ class Users implements ControllerProviderInterface
$passwordToVerif = $value;
if ($passwordToVerif === "") {
$out['errors'][] = sprintf(_("Password is empty at line %d"), $nbLine);
$out['errors'][] = $app->trans("Password is empty at line %line%", array('%line%' => $nbLine));
} else {
$pwdValid = true;
}

View File

@@ -81,7 +81,7 @@ class Oauth2 implements ControllerProviderInterface
$usr_id = $app['auth.native']->getUsrId($request->get("login"), $request->get("password"), $request);
if (null === $usr_id) {
$app['session']->getFlashBag()->set('error', _('login::erreur: Erreur d\'authentification'));
$app['session']->getFlashBag()->set('error', $app->trans('login::erreur: Erreur d\'authentification'));
return $app->redirectPath('oauth2_authorize');
}

View File

@@ -68,7 +68,7 @@ class V1 implements ControllerProviderInterface
if ($oAuth2App->get_client_id() == \API_OAuth2_Application_Navigator::CLIENT_ID
&& !$app['phraseanet.registry']->get('GV_client_navigator')) {
throw new \API_V1_exception_forbidden(_('The use of phraseanet Navigator is not allowed'));
throw new \API_V1_exception_forbidden('The use of phraseanet Navigator is not allowed');
}
if ($oAuth2App->get_client_id() == \API_OAuth2_Application_OfficePlugin::CLIENT_ID

View File

@@ -211,20 +211,20 @@ class Root implements ControllerProviderInterface
public function getClientLanguage(Application $app, Request $request)
{
$out = [];
$out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['chuNameEmpty'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['noDLok'] = _('export:: aucun document n\'est disponible au telechargement');
$out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez');
$out['createWinInvite'] = $app->trans('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['chuNameEmpty'] = $app->trans('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['noDLok'] = $app->trans('export:: aucun document n\'est disponible au telechargement');
$out['confirmRedirectAuth'] = $app->trans('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez');
$out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName');
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
$out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
$out['confirmDelBasket'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
$out['annuler'] = _('boutton::annuler');
$out['fermer'] = _('boutton::fermer');
$out['renewRss'] = _('boutton::renouveller');
$out['print'] = _('Print');
$out['no_basket'] = _('Please create a basket before adding an element');
$out['serverError'] = $app->trans('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
$out['serverTimeout'] = $app->trans('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = $app->trans('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
$out['confirmDelBasket'] = $app->trans('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
$out['annuler'] = $app->trans('boutton::annuler');
$out['fermer'] = $app->trans('boutton::fermer');
$out['renewRss'] = $app->trans('boutton::renouveller');
$out['print'] = $app->trans('Print');
$out['no_basket'] = $app->trans('Please create a basket before adding an element');
return $app->json($out);
}
@@ -246,7 +246,7 @@ class Root implements ControllerProviderInterface
$renderTopics = '';
if ($app['phraseanet.registry']->get('GV_client_render_topics') == 'popups') {
$renderTopics = \queries::dropdown_topics($app['locale.I18n']);
$renderTopics = \queries::dropdown_topics($app['translator'], $app['locale.I18n']);
} elseif ($app['phraseanet.registry']->get('GV_client_render_topics') == 'tree') {
$renderTopics = \queries::tree_topics($app['locale.I18n']);
}

View File

@@ -39,7 +39,7 @@ class Lightbox implements ControllerProviderInterface
}
if (false === $usr_id = $app['authentication.token-validator']->isValid($request->query->get('LOG'))) {
$app->addFlash('error', _('The URL you used is out of date, please login'));
$app->addFlash('error', $app->trans('The URL you used is out of date, please login'));
return $app->redirectPath('homepage');
}
@@ -238,7 +238,7 @@ class Lightbox implements ControllerProviderInterface
'basket' => $basket,
'local_title' => strip_tags($basket->getName()),
'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation')
'module_name' => $app->trans('admin::monitor: module validation')
]
));
$response->setCharset('UTF-8');
@@ -285,7 +285,7 @@ class Lightbox implements ControllerProviderInterface
'basket' => $basket,
'local_title' => strip_tags($basket->getName()),
'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation')
'module_name' => $app->trans('admin::monitor: module validation')
]
));
$response->setCharset('UTF-8');
@@ -319,7 +319,7 @@ class Lightbox implements ControllerProviderInterface
'first_item' => $first,
'local_title' => $feed_entry->getTitle(),
'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation')
'module_name' => $app->trans('admin::monitor: module validation')
]
);
$response = new Response($output, 200);
@@ -337,7 +337,7 @@ class Lightbox implements ControllerProviderInterface
->assert('basket', '\d+');
$controllers->post('/ajax/SET_NOTE/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
$output = ['error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')];
$output = ['error' => true, 'datas' => $app->trans('Erreur lors de l\'enregistrement des donnees')];
$request = $app['request'];
$note = $request->request->get('note');
@@ -390,7 +390,7 @@ class Lightbox implements ControllerProviderInterface
$ret = [
'error' => true,
'releasable' => false,
'datas' => _('Erreur lors de la mise a jour des donnes ')
'datas' => $app->trans('Erreur lors de la mise a jour des donnes')
];
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
@@ -420,7 +420,7 @@ class Lightbox implements ControllerProviderInterface
$releasable = false;
if ($participant->isReleasable() === true) {
$releasable = _('Do you want to send your report ?');
$releasable = $app->trans('Do you want to send your report ?');
}
$ret = [
@@ -459,7 +459,7 @@ class Lightbox implements ControllerProviderInterface
}
if (!$agreed) {
throw new ControllerException(_('You have to give your feedback at least on one document to send a report'));
throw new ControllerException($app->trans('You have to give your feedback at least on one document to send a report'));
}
/* @var $basket Basket */
@@ -488,7 +488,7 @@ class Lightbox implements ControllerProviderInterface
$app['EM']->merge($participant);
$app['EM']->flush();
$datas = ['error' => false, 'datas' => _('Envoie avec succes')];
$datas = ['error' => false, 'datas' => $app->trans('Envoie avec succes')];
} catch (ControllerException $e) {
$datas = ['error' => true, 'datas' => $e->getMessage()];
}

View File

@@ -149,7 +149,7 @@ class BasketController implements ControllerProviderInterface
if ($request->getRequestFormat() === 'json') {
$data = [
'success' => true
, 'message' => _('Basket created')
, 'message' => $app->trans('Basket created')
, 'basket' => [
'id' => $Basket->getId()
]
@@ -168,7 +168,7 @@ class BasketController implements ControllerProviderInterface
$data = [
'success' => true
, 'message' => _('Basket has been deleted')
, 'message' => $app->trans('Basket has been deleted')
];
if ($request->getRequestFormat() === 'json') {
@@ -191,7 +191,7 @@ class BasketController implements ControllerProviderInterface
$data = [
'success' => true
, 'message' => _('Record removed from basket')
, 'message' => $app->trans('Record removed from basket')
];
if ($request->getRequestFormat() === 'json') {
@@ -213,13 +213,13 @@ class BasketController implements ControllerProviderInterface
$app['EM']->flush();
$success = true;
$msg = _('Basket has been updated');
$msg = $app->trans('Basket has been updated');
} catch (NotFoundHttpException $e) {
$msg = _('The requested basket does not exist');
$msg = $app->trans('The requested basket does not exist');
} catch (AccessDeniedHttpException $e) {
$msg = _('You do not have access to this basket');
$msg = $app->trans('You do not have access to this basket');
} catch (\Exception $e) {
$msg = _('An error occurred');
$msg = $app->trans('An error occurred');
}
$data = [
@@ -247,7 +247,7 @@ class BasketController implements ControllerProviderInterface
public function reorder(Application $app, BasketEntity $basket)
{
$ret = ['success' => false, 'message' => _('An error occured')];
$ret = ['success' => false, 'message' => $app->trans('An error occured')];
try {
$order = $app['request']->request->get('element');
@@ -261,7 +261,7 @@ class BasketController implements ControllerProviderInterface
}
$app['EM']->flush();
$ret = ['success' => true, 'message' => _('Basket updated')];
$ret = ['success' => true, 'message' => $app->trans('Basket updated')];
} catch (\Exception $e) {
}
@@ -279,9 +279,9 @@ class BasketController implements ControllerProviderInterface
$app['EM']->flush();
if ($archive_status) {
$message = _('Basket has been archived');
$message = $app->trans('Basket has been archived');
} else {
$message = _('Basket has been unarchived');
$message = $app->trans('Basket has been unarchived');
}
$data = [
@@ -335,7 +335,7 @@ class BasketController implements ControllerProviderInterface
$data = [
'success' => true
, 'message' => sprintf(_('%d records added'), $n)
, 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n))
];
if ($request->getRequestFormat() === 'json') {
@@ -367,7 +367,7 @@ class BasketController implements ControllerProviderInterface
$data = [
'success' => true
, 'message' => sprintf(_('%d records moved'), $n)
, 'message' => $app->trans('%quantity% records moved', array('%quantity%' => $n))
];
if ($request->getRequestFormat() === 'json') {

View File

@@ -178,9 +178,9 @@ class Bridge implements ControllerProviderInterface
$account->delete();
$success = true;
} catch (\Bridge_Exception_AccountNotFound $e) {
$message = _('Account is not found.');
$message = $app->trans('Account is not found.');
} catch (\Exception $e) {
$message = _('Something went wrong, please contact an administrator');
$message = $app->trans('Something went wrong, please contact an administrator');
}
return $app->json(['success' => $success, 'message' => $message]);
@@ -274,7 +274,7 @@ class Bridge implements ControllerProviderInterface
'account_id' => $account_id,
'type' => $element_type,
'page' => '',
'error' => _('Vous ne pouvez pas editer plusieurs elements simultanement'),
'error' => $app->trans('Vous ne pouvez pas editer plusieurs elements simultanement'),
]);
}
foreach ($elements as $element_id) {
@@ -295,7 +295,7 @@ class Bridge implements ControllerProviderInterface
break;
default:
throw new \Exception(_('Vous essayez de faire une action que je ne connais pas !'));
throw new \Exception($app->trans('Vous essayez de faire une action que je ne connais pas !'));
break;
}
@@ -333,7 +333,7 @@ class Bridge implements ControllerProviderInterface
switch ($action) {
case 'modify':
if (count($elements) != 1) {
return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?elements_list=' . implode(';', $elements) . '&error=' . _('Vous ne pouvez pas editer plusieurs elements simultanement'));
return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?elements_list=' . implode(';', $elements) . '&error=' . $app->trans('Vous ne pouvez pas editer plusieurs elements simultanement'));
}
try {
foreach ($elements as $element_id) {
@@ -350,7 +350,7 @@ class Bridge implements ControllerProviderInterface
'action' => $action,
'elements' => $elements,
'adapter_action' => $action,
'error_message' => _('Request contains invalid datas'),
'error_message' => $app->trans('Request contains invalid datas'),
'constraint_errors' => $errors,
'notice_message' => $request->request->get('notice'),
];
@@ -451,7 +451,7 @@ class Bridge implements ControllerProviderInterface
$params = [
'route' => $route,
'account' => $account,
'error_message' => _('Request contains invalid datas'),
'error_message' => $app->trans('Request contains invalid datas'),
'constraint_errors' => $errors,
'notice_message' => $request->request->get('notice'),
'adapter_action' => 'upload',
@@ -467,6 +467,6 @@ class Bridge implements ControllerProviderInterface
\Bridge_Element::create($app, $account, $record, $title, \Bridge_Element::STATUS_PENDING, $default_type, $datas);
}
return $app->redirect('/prod/bridge/adapter/' . $account->get_id() . '/load-records/?notice=' . sprintf(_('%d elements en attente'), count($route->get_elements())));
return $app->redirect('/prod/bridge/adapter/' . $account->get_id() . '/load-records/?notice=' . $app->trans('%quantity% elements en attente', array('%quantity%' => count($route->get_elements()))));
}
}

View File

@@ -82,8 +82,8 @@ class DoDownload implements ControllerProviderInterface
return new Response($app['twig']->render(
'/prod/actions/Download/prepare.html.twig', [
'module_name' => _('Export'),
'module' => _('Export'),
'module_name' => $app->trans('Export'),
'module' => $app->trans('Export'),
'list' => $list,
'records' => $records,
'token' => $token,

View File

@@ -55,25 +55,27 @@ class Edit implements ControllerProviderInterface
$separator = $meta->get_separator();
/** @Ignore */
$JSFields[$meta->get_id()] = [
'meta_struct_id' => $meta->get_id()
, 'name' => $meta->get_name()
, '_status' => 0
, '_value' => ''
, '_sgval' => []
, 'required' => $meta->is_required()
, 'label' => $meta->get_label($app['locale.I18n'])
, 'readonly' => $meta->is_readonly()
, 'type' => $meta->get_type()
, 'format' => ''
, 'explain' => ''
, 'tbranch' => $meta->get_tbranch()
, 'maxLength' => $meta->get_tag()->getMaxLength()
, 'minLength' => $meta->get_tag()->getMinLength()
, 'multi' => $meta->is_multi()
, 'separator' => $separator
, 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null
, 'vocabularyRestricted' => $meta->getVocabularyControl() ? $meta->isVocabularyRestricted() : false
'meta_struct_id' => $meta->get_id(),
'name' => $meta->get_name(),
'_status' => 0,
'_value' => '',
'_sgval' => [],
'required' => $meta->is_required(),
/** @Ignore */
'label' => $meta->get_label($app['locale.I18n']),
'readonly' => $meta->is_readonly(),
'type' => $meta->get_type(),
'format' => '',
'explain' => '',
'tbranch' => $meta->get_tbranch(),
'maxLength' => $meta->get_tag()->getMaxLength(),
'minLength' => $meta->get_tag()->getMinLength(),
'multi' => $meta->is_multi(),
'separator' => $separator,
'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null,
'vocabularyRestricted' => $meta->getVocabularyControl() ? $meta->isVocabularyRestricted() : false,
];
if (trim($meta->get_tbranch()) !== '') {
@@ -237,7 +239,7 @@ class Edit implements ControllerProviderInterface
$VC = VocabularyController::get($app, $vocabulary);
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
} catch (\Exception $e) {
$datas['message'] = _('Vocabulary not found');
$datas['message'] = $app->trans('Vocabulary not found');
return $app->json($datas);
}

View File

@@ -94,10 +94,10 @@ class Export implements ControllerProviderInterface
$ftpClient = $app['phraseanet.ftp.client']($request->request->get('address', ''), 21, 90, !!$request->request->get('ssl'));
$ftpClient->login($request->request->get('login', 'anonymous'), $request->request->get('password', 'anonymous'));
$ftpClient->close();
$msg = _('Connection to FTP succeed');
$msg = $app->trans('Connection to FTP succeed');
$success = true;
} catch (\Exception $e) {
$msg = sprintf(_('Error while connecting to FTP'));
$msg = $app->trans('Error while connecting to FTP');
}
return $app->json([
@@ -127,7 +127,7 @@ class Export implements ControllerProviderInterface
if (count($download->get_display_ftp()) == 0) {
return $app->json([
'success' => false,
'message' => _("You do not have required rights to send these documents over FTP")
'message' => $app->trans("You do not have required rights to send these documents over FTP")
]);
}
@@ -155,12 +155,12 @@ class Export implements ControllerProviderInterface
return $app->json([
'success' => true,
'message' => _('Export saved in the waiting queue')
'message' => $app->trans('Export saved in the waiting queue')
]);
} catch (\Exception $e) {
return $app->json([
'success' => false,
'message' => _('Something went wrong')
'message' => $app->trans('Something went wrong')
]);
}
}

View File

@@ -187,7 +187,7 @@ class Feed implements ControllerProviderInterface
$app->abort(404, 'Entry not found');
}
if (!$entry->isPublisher($app['authentication']->getUser()) && $entry->getFeed()->isOwner($app['authentication']->getUser()) === false) {
$app->abort(403, _('Action Forbidden : You are not the publisher'));
$app->abort(403, $app->trans('Action Forbidden : You are not the publisher'));
}
$app['EM']->remove($entry);
@@ -245,10 +245,10 @@ class Feed implements ControllerProviderInterface
);
$output = [
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
'texte' => '<p>' . $app->trans('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
. '</p><p>' . $app->trans('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
<div><input type="text" readonly="readonly" class="input_select_copy" value="' . $link->getURI() . '"/></div>',
'titre' => _('publications::votre rss personnel')
'titre' => $app->trans('publications::votre rss personnel')
];
return $app->json($output);
@@ -264,10 +264,10 @@ class Feed implements ControllerProviderInterface
$link = $app['feed.user-link-generator']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS, null, $renew);
$output = [
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
'texte' => '<p>' . $app->trans('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
. '</p><p>' . $app->trans('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
<div><input type="text" style="width:100%" value="' . $link->getURI() . '"/></div>',
'titre' => _('publications::votre rss personnel')
'titre' => $app->trans('publications::votre rss personnel')
];
return $app->json($output);

View File

@@ -25,88 +25,88 @@ class Language implements ControllerProviderInterface
$controller->get("/", function (Application $app) {
$out = [];
$out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.');
$out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
$out['thesaurusBasesChanged'] = $app->trans('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.');
$out['confirmDel'] = $app->trans('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
$out['serverError'] = $app->trans('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
$out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName');
$out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
$out['hideMessage'] = _('phraseanet::Ne plus afficher ce message');
$out['confirmGroup'] = _('Supprimer egalement les documents rattaches a ces regroupements');
$out['confirmDelete'] = _('reponses:: Ces enregistrements vont etre definitivement supprimes et ne pourront etre recuperes. Etes vous sur ?');
$out['cancel'] = _('boutton::annuler');
$out['deleteTitle'] = _('boutton::supprimer');
$out['deleteRecords'] = _('Delete records');
$out['edit_hetero'] = _('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\'');
$out['confirm_abandon'] = _('prod::editing::annulation: abandonner les modification ?');
$out['loading'] = _('phraseanet::chargement');
$out['valider'] = _('boutton::valider');
$out['annuler'] = _('boutton::annuler');
$out['create'] = _('boutton::creer');
$out['rechercher'] = _('boutton::rechercher');
$out['renewRss'] = _('boutton::renouveller');
$out['candeletesome'] = _('Vous n\'avez pas les droits pour supprimer certains documents');
$out['candeletedocuments'] = _('Vous n\'avez pas les droits pour supprimer ces documents');
$out['needTitle'] = _('Vous devez donner un titre');
$out['newPreset'] = _('Nouveau modele');
$out['fermer'] = _('boutton::fermer');
$out['feed_require_fields'] = _('Vous n\'avez pas rempli tous les champ requis');
$out['feed_require_feed'] = _('Vous n\'avez pas selectionne de fil de publication');
$out['removeTitle'] = _('panier::Supression d\'un element d\'un reportage');
$out['confirmRemoveReg'] = _('panier::Attention, vous etes sur le point de supprimer un element du reportage. Merci de confirmer votre action.');
$out['advsearch_title'] = _('phraseanet::recherche avancee');
$out['bask_rename'] = _('panier:: renommer le panier');
$out['reg_wrong_sbas'] = _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre');
$out['error'] = _('phraseanet:: Erreur');
$out['warningDenyCgus'] = _('cgus :: Attention, si vous refuser les CGUs de cette base, vous n\'y aures plus acces');
$out['cgusRelog'] = _('cgus :: Vous devez vous reauthentifier pour que vos parametres soient pris en compte.');
$out['editDelMulti'] = _('edit:: Supprimer %s du champ dans les records selectionnes');
$out['editAddMulti'] = _('edit:: Ajouter %s au champ courrant pour les records selectionnes');
$out['editDelSimple'] = _('edit:: Supprimer %s du champ courrant');
$out['editAddSimple'] = _('edit:: Ajouter %s au champ courrant');
$out['cantDeletePublicOne'] = _('panier:: vous ne pouvez pas supprimer un panier public');
$out['wrongsbas'] = _('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre');
$out['max_record_selected'] = _('Vous ne pouvez pas selectionner plus de 800 enregistrements');
$out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez');
$out['error_test_publi'] = _('Erreur : soit les parametres sont incorrects, soit le serveur distant ne repond pas');
$out['test_publi_ok'] = _('Les parametres sont corrects, le serveur distant est operationnel');
$out['some_not_published'] = _('Certaines publications n\'ont pu etre effectuees, verifiez vos parametres');
$out['error_not_published'] = _('Aucune publication effectuee, verifiez vos parametres');
$out['warning_delete_publi'] = _('Attention, en supprimant ce preregalge, vous ne pourrez plus modifier ou supprimer de publications prealablement effectues avec celui-ci');
$out['some_required_fields'] = _('edit::certains documents possedent des champs requis non remplis. Merci de les remplir pour valider votre editing');
$out['nodocselected'] = _('Aucun document selectionne');
$out['sureToRemoveList'] = _('Are you sure you want to delete this list ?');
$out['newListName'] = _('New list name ?');
$out['listNameCannotBeEmpty'] = _('List name can not be empty');
$out['FeedBackName'] = _('Name');
$out['FeedBackMessage'] = _('Message');
$out['FeedBackDuration'] = _('Time for feedback (days)');
$out['FeedBackNameMandatory'] = _('Please provide a name for this selection.');
$out['send'] = _('Send');
$out['Recept'] = _('Accuse de reception');
$out['nFieldsChanged'] = _('%d fields have been updated');
$out['FeedBackNoUsersSelected'] = _('No users selected');
$out['errorFileApi'] = _('An error occurred reading this file');
$out['errorFileApiTooBig'] = _('This file is too big');
$out['selectOneRecord'] = _('Please select one record');
$out['onlyOneRecord'] = _('You can choose only one record');
$out['errorAjaxRequest'] = _('An error occured, please retry');
$out['fileBeingDownloaded'] = _('Some files are being downloaded');
$out['warning'] = _('Attention');
$out['browserFeatureSupport'] = _('This feature is not supported by your browser');
$out['noActiveBasket'] = _('No active basket');
$out['pushUserCanDownload'] = _('User can download HD');
$out['feedbackCanContribute'] = _('User contribute to the feedback');
$out['feedbackCanSeeOthers'] = _('User can see others choices');
$out['forceSendDocument'] = _('Force sending of the document ?');
$out['export'] = _('Export');
$out['share'] = _('Share');
$out['move'] = _('Move');
$out['push'] = _('Push');
$out['feedback'] = _('Feedback');
$out['toolbox'] = _('Tool box');
$out['print'] = _('Print');
$out['attention'] = _('Attention !');
$out['serverTimeout'] = $app->trans('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = $app->trans('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
$out['hideMessage'] = $app->trans('phraseanet::Ne plus afficher ce message');
$out['confirmGroup'] = $app->trans('Supprimer egalement les documents rattaches a ces regroupements');
$out['confirmDelete'] = $app->trans('reponses:: Ces enregistrements vont etre definitivement supprimes et ne pourront etre recuperes. Etes vous sur ?');
$out['cancel'] = $app->trans('boutton::annuler');
$out['deleteTitle'] = $app->trans('boutton::supprimer');
$out['deleteRecords'] = $app->trans('Delete records');
$out['edit_hetero'] = $app->trans('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\'');
$out['confirm_abandon'] = $app->trans('prod::editing::annulation: abandonner les modification ?');
$out['loading'] = $app->trans('phraseanet::chargement');
$out['valider'] = $app->trans('boutton::valider');
$out['annuler'] = $app->trans('boutton::annuler');
$out['create'] = $app->trans('boutton::creer');
$out['rechercher'] = $app->trans('boutton::rechercher');
$out['renewRss'] = $app->trans('boutton::renouveller');
$out['candeletesome'] = $app->trans('Vous n\'avez pas les droits pour supprimer certains documents');
$out['candeletedocuments'] = $app->trans('Vous n\'avez pas les droits pour supprimer ces documents');
$out['needTitle'] = $app->trans('Vous devez donner un titre');
$out['newPreset'] = $app->trans('Nouveau modele');
$out['fermer'] = $app->trans('boutton::fermer');
$out['feed_require_fields'] = $app->trans('Vous n\'avez pas rempli tous les champ requis');
$out['feed_require_feed'] = $app->trans('Vous n\'avez pas selectionne de fil de publication');
$out['removeTitle'] = $app->trans('panier::Supression d\'un element d\'un reportage');
$out['confirmRemoveReg'] = $app->trans('panier::Attention, vous etes sur le point de supprimer un element du reportage. Merci de confirmer votre action.');
$out['advsearch_title'] = $app->trans('phraseanet::recherche avancee');
$out['bask_rename'] = $app->trans('panier:: renommer le panier');
$out['reg_wrong_sbas'] = $app->trans('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre');
$out['error'] = $app->trans('phraseanet:: Erreur');
$out['warningDenyCgus'] = $app->trans('cgus :: Attention, si vous refuser les CGUs de cette base, vous n\'y aures plus acces');
$out['cgusRelog'] = $app->trans('cgus :: Vous devez vous reauthentifier pour que vos parametres soient pris en compte.');
$out['editDelMulti'] = $app->trans('edit:: Supprimer %s du champ dans les records selectionnes');
$out['editAddMulti'] = $app->trans('edit:: Ajouter %s au champ courrant pour les records selectionnes');
$out['editDelSimple'] = $app->trans('edit:: Supprimer %s du champ courrant');
$out['editAddSimple'] = $app->trans('edit:: Ajouter %s au champ courrant');
$out['cantDeletePublicOne'] = $app->trans('panier:: vous ne pouvez pas supprimer un panier public');
$out['wrongsbas'] = $app->trans('panier:: Un reportage ne peux recevoir que des elements provenants de la base ou il est enregistre');
$out['max_record_selected'] = $app->trans('Vous ne pouvez pas selectionner plus de 800 enregistrements');
$out['confirmRedirectAuth'] = $app->trans('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez');
$out['error_test_publi'] = $app->trans('Erreur : soit les parametres sont incorrects, soit le serveur distant ne repond pas');
$out['test_publi_ok'] = $app->trans('Les parametres sont corrects, le serveur distant est operationnel');
$out['some_not_published'] = $app->trans('Certaines publications n\'ont pu etre effectuees, verifiez vos parametres');
$out['error_not_published'] = $app->trans('Aucune publication effectuee, verifiez vos parametres');
$out['warning_delete_publi'] = $app->trans('Attention, en supprimant ce preregalge, vous ne pourrez plus modifier ou supprimer de publications prealablement effectues avec celui-ci');
$out['some_required_fields'] = $app->trans('edit::certains documents possedent des champs requis non remplis. Merci de les remplir pour valider votre editing');
$out['nodocselected'] = $app->trans('Aucun document selectionne');
$out['sureToRemoveList'] = $app->trans('Are you sure you want to delete this list ?');
$out['newListName'] = $app->trans('New list name ?');
$out['listNameCannotBeEmpty'] = $app->trans('List name can not be empty');
$out['FeedBackName'] = $app->trans('Name');
$out['FeedBackMessage'] = $app->trans('Message');
$out['FeedBackDuration'] = $app->trans('Time for feedback (days)');
$out['FeedBackNameMandatory'] = $app->trans('Please provide a name for this selection.');
$out['send'] = $app->trans('Send');
$out['Recept'] = $app->trans('Accuse de reception');
$out['nFieldsChanged'] = $app->trans('%d fields have been updated');
$out['FeedBackNoUsersSelected'] = $app->trans('No users selected');
$out['errorFileApi'] = $app->trans('An error occurred reading this file');
$out['errorFileApiTooBig'] = $app->trans('This file is too big');
$out['selectOneRecord'] = $app->trans('Please select one record');
$out['onlyOneRecord'] = $app->trans('You can choose only one record');
$out['errorAjaxRequest'] = $app->trans('An error occured, please retry');
$out['fileBeingDownloaded'] = $app->trans('Some files are being downloaded');
$out['warning'] = $app->trans('Attention');
$out['browserFeatureSupport'] = $app->trans('This feature is not supported by your browser');
$out['noActiveBasket'] = $app->trans('No active basket');
$out['pushUserCanDownload'] = $app->trans('User can download HD');
$out['feedbackCanContribute'] = $app->trans('User contribute to the feedback');
$out['feedbackCanSeeOthers'] = $app->trans('User can see others choices');
$out['forceSendDocument'] = $app->trans('Force sending of the document ?');
$out['export'] = $app->trans('Export');
$out['share'] = $app->trans('Share');
$out['move'] = $app->trans('Move');
$out['push'] = $app->trans('Push');
$out['feedback'] = $app->trans('Feedback');
$out['toolbox'] = $app->trans('Tool box');
$out['print'] = $app->trans('Print');
$out['attention'] = $app->trans('Attention !');
return $app->json($out);
});

View File

@@ -113,7 +113,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile LazaretFile */
if (null === $lazaretFile) {
$ret['message'] = _('File is not present in quarantine anymore, please refresh');
$ret['message'] = $app->trans('File is not present in quarantine anymore, please refresh');
return $app->json($ret);
}
@@ -157,7 +157,7 @@ class Lazaret implements ControllerProviderInterface
//Mandatory parameter
if (null === $request->request->get('bas_id')) {
$ret['message'] = _('You must give a destination collection');
$ret['message'] = $app->trans('You must give a destination collection');
return $app->json($ret);
}
@@ -166,7 +166,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile LazaretFile */
if (null === $lazaretFile) {
$ret['message'] = _('File is not present in quarantine anymore, please refresh');
$ret['message'] = $app->trans('File is not present in quarantine anymore, please refresh');
return $app->json($ret);
}
@@ -246,7 +246,7 @@ class Lazaret implements ControllerProviderInterface
$ret['success'] = true;
} catch (\Exception $e) {
$ret['message'] = _('An error occured');
$ret['message'] = $app->trans('An error occured');
}
try {
@@ -274,7 +274,7 @@ class Lazaret implements ControllerProviderInterface
$lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id);
/* @var $lazaretFile LazaretFile */
if (null === $lazaretFile) {
$ret['message'] = _('File is not present in quarantine anymore, please refresh');
$ret['message'] = $app->trans('File is not present in quarantine anymore, please refresh');
return $app->json($ret);
}
@@ -330,7 +330,7 @@ class Lazaret implements ControllerProviderInterface
$ret['success'] = true;
} catch (\Exception $e) {
$app['EM']->rollback();
$ret['message'] = _('An error occured');
$ret['message'] = $app->trans('An error occured');
}
return $app->json($ret);
@@ -351,7 +351,7 @@ class Lazaret implements ControllerProviderInterface
//Mandatory parameter
if (null === $recordId = $request->request->get('record_id')) {
$ret['message'] = _('You must give a destination record');
$ret['message'] = $app->trans('You must give a destination record');
return $app->json($ret);
}
@@ -360,7 +360,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile LazaretFile */
if (null === $lazaretFile) {
$ret['message'] = _('File is not present in quarantine anymore, please refresh');
$ret['message'] = $app->trans('File is not present in quarantine anymore, please refresh');
return $app->json($ret);
}
@@ -378,7 +378,7 @@ class Lazaret implements ControllerProviderInterface
}
if (!$found) {
$ret['message'] = _('The destination record provided is not allowed');
$ret['message'] = $app->trans('The destination record provided is not allowed');
return $app->json($ret);
}
@@ -404,7 +404,7 @@ class Lazaret implements ControllerProviderInterface
$ret['success'] = true;
} catch (\Exception $e) {
$ret['message'] = _('An error occured');
$ret['message'] = $app->trans('An error occured');
}
try {

View File

@@ -70,13 +70,13 @@ class MoveCollection implements ControllerProviderInterface
try {
if (null === $request->request->get('base_id')) {
$datas['message'] = _('Missing target collection');
$datas['message'] = $app->trans('Missing target collection');
return $app->json($datas);
}
if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
$datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_labels($move->getBaseIdDestination(), $app));
$datas['message'] = $app->trans("You do not have the permission to move records to %collection%", array('%collection%', \phrasea::bas_labels($request->request->get('base_id'), $app)));
return $app->json($datas);
}
@@ -84,7 +84,7 @@ class MoveCollection implements ControllerProviderInterface
try {
$collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
} catch (\Exception_Databox_CollectionNotFound $e) {
$datas['message'] = _('Invalid target collection');
$datas['message'] = $app->trans('Invalid target collection');
return $app->json($datas);
}
@@ -103,12 +103,12 @@ class MoveCollection implements ControllerProviderInterface
$ret = [
'success' => true,
'message' => _('Records have been successfuly moved'),
'message' => $app->trans('Records have been successfuly moved'),
];
} catch (\Exception $e) {
$ret = [
'success' => false,
'message' => _('An error occured'),
'message' => $app->trans('An error occured'),
];
}

View File

@@ -135,7 +135,7 @@ class Order implements ControllerProviderInterface
});
if ($noAdmins) {
$msg = _('There is no one to validate orders, please contact an administrator');
$msg = $app->trans('There is no one to validate orders, please contact an administrator');
}
$order->setTodo($order->getElements()->count());
@@ -154,12 +154,12 @@ class Order implements ControllerProviderInterface
}
if ($success) {
$msg = _('The records have been properly ordered');
$msg = $app->trans('The records have been properly ordered');
} else {
$msg = _('An error occured');
$msg = $app->trans('An error occured');
}
} else {
$msg = _('There is no record eligible for an order');
$msg = $app->trans('There is no record eligible for an order');
}
if ('json' === $app['request']->getRequestFormat()) {
@@ -247,7 +247,7 @@ class Order implements ControllerProviderInterface
if (null === $basket) {
$basket = new Basket();
$basket->setName(sprintf(_('Commande du %s'), $order->getCreatedOn()->format('Y-m-d')));
$basket->setName($app->trans('Commande du %date%', array('%date%' => $order->getCreatedOn()->format('Y-m-d'))));
$basket->setOwner($dest_user);
$basket->setPusher($app['authentication']->getUser());
@@ -301,7 +301,7 @@ class Order implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Order has been sent') : _('An error occured while sending, please retry or contact an admin if problem persists'),
'msg' => $success ? $app->trans('Order has been sent') : $app->trans('An error occured while sending, please retry or contact an admin if problem persists'),
'order_id' => $order_id
]);
}
@@ -361,7 +361,7 @@ class Order implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $success ? _('Order has been denied') : _('An error occured while denying, please retry or contact an admin if problem persists'),
'msg' => $success ? $app->trans('Order has been denied') : $app->trans('An error occured while denying, please retry or contact an admin if problem persists'),
'order_id' => $order_id
]);
}

View File

@@ -154,30 +154,30 @@ class Push implements ControllerProviderInterface
$ret = [
'success' => false,
'message' => _('Unable to send the documents')
'message' => $app->trans('Unable to send the documents')
];
try {
$pusher = new RecordHelper\Push($app, $app['request']);
$push_name = $request->request->get('name', sprintf(_('Push from %s'), $app['authentication']->getUser()->get_display_name()));
$push_name = $request->request->get('name', $app->trans('Push from %user%', array('%user%' => $app['authentication']->getUser()->get_display_name())));
$push_description = $request->request->get('push_description');
$receivers = $request->request->get('participants');
if (!is_array($receivers) || count($receivers) === 0) {
throw new ControllerException(_('No receivers specified'));
throw new ControllerException($app->trans('No receivers specified'));
}
if (!is_array($pusher->get_elements()) || count($pusher->get_elements()) === 0) {
throw new ControllerException(_('No elements to push'));
throw new ControllerException($app->trans('No elements to push'));
}
foreach ($receivers as $receiver) {
try {
$user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $app);
} catch (\Exception $e) {
throw new ControllerException(sprintf(_('Unknown user %d'), $receiver['usr_id']));
throw new ControllerException($app->trans('Unknown user %user_id%', array('%user_id%' => $receiver['usr_id'])));
}
$Basket = new Basket();
@@ -247,11 +247,10 @@ class Push implements ControllerProviderInterface
$app['EM']->flush();
$message = sprintf(
_('%1$d records have been sent to %2$d users')
, count($pusher->get_elements())
, count($receivers)
);
$message = $app->trans('%quantity_records% records have been sent to %quantity_users% users', array(
'%quantity_records%' => count($pusher->get_elements()),
'%quantity_users%' => count($receivers),
));
$ret = [
'success' => true,
@@ -269,7 +268,7 @@ class Push implements ControllerProviderInterface
$ret = [
'success' => false,
'message' => _('Unable to send the documents')
'message' => $app->trans('Unable to send the documents')
];
$app['EM']->beginTransaction();
@@ -279,17 +278,17 @@ class Push implements ControllerProviderInterface
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket');
$validation_name = $request->request->get('name', sprintf(_('Validation from %s'), $app['authentication']->getUser()->get_display_name()));
$validation_name = $request->request->get('name', $app->trans('Validation from %user%', array('%user%' => $app['authentication']->getUser()->get_display_name())));
$validation_description = $request->request->get('validation_description');
$participants = $request->request->get('participants');
if (!is_array($participants) || count($participants) === 0) {
throw new ControllerException(_('No participants specified'));
throw new ControllerException($app->trans('No participants specified'));
}
if (!is_array($pusher->get_elements()) || count($pusher->get_elements()) === 0) {
throw new ControllerException(_('No elements to validate'));
throw new ControllerException($app->trans('No elements to validate'));
}
if ($pusher->is_basket()) {
@@ -355,13 +354,13 @@ class Push implements ControllerProviderInterface
foreach ($participants as $key => $participant) {
foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) {
if (!array_key_exists($mandatoryparam, $participant))
throw new ControllerException(sprintf(_('Missing mandatory parameter %s'), $mandatoryparam));
throw new ControllerException($app->trans('Missing mandatory parameter %parameter%', array('%parameter%' => $mandatoryparam)));
}
try {
$participant_user = \User_Adapter::getInstance($participant['usr_id'], $app);
} catch (\Exception $e) {
throw new ControllerException(sprintf(_('Unknown user %d'), $receiver['usr_id']));
throw new ControllerException($app->trans('Unknown user %usr_id%', array('%usr_id%' => $participant['usr_id'])));
}
try {
@@ -446,11 +445,10 @@ class Push implements ControllerProviderInterface
$app['EM']->flush();
$message = sprintf(
_('%1$d records have been sent for validation to %2$d users')
, count($pusher->get_elements())
, count($request->request->get('participants'))
);
$message = $app->trans('%quantity_records% records have been sent for validation to %quantity_users% users', array(
'%quantity_records%' => count($pusher->get_elements()),
'%quantity_users%' => count($request->request->get('participants')),
));
$ret = [
'success' => true,
@@ -511,19 +509,19 @@ class Push implements ControllerProviderInterface
try {
if (!$app['acl']->get($app['authentication']->getUser())->has_right('manageusers'))
throw new ControllerException(_('You are not allowed to add users'));
throw new ControllerException($app->trans('You are not allowed to add users'));
if (!$request->request->get('firstname'))
throw new ControllerException(_('First name is required'));
throw new ControllerException($app->trans('First name is required'));
if (!$request->request->get('lastname'))
throw new ControllerException(_('Last name is required'));
throw new ControllerException($app->trans('Last name is required'));
if (!$request->request->get('email'))
throw new ControllerException(_('Email is required'));
throw new ControllerException($app->trans('Email is required'));
if (!\Swift_Validate::email($request->request->get('email')))
throw new ControllerException(_('Email is invalid'));
throw new ControllerException($app->trans('Email is invalid'));
} catch (ControllerException $e) {
$result['message'] = $e->getMessage();
@@ -537,7 +535,7 @@ class Push implements ControllerProviderInterface
$usr_id = \User_Adapter::get_usr_id_from_email($app, $email);
$user = \User_Adapter::getInstance($usr_id, $app);
$result['message'] = _('User already exists');
$result['message'] = $app->trans('User already exists');
$result['success'] = true;
$result['user'] = $userFormatter($user);
} catch (\Exception $e) {
@@ -560,11 +558,11 @@ class Push implements ControllerProviderInterface
if ($request->request->get('form_geonameid'))
$user->set_geonameid($request->request->get('form_geonameid'));
$result['message'] = _('User successfully created');
$result['message'] = $app->trans('User successfully created');
$result['success'] = true;
$result['user'] = $userFormatter($user);
} catch (\Exception $e) {
$result['message'] = _('Error while creating user');
$result['message'] = $app->trans('Error while creating user');
}
}

View File

@@ -153,16 +153,16 @@ class Query implements ControllerProviderInterface
$explain .= "<img src=\"/skins/icons/answers.gif\" /><span><b>";
if ($result->getTotal() != $result->getAvailable()) {
$explain .= sprintf(_('reponses:: %d Resultats rappatries sur un total de %d trouves'), $result->getAvailable(), $result->getTotal());
$explain .= $app->trans('reponses:: %available% Resultats rappatries sur un total de %total% trouves', array('available' => $result->getAvailable(), '%total%' => $result->getTotal()));
} else {
$explain .= sprintf(_('reponses:: %d Resultats'), $result->getTotal());
$explain .= $app->trans('reponses:: %total% Resultats', array('%total%' => $result->getTotal()));
}
$explain .= " </b></span>";
$explain .= '<br><div>' . $result->getDuration() . ' s</div>dans index ' . $result->getIndexes();
$explain .= "</div>";
$infoResult = '<a href="#" class="infoDialog" infos="' . str_replace('"', '&quot;', $explain) . '">' . sprintf(_('reponses:: %d reponses'), $result->getTotal()) . '</a> | ' . sprintf(_('reponses:: %s documents selectionnes'), '<span id="nbrecsel"></span>');
$infoResult = '<a href="#" class="infoDialog" infos="' . str_replace('"', '&quot;', $explain) . '">' . $app->trans('reponses:: %total% reponses', array('%total%' => $result->getTotal())) . '</a> | ' . $app->trans('reponses:: %number% documents selectionnes', array('%number%' => '<span id="nbrecsel"></span>'));
$json['infos'] = $infoResult;
$json['navigation'] = $string;

View File

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

View File

@@ -87,7 +87,7 @@ class Story implements ControllerProviderInterface
if ($request->getRequestFormat() == 'json') {
$data = [
'success' => true
, 'message' => _('Story created')
, 'message' => $app->trans('Story created')
, 'WorkZone' => $StoryWZ->getId()
, 'story' => [
'sbas_id' => $Story->get_sbas_id(),
@@ -136,7 +136,7 @@ class Story implements ControllerProviderInterface
$data = [
'success' => true
, 'message' => sprintf(_('%d records added'), $n)
, 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n))
];
if ($request->getRequestFormat() == 'json') {
@@ -158,7 +158,7 @@ class Story implements ControllerProviderInterface
$data = [
'success' => true
, 'message' => _('Record removed from story')
, 'message' => $app->trans('Record removed from story')
];
if ($request->getRequestFormat() == 'json') {
@@ -195,7 +195,7 @@ class Story implements ControllerProviderInterface
->assert('record_id', '\d+');
$controllers->post('/{sbas_id}/{record_id}/reorder/', function (Application $app, $sbas_id, $record_id) {
$ret = ['success' => false, 'message' => _('An error occured')];
$ret = ['success' => false, 'message' => $app->trans('An error occured')];
try {
$story = new \record_adapter($app, $sbas_id, $record_id);
@@ -205,7 +205,7 @@ class Story implements ControllerProviderInterface
}
if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($story->get_base_id(), 'canmodifrecord')) {
throw new ControllerException(_('You can not edit this story'));
throw new ControllerException($app->trans('You can not edit this story'));
}
$sql = 'UPDATE regroup SET ord = :ord
@@ -223,7 +223,7 @@ class Story implements ControllerProviderInterface
$stmt->closeCursor();
$ret = ['success' => true, 'message' => _('Story updated')];
$ret = ['success' => true, 'message' => $app->trans('Story updated')];
} catch (ControllerException $e) {
$ret = ['success' => false, 'message' => $e->getMessage()];
} catch (\Exception $e) {

View File

@@ -95,7 +95,7 @@ class TOU implements ControllerProviderInterface
return new Response($app['twig']->render('/prod/TOU.html.twig', [
'TOUs' => $data,
'local_title' => _('Terms of use')
'local_title' => $app->trans('Terms of use')
]));
}
}

View File

@@ -111,7 +111,7 @@ class Tools implements ControllerProviderInterface
$controllers->post('/hddoc/', function (Application $app, Request $request) {
$success = false;
$message = _('An error occured');
$message = $app->trans('An error occured');
if ($file = $request->files->get('newHD')) {
@@ -153,12 +153,12 @@ class Tools implements ControllerProviderInterface
unlink($tempoFile);
rmdir($tempoDir);
$success = true;
$message = _('Document has been successfully substitued');
$message = $app->trans('Document has been successfully substitued');
} catch (\Exception $e) {
$message = _('file is not valid');
$message = $app->trans('file is not valid');
}
} else {
$message = _('file is not valid');
$message = $app->trans('file is not valid');
}
} else {
$app->abort(400, 'Missing file parameter');
@@ -172,7 +172,7 @@ class Tools implements ControllerProviderInterface
$controllers->post('/chgthumb/', function (Application $app, Request $request) {
$success = false;
$message = _('An error occured');
$message = $app->trans('An error occured');
if ($file = $request->files->get('newThumb')) {
@@ -207,12 +207,12 @@ class Tools implements ControllerProviderInterface
unlink($tempoFile);
rmdir($tempoDir);
$success = true;
$message = _('Thumbnail has been successfully substitued');
$message = $app->trans('Thumbnail has been successfully substitued');
} catch (\Exception $e) {
$message = _('file is not valid');
$message = $app->trans('file is not valid');
}
} else {
$message = _('file is not valid');
$message = $app->trans('file is not valid');
}
} else {
$app->abort(400, 'Missing file parameter');
@@ -236,7 +236,7 @@ class Tools implements ControllerProviderInterface
];
$return['datas'] = $app['twig']->render($template, $var);
} catch (\Exception $e) {
$return['datas'] = _('an error occured');
$return['datas'] = $app->trans('an error occured');
$return['error'] = true;
}

View File

@@ -180,10 +180,10 @@ class Upload implements ControllerProviderInterface
$reasons = [];
$elementCreated = null;
$callback = function ($element, $visa, $code) use (&$reasons, &$elementCreated) {
$callback = function ($element, $visa, $code) use ($app, &$reasons, &$elementCreated) {
foreach ($visa->getResponses() as $response) {
if (!$response->isOk()) {
$reasons[] = $response->getMessage();
$reasons[] = $response->getMessage($app['translator']);
}
}
@@ -203,7 +203,7 @@ class Upload implements ControllerProviderInterface
if ($elementCreated instanceof \record_adapter) {
$id = $elementCreated->get_serialize_key();
$element = 'record';
$message = _('The record was successfully created');
$message = $app->trans('The record was successfully created');
$app['phraseanet.SE']->addRecord($elementCreated);
// try to create thumbnail from data URI
@@ -235,7 +235,7 @@ class Upload implements ControllerProviderInterface
$id = $elementCreated->getId();
$element = 'lazaret';
$message = _('The file was moved to the quarantine');
$message = $app->trans('The file was moved to the quarantine');
}
$datas = [
@@ -247,7 +247,7 @@ class Upload implements ControllerProviderInterface
'id' => $id,
];
} catch (\Exception $e) {
$datas['message'] = _('Unable to add file to Phraseanet');
$datas['message'] = $app->trans('Unable to add file to Phraseanet');
}
$response = $app->json($datas);

View File

@@ -153,13 +153,13 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => false
, 'message' => sprintf(_('Unable to create list %s'), $list_name)
, 'message' => $app->trans('Unable to create list %name%', array('%name%' => $list_name))
, 'list_id' => null
];
try {
if (!$list_name) {
throw new ControllerException(_('List name is required'));
throw new ControllerException($app->trans('List name is required'));
}
$List = new UsrList();
@@ -178,7 +178,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => true
, 'message' => sprintf(_('List %s has been created'), $list_name)
, 'message' => $app->trans('List %name% has been created', array('%name%' => $list_name))
, 'list_id' => $List->getId()
];
} catch (ControllerException $e) {
@@ -243,14 +243,14 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => false
, 'message' => _('Unable to update list')
, 'message' => $app->trans('Unable to update list')
];
try {
$list_name = $request->request->get('name');
if (!$list_name) {
throw new ControllerException(_('List name is required'));
throw new ControllerException($app->trans('List name is required'));
}
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrList');
@@ -258,7 +258,7 @@ class UsrLists implements ControllerProviderInterface
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
throw new ControllerException(_('You are not authorized to do this'));
throw new ControllerException($app->trans('You are not authorized to do this'));
}
$list->setName($list_name);
@@ -267,7 +267,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => true
, 'message' => _('List has been updated')
, 'message' => $app->trans('List has been updated')
];
} catch (ControllerException $e) {
$datas = [
@@ -289,7 +289,7 @@ class UsrLists implements ControllerProviderInterface
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
throw new ControllerException(_('You are not authorized to do this'));
throw new ControllerException($app->trans('You are not authorized to do this'));
}
$app['EM']->remove($list);
@@ -297,7 +297,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => true
, 'message' => sprintf(_('List has been deleted'))
, 'message' => $app->trans('List has been deleted')
];
} catch (ControllerException $e) {
$datas = [
@@ -308,7 +308,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => false
, 'message' => sprintf(_('Unable to delete list'))
, 'message' => $app->trans('Unable to delete list')
];
}
@@ -324,7 +324,7 @@ class UsrLists implements ControllerProviderInterface
/* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
throw new ControllerException(_('You are not authorized to do this'));
throw new ControllerException($app->trans('You are not authorized to do this'));
}
$entry_repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrListEntry');
@@ -336,7 +336,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => true
, 'message' => _('Entry removed from list')
, 'message' => $app->trans('Entry removed from list')
];
} catch (ControllerException $e) {
$datas = [
@@ -344,10 +344,9 @@ class UsrLists implements ControllerProviderInterface
, 'message' => $e->getMessage()
];
} catch (\Exception $e) {
$datas = [
'success' => false
, 'message' => _('Unable to remove entry from list ' . $e->getMessage())
'success' => false,
'message' => $app->trans('Unable to remove entry from list'),
];
}
@@ -367,7 +366,7 @@ class UsrLists implements ControllerProviderInterface
/* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
throw new ControllerException(_('You are not authorized to do this'));
throw new ControllerException($app->trans('You are not authorized to do this'));
}
$inserted_usr_ids = [];
@@ -394,13 +393,13 @@ class UsrLists implements ControllerProviderInterface
if (count($inserted_usr_ids) > 1) {
$datas = [
'success' => true
, 'message' => sprintf(_('%d Users added to list'), count($inserted_usr_ids))
, 'message' => $app->trans('%quantity% Users added to list', array('%quantity%' => count($inserted_usr_ids)))
, 'result' => $inserted_usr_ids
];
} else {
$datas = [
'success' => true
, 'message' => sprintf(_('%d User added to list'), count($inserted_usr_ids))
, 'message' => $app->trans('%quantity% User added to list', array('%quantity%' => count($inserted_usr_ids)))
, 'result' => $inserted_usr_ids
];
}
@@ -413,7 +412,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => false
, 'message' => _('Unable to add usr to list')
, 'message' => $app->trans('Unable to add usr to list')
];
}
@@ -432,7 +431,7 @@ class UsrLists implements ControllerProviderInterface
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
$list = null;
throw new \Exception(_('You are not authorized to do this'));
throw new \Exception($app->trans('You are not authorized to do this'));
}
} catch (\Exception $e) {
@@ -461,7 +460,7 @@ class UsrLists implements ControllerProviderInterface
/* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
throw new ControllerException(_('You are not authorized to do this'));
throw new ControllerException($app->trans('You are not authorized to do this'));
}
$new_owner = \User_Adapter::getInstance($usr_id, $app);
@@ -490,7 +489,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => true
, 'message' => _('List shared to user')
, 'message' => $app->trans('List shared to user')
];
} catch (ControllerException $e) {
$datas = [
@@ -501,7 +500,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => false
, 'message' => _('Unable to share the list with the usr')
, 'message' => $app->trans('Unable to share the list with the usr')
];
}
@@ -517,7 +516,7 @@ class UsrLists implements ControllerProviderInterface
/* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
throw new \Exception(_('You are not authorized to do this'));
throw new \Exception($app->trans('You are not authorized to do this'));
}
$owners_repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrListOwner');
@@ -529,7 +528,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [
'success' => true
, 'message' => _('Owner removed from list')
, 'message' => $app->trans('Owner removed from list')
];
} catch (ControllerException $e) {
$datas = [
@@ -539,7 +538,7 @@ class UsrLists implements ControllerProviderInterface
} catch (\Exception $e) {
$datas = [
'success' => false
, 'message' => _('Unable to remove usr from list')
, 'message' => $app->trans('Unable to remove usr from list')
];
}

View File

@@ -158,29 +158,15 @@ class WorkZone implements ControllerProviderInterface
if ($alreadyFixed === 0) {
if ($done <= 1) {
$message = sprintf(
_('%d Story attached to the WorkZone')
, $done
);
$message = $app->trans('%quantity% Story attached to the WorkZone', array('%quantity%' => $done));
} else {
$message = sprintf(
_('%d Stories attached to the WorkZone')
, $done
);
$message = $app->trans('%quantity% Stories attached to the WorkZone', array('%quantity%' => $done));
}
} else {
if ($done <= 1) {
$message = sprintf(
_('%1$d Story attached to the WorkZone, %2$d already attached')
, $done
, $alreadyFixed
);
$message = $app->trans('%quantity% Story attached to the WorkZone, %quantity_already% already attached', array('%quantity%' => $done, '%quantity_already%' => $alreadyFixed));
} else {
$message = sprintf(
_('%1$d Stories attached to the WorkZone, %2$d already attached')
, $done
, $alreadyFixed
);
$message = $app->trans('%quantity% Stories attached to the WorkZone, %quantity_already% already attached', array('%quantity%' => $done, '%quantity_already%' => $alreadyFixed));
}
}
@@ -200,7 +186,6 @@ class WorkZone implements ControllerProviderInterface
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\StoryWZ');
/* @var $repository Alchemy\Phrasea\Model\Repositories\StoryWZRepository */
$StoryWZ = $repository->findUserStory($app, $app['authentication']->getUser(), $Story);
if (!$StoryWZ) {
@@ -213,7 +198,7 @@ class WorkZone implements ControllerProviderInterface
if ($request->getRequestFormat() == 'json') {
return $app->json([
'success' => true
, 'message' => _('Story detached from the WorkZone')
, 'message' => $app->trans('Story detached from the WorkZone')
]);
}

View File

@@ -134,11 +134,11 @@ class Activity implements ControllerProviderInterface
public function doReportDownloadsByUsers(Application $app, Request $request)
{
$conf = [
'user' => [_('report:: utilisateur'), 0, 1, 0, 0],
'nbdoc' => [_('report:: nombre de documents'), 0, 0, 0, 0],
'poiddoc' => [_('report:: poids des documents'), 0, 0, 0, 0],
'nbprev' => [_('report:: nombre de preview'), 0, 0, 0, 0],
'poidprev' => [_('report:: poids des previews'), 0, 0, 0, 0]
'user' => [$app->trans('report:: utilisateur'), 0, 1, 0, 0],
'nbdoc' => [$app->trans('report:: nombre de documents'), 0, 0, 0, 0],
'poiddoc' => [$app->trans('report:: poids des documents'), 0, 0, 0, 0],
'nbprev' => [$app->trans('report:: nombre de preview'), 0, 0, 0, 0],
'poidprev' => [$app->trans('report:: poids des previews'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
@@ -198,9 +198,9 @@ class Activity implements ControllerProviderInterface
public function doReportBestOfQuestions(Application $app, Request $request)
{
$conf = [
'search' => [_('report:: question'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [_('report:: nombre de reponses'), 0, 0, 0, 0]
'search' => [$app->trans('report:: question'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [$app->trans('report:: nombre de reponses'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
@@ -256,9 +256,9 @@ class Activity implements ControllerProviderInterface
public function doReportNoBestOfQuestions(Application $app, Request $request)
{
$conf = [
'search' => [_('report:: question'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [_('report:: nombre de reponses'), 0, 0, 0, 0]
'search' => [$app->trans('report:: question'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [$app->trans('report:: nombre de reponses'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
@@ -369,10 +369,10 @@ class Activity implements ControllerProviderInterface
public function doReportSiteActiviyPerDays(Application $app, Request $request)
{
$conf = [
'ddate' => [_('report:: jour'), 0, 0, 0, 0],
'total' => [_('report:: total des telechargements'), 0, 0, 0, 0],
'preview' => [_('report:: preview'), 0, 0, 0, 0],
'document' => [_('report:: document original'), 0, 0, 0, 0]
'ddate' => [$app->trans('report:: jour'), 0, 0, 0, 0],
'total' => [$app->trans('report:: total des telechargements'), 0, 0, 0, 0],
'preview' => [$app->trans('report:: preview'), 0, 0, 0, 0],
'document' => [$app->trans('report:: document original'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
@@ -700,7 +700,7 @@ class Activity implements ControllerProviderInterface
'record_id' => ['', 1, 1, 1, 1],
'file' => ['', 1, 0, 1, 1],
'mime' => ['', 1, 0, 1, 1],
'comment' => [_('Receiver'), 1, 0, 1, 1],
'comment' => [$app->trans('Receiver'), 1, 0, 1, 1],
];
$activity = new \module_report_sent(
@@ -792,7 +792,7 @@ class Activity implements ControllerProviderInterface
if ($request->request->get('conf') == 'on') {
return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [
'conf' => $base_conf
]), "title" => _("configuration")]);
]), "title" => $app->trans("configuration")]);
}
//set order
@@ -819,7 +819,7 @@ class Activity implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field),
'field' => $field
]), "title" => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]);
]), "title" => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]);
}
if ($field === $value) {
@@ -864,7 +864,7 @@ class Activity implements ControllerProviderInterface
'is_doc' => false
]),
'display_nav' => false,
'title' => _(sprintf('Groupement des resultats sur le champ %s', $groupField))
'title' => $app->trans('Groupement des resultats sur le champ %name%', array('%name%' => $groupField))
]);
}

View File

@@ -52,34 +52,34 @@ class Informations implements ControllerProviderInterface
{
$conf = [
'config' => [
'photo' => [_('report:: document'), 0, 0, 0, 0],
'record_id' => [_('report:: record id'), 0, 0, 0, 0],
'date' => [_('report:: date'), 0, 0, 0, 0],
'type' => [_('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [_('report:: titre'), 0, 0, 0, 0],
'taille' => [_('report:: poids'), 0, 0, 0, 0]
'photo' => [$app->trans('report:: document'), 0, 0, 0, 0],
'record_id' => [$app->trans('report:: record id'), 0, 0, 0, 0],
'date' => [$app->trans('report:: date'), 0, 0, 0, 0],
'type' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [$app->trans('report:: titre'), 0, 0, 0, 0],
'taille' => [$app->trans('report:: poids'), 0, 0, 0, 0]
],
'conf' => [
'identifiant' => [_('report:: identifiant'), 0, 0, 0, 0],
'nom' => [_('report:: nom'), 0, 0, 0, 0],
'mail' => [_('report:: email'), 0, 0, 0, 0],
'adresse' => [_('report:: adresse'), 0, 0, 0, 0],
'tel' => [_('report:: telephone'), 0, 0, 0, 0]
'identifiant' => [$app->trans('report:: identifiant'), 0, 0, 0, 0],
'nom' => [$app->trans('report:: nom'), 0, 0, 0, 0],
'mail' => [$app->trans('report:: email'), 0, 0, 0, 0],
'adresse' => [$app->trans('report:: adresse'), 0, 0, 0, 0],
'tel' => [$app->trans('report:: telephone'), 0, 0, 0, 0]
],
'config_cnx' => [
'ddate' => [_('report:: date'), 0, 0, 0, 0],
'appli' => [_('report:: modules'), 0, 0, 0, 0],
'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0],
'appli' => [$app->trans('report:: modules'), 0, 0, 0, 0],
],
'config_dl' => [
'ddate' => [_('report:: date'), 0, 0, 0, 0],
'record_id' => [_('report:: record id'), 0, 1, 0, 0],
'final' => [_('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [_('report:: collections'), 0, 0, 0, 0],
'comment' => [_('report:: commentaire'), 0, 0, 0, 0],
'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0],
'record_id' => [$app->trans('report:: record id'), 0, 1, 0, 0],
'final' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [$app->trans('report:: collections'), 0, 0, 0, 0],
'comment' => [$app->trans('report:: commentaire'), 0, 0, 0, 0],
],
'config_ask' => [
'search' => [_('report:: question'), 0, 0, 0, 0],
'ddate' => [_('report:: date'), 0, 0, 0, 0]
'search' => [$app->trans('report:: question'), 0, 0, 0, 0],
'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0]
]
];
@@ -96,7 +96,7 @@ class Informations implements ControllerProviderInterface
if ('' !== $on && $app['phraseanet.registry']->get('GV_anonymousReport') == true) {
$conf['conf'] = [
$on => [$on, 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0]
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0]
];
}
@@ -109,7 +109,7 @@ class Informations implements ControllerProviderInterface
$request->request->get('collection'
));
$conf_array = $conf['config_cnx'];
$title = _('report:: historique des connexions');
$title = $app->trans('report:: historique des connexions');
} elseif ($from == 'USR' || $from == 'GEN') {
$report = new \module_report_download(
$app,
@@ -119,7 +119,7 @@ class Informations implements ControllerProviderInterface
$request->request->get('collection')
);
$conf_array = $conf['config_dl'];
$title = _('report:: historique des telechargements');
$title = $app->trans('report:: historique des telechargements');
} elseif ($from == 'ASK') {
$report = new \module_report_question(
$app,
@@ -129,7 +129,7 @@ class Informations implements ControllerProviderInterface
$request->request->get('collection')
);
$conf_array = $conf['config_ask'];
$title = _('report:: historique des questions');
$title = $app->trans('report:: historique des questions');
}
if ($report) {
@@ -151,7 +151,7 @@ class Informations implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field),
'field' => $field
]), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]);
]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]);
}
if ($field === $value) {
@@ -252,8 +252,8 @@ class Informations implements ControllerProviderInterface
public function doReportinformationsBrowser(Application $app, Request $request)
{
$conf = [
'version' => [_('report::version '), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0]
'version' => [$app->trans('report::version'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0]
];
$info = new \module_report_nav(
@@ -297,24 +297,24 @@ class Informations implements ControllerProviderInterface
public function doReportInformationsDocument(Application $app, Request $request)
{
$config = [
'photo' => [_('report:: document'), 0, 0, 0, 0],
'record_id' => [_('report:: record id'), 0, 0, 0, 0],
'date' => [_('report:: date'), 0, 0, 0, 0],
'type' => [_('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [_('report:: titre'), 0, 0, 0, 0],
'taille' => [_('report:: poids'), 0, 0, 0, 0]
'photo' => [$app->trans('report:: document'), 0, 0, 0, 0],
'record_id' => [$app->trans('report:: record id'), 0, 0, 0, 0],
'date' => [$app->trans('report:: date'), 0, 0, 0, 0],
'type' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [$app->trans('report:: titre'), 0, 0, 0, 0],
'taille' => [$app->trans('report:: poids'), 0, 0, 0, 0]
];
$config_dl = [
'ddate' => [_('report:: date'), 0, 0, 0, 0],
'user' => [_('report:: utilisateurs'), 0, 0, 0, 0],
'final' => [_('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [_('report:: collections'), 0, 0, 0, 0],
'comment' => [_('report:: commentaire'), 0, 0, 0, 0],
'fonction' => [_('report:: fonction'), 0, 0, 0, 0],
'activite' => [_('report:: activite'), 0, 0, 0, 0],
'pays' => [_('report:: pays'), 0, 0, 0, 0],
'societe' => [_('report:: societe'), 0, 0, 0, 0]
'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0],
'user' => [$app->trans('report:: utilisateurs'), 0, 0, 0, 0],
'final' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [$app->trans('report:: collections'), 0, 0, 0, 0],
'comment' => [$app->trans('report:: commentaire'), 0, 0, 0, 0],
'fonction' => [$app->trans('report:: fonction'), 0, 0, 0, 0],
'activite' => [$app->trans('report:: activite'), 0, 0, 0, 0],
'pays' => [$app->trans('report:: pays'), 0, 0, 0, 0],
'societe' => [$app->trans('report:: societe'), 0, 0, 0, 0]
];
//format conf according user preferences
@@ -409,7 +409,7 @@ class Informations implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $download->colFilter($field),
'field' => $field
]), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]);
]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]);
}
if ($field === $value) {
@@ -423,7 +423,7 @@ class Informations implements ControllerProviderInterface
$download->setFilter($filter->getTabFilter());
$download->setOrder('ddate', 'DESC');
$download->setTitle(_('report:: historique des telechargements'));
$download->setTitle($app->trans('report:: historique des telechargements'));
$download->setConfig(false);
$reportArray = $download->buildReport($config_dl);
@@ -458,11 +458,11 @@ class Informations implements ControllerProviderInterface
if ($app['phraseanet.registry']->get('GV_anonymousReport') == false && $from !== 'DOC' && $from !== 'DASH' && $from !== 'GEN' && $from !== 'PUSHDOC') {
$conf = [
'identifiant' => [_('report:: identifiant'), 0, 0, 0, 0],
'nom' => [_('report:: nom'), 0, 0, 0, 0],
'mail' => [_('report:: email'), 0, 0, 0, 0],
'adresse' => [_('report:: adresse'), 0, 0, 0, 0],
'tel' => [_('report:: telephone'), 0, 0, 0, 0]
'identifiant' => [$app->trans('report:: identifiant'), 0, 0, 0, 0],
'nom' => [$app->trans('report:: nom'), 0, 0, 0, 0],
'mail' => [$app->trans('report:: email'), 0, 0, 0, 0],
'adresse' => [$app->trans('report:: adresse'), 0, 0, 0, 0],
'tel' => [$app->trans('report:: telephone'), 0, 0, 0, 0]
];
$info = new \module_report_nav(
@@ -475,11 +475,11 @@ class Informations implements ControllerProviderInterface
$info->setPeriode('');
$info->setConfig(false);
$info->setTitle(_('report:: utilisateur'));
$info->setTitle($app->trans('report:: utilisateur'));
$reportArray = $info->buildTabGrpInfo(false, [], $request->request->get('user'), $conf, false);
if ($request->request->get('printcsv') == 'on') {
if ($request->request->get('printcsv') == 'on' && isset($download)) {
$download->setPrettyString(false);
try {

View File

@@ -169,14 +169,14 @@ class Root implements ControllerProviderInterface
);
$conf = [
'user' => [_('phraseanet::utilisateurs'), 1, 1, 1, 1],
'ddate' => [_('report:: date'), 1, 0, 1, 1],
'ip' => [_('report:: IP'), 1, 0, 0, 0],
'appli' => [_('report:: modules'), 1, 0, 0, 0],
'fonction' => [_('report::fonction'), 1, 1, 1, 1],
'activite' => [_('report::activite'), 1, 1, 1, 1],
'pays' => [_('report::pays'), 1, 1, 1, 1],
'societe' => [_('report::societe'), 1, 1, 1, 1]
'user' => [$app->trans('phraseanet::utilisateurs'), 1, 1, 1, 1],
'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1],
'ip' => [$app->trans('report:: IP'), 1, 0, 0, 0],
'appli' => [$app->trans('report:: modules'), 1, 0, 0, 0],
'fonction' => [$app->trans('report::fonction'), 1, 1, 1, 1],
'activite' => [$app->trans('report::activite'), 1, 1, 1, 1],
'pays' => [$app->trans('report::pays'), 1, 1, 1, 1],
'societe' => [$app->trans('report::societe'), 1, 1, 1, 1]
];
if ($request->request->get('printcsv') == 'on') {
@@ -235,13 +235,13 @@ class Root implements ControllerProviderInterface
);
$conf = [
'user' => [_('report:: utilisateur'), 1, 1, 1, 1],
'search' => [_('report:: question'), 1, 0, 1, 1],
'ddate' => [_('report:: date'), 1, 0, 1, 1],
'fonction' => [_('report:: fonction'), 1, 1, 1, 1],
'activite' => [_('report:: activite'), 1, 1, 1, 1],
'pays' => [_('report:: pays'), 1, 1, 1, 1],
'societe' => [_('report:: societe'), 1, 1, 1, 1]
'user' => [$app->trans('report:: utilisateur'), 1, 1, 1, 1],
'search' => [$app->trans('report:: question'), 1, 0, 1, 1],
'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1],
'fonction' => [$app->trans('report:: fonction'), 1, 1, 1, 1],
'activite' => [$app->trans('report:: activite'), 1, 1, 1, 1],
'pays' => [$app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [$app->trans('report:: societe'), 1, 1, 1, 1]
];
if ($request->request->get('printcsv') == 'on') {
@@ -306,16 +306,16 @@ class Root implements ControllerProviderInterface
}
$conf = array_merge([
'user' => [_('report:: utilisateurs'), 1, 1, 1, 1],
'ddate' => [_('report:: date'), 1, 0, 1, 1],
'record_id' => [_('report:: record id'), 1, 1, 1, 1],
'final' => [_('phrseanet:: sous definition'), 1, 0, 1, 1],
'coll_id' => [_('report:: collections'), 1, 0, 1, 1],
'comment' => [_('report:: commentaire'), 1, 0, 0, 0],
'fonction' => [_('report:: fonction'), 1, 1, 1, 1],
'activite' => [_('report:: activite'), 1, 1, 1, 1],
'pays' => [_('report:: pays'), 1, 1, 1, 1],
'societe' => [_('report:: societe'), 1, 1, 1, 1]
'user' => [$app->trans('report:: utilisateurs'), 1, 1, 1, 1],
'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1],
'record_id' => [$app->trans('report:: record id'), 1, 1, 1, 1],
'final' => [$app->trans('phrseanet:: sous definition'), 1, 0, 1, 1],
'coll_id' => [$app->trans('report:: collections'), 1, 0, 1, 1],
'comment' => [$app->trans('report:: commentaire'), 1, 0, 0, 0],
'fonction' => [$app->trans('report:: fonction'), 1, 1, 1, 1],
'activite' => [$app->trans('report:: activite'), 1, 1, 1, 1],
'pays' => [$app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [$app->trans('report:: societe'), 1, 1, 1, 1]
], $conf_pref);
if ($request->request->get('printcsv') == 'on') {
@@ -380,12 +380,12 @@ class Root implements ControllerProviderInterface
}
$conf = array_merge([
'telechargement' => [_('report:: telechargements'), 1, 0, 0, 0],
'record_id' => [_('report:: record id'), 1, 1, 1, 0],
'final' => [_('phraseanet:: sous definition'), 1, 0, 1, 1],
'file' => [_('report:: fichier'), 1, 0, 0, 1],
'mime' => [_('report:: type'), 1, 0, 1, 1],
'size' => [_('report:: taille'), 1, 0, 1, 1]
'telechargement' => [$app->trans('report:: telechargements'), 1, 0, 0, 0],
'record_id' => [$app->trans('report:: record id'), 1, 1, 1, 0],
'final' => [$app->trans('phraseanet:: sous definition'), 1, 0, 1, 1],
'file' => [$app->trans('report:: fichier'), 1, 0, 0, 1],
'mime' => [$app->trans('report:: type'), 1, 0, 1, 1],
'size' => [$app->trans('report:: taille'), 1, 0, 1, 1]
], $conf_pref);
if ($request->request->get('printcsv') == 'on') {
@@ -444,30 +444,30 @@ class Root implements ControllerProviderInterface
);
$conf_nav = [
'nav' => [_('report:: navigateur'), 0, 1, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0]
'nav' => [$app->trans('report:: navigateur'), 0, 1, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_combo = [
'combo' => [_('report:: navigateurs et plateforme'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0]
'combo' => [$app->trans('report:: navigateurs et plateforme'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_os = [
'os' => [_('report:: plateforme'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0]
'os' => [$app->trans('report:: plateforme'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_res = [
'res' => [_('report:: resolution'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0]
'res' => [$app->trans('report:: resolution'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_mod = [
'appli' => [_('report:: module'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0]
'appli' => [$app->trans('report:: module'), 0, 0, 0, 0],
'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$report = [
@@ -543,7 +543,7 @@ class Root implements ControllerProviderInterface
if ($request->request->get('conf') == 'on') {
return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [
'conf' => $base_conf
]), 'title' => _('configuration')]);
]), 'title' => $app->trans('configuration')]);
}
//set order
@@ -570,7 +570,7 @@ class Root implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field),
'field' => $field
]), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]);
]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]);
}
if ($field === $value) {
@@ -615,7 +615,7 @@ class Root implements ControllerProviderInterface
'is_doc' => false
]),
'display_nav' => false,
'title' => _(sprintf('Groupement des resultats sur le champ %s', $groupField))
'title' => $app->trans('Groupement des resultats sur le champ %name%', array('%name%' => $groupField))
]);
}

View File

@@ -97,11 +97,11 @@ class Account implements ControllerProviderInterface
if ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) {
$user->set_password($data['password']);
$app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes'));
$app->addFlash('success', $app->trans('login::notification: Mise a jour du mot de passe avec succes'));
return $app->redirectPath('account');
} else {
$app->addFlash('error', _('Invalid password provided'));
$app->addFlash('error', $app->trans('Invalid password provided'));
}
}
}
@@ -123,25 +123,25 @@ class Account implements ControllerProviderInterface
{
if (null === ($password = $request->request->get('form_password')) || null === ($email = $request->request->get('form_email')) || null === ($emailConfirm = $request->request->get('form_email_confirm'))) {
$app->abort(400, _('Could not perform request, please contact an administrator.'));
$app->abort(400, $app->trans('Could not perform request, please contact an administrator.'));
}
$user = $app['authentication']->getUser();
if (!$app['auth.password-encoder']->isPasswordValid($user->get_password(), $password, $user->get_nonce())) {
$app->addFlash('error', _('admin::compte-utilisateur:ftp: Le mot de passe est errone'));
$app->addFlash('error', $app->trans('admin::compte-utilisateur:ftp: Le mot de passe est errone'));
return $app->redirectPath('account_reset_email');
}
if (!\Swift_Validate::email($email)) {
$app->addFlash('error', _('forms::l\'email semble invalide'));
$app->addFlash('error', $app->trans('forms::l\'email semble invalide'));
return $app->redirectPath('account_reset_email');
}
if ($email !== $emailConfirm) {
$app->addFlash('error', _('forms::les emails ne correspondent pas'));
$app->addFlash('error', $app->trans('forms::les emails ne correspondent pas'));
return $app->redirectPath('account_reset_email');
}
@@ -153,7 +153,7 @@ class Account implements ControllerProviderInterface
try {
$receiver = Receiver::fromUser($app['authentication']->getUser());
} catch (InvalidArgumentException $e) {
$app->addFlash('error', _('phraseanet::erreur: echec du serveur de mail'));
$app->addFlash('error', $app->trans('phraseanet::erreur: echec du serveur de mail'));
return $app->redirectPath('account_reset_email');
}
@@ -164,7 +164,7 @@ class Account implements ControllerProviderInterface
$app['notification.deliverer']->deliver($mail);
$app->addFlash('info', _('admin::compte-utilisateur un email de confirmation vient de vous etre envoye. Veuillez suivre les instructions contenue pour continuer'));
$app->addFlash('info', $app->trans('admin::compte-utilisateur un email de confirmation vient de vous etre envoye. Veuillez suivre les instructions contenue pour continuer'));
return $app->redirectPath('account');
}
@@ -185,11 +185,11 @@ class Account implements ControllerProviderInterface
$user->set_email($datas['datas']);
$app['tokens']->removeToken($token);
$app->addFlash('success', _('admin::compte-utilisateur: L\'email a correctement ete mis a jour'));
$app->addFlash('success', $app->trans('admin::compte-utilisateur: L\'email a correctement ete mis a jour'));
return $app->redirectPath('account');
} catch (\Exception $e) {
$app->addFlash('error', _('admin::compte-utilisateur: erreur lors de la mise a jour'));
$app->addFlash('error', $app->trans('admin::compte-utilisateur: erreur lors de la mise a jour'));
return $app->redirectPath('account');
}
@@ -210,7 +210,7 @@ class Account implements ControllerProviderInterface
public function grantAccess(Application $app, Request $request, $application_id)
{
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, $app->trans('Bad request format, only JSON is allowed'));
}
$error = false;
@@ -344,7 +344,7 @@ class Account implements ControllerProviderInterface
foreach ($demands as $baseId) {
try {
$register->add_request($app['authentication']->getUser(), \collection::get_from_base_id($app, $baseId));
$app->addFlash('success', _('login::notification: Vos demandes ont ete prises en compte'));
$app->addFlash('success', $app->trans('login::notification: Vos demandes ont ete prises en compte'));
} catch (\Exception $e) {
}
@@ -403,9 +403,9 @@ class Account implements ControllerProviderInterface
$app['phraseanet.appbox']->get_connection()->commit();
$app['EM']->persist($ftpCredential);
$app['EM']->flush();
$app->addFlash('success', _('login::notification: Changements enregistres'));
$app->addFlash('success', $app->trans('login::notification: Changements enregistres'));
} catch (\Exception $e) {
$app->addFlash('error', _('forms::erreurs lors de l\'enregistrement des modifications'));
$app->addFlash('error', $app->trans('forms::erreurs lors de l\'enregistrement des modifications'));
$app['phraseanet.appbox']->get_connection()->rollBack();
}
}

View File

@@ -73,7 +73,7 @@ class Developers implements ControllerProviderInterface
public function deleteApp(Application $app, Request $request, $id)
{
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, 'Bad request format, only JSON is allowed');
}
$error = false;
@@ -99,7 +99,7 @@ class Developers implements ControllerProviderInterface
public function renewAppCallback(Application $app, Request $request, $id)
{
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, 'Bad request format, only JSON is allowed');
}
$error = false;
@@ -130,7 +130,7 @@ class Developers implements ControllerProviderInterface
public function renewAccessToken(Application $app, Request $request, $id)
{
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, 'Bad request format, only JSON is allowed');
}
$error = false;
@@ -167,7 +167,7 @@ class Developers implements ControllerProviderInterface
public function authorizeGrantpassword(Application $app, Request $request, $id)
{
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
$app->abort(400, 'Bad request format, only JSON is allowed');
}
$error = false;

View File

@@ -217,23 +217,23 @@ class Login implements ControllerProviderInterface
public function getLanguage(Application $app, Request $request)
{
$response = $app->json([
'validation_blank' => _('Please provide a value.'),
'validation_choice_min' => _('Please select at least %s choice.'),
'validation_email' => _('Please provide a valid email address.'),
'validation_ip' => _('Please provide a valid IP address.'),
'validation_length_min' => _('Please provide a longer value. It should have %s character or more.'),
'password_match' => _('Please provide the same passwords.'),
'email_match' => _('Please provide the same emails.'),
'accept_tou' => _('Please accept the terms of use to register.'),
'no_collection_selected' => _('No collection selected'),
'one_collection_selected' => _('%d collection selected'),
'collections_selected' => _('%d collections selected'),
'all_collections' => _('Select all collections'),
'validation_blank' => $app->trans('Please provide a value.'),
'validation_choice_min' => $app->trans('Please select at least %s choice.'),
'validation_email' => $app->trans('Please provide a valid email address.'),
'validation_ip' => $app->trans('Please provide a valid IP address.'),
'validation_length_min' => $app->trans('Please provide a longer value. It should have %s character or more.'),
'password_match' => $app->trans('Please provide the same passwords.'),
'email_match' => $app->trans('Please provide the same emails.'),
'accept_tou' => $app->trans('Please accept the terms of use to register.'),
'no_collection_selected' => $app->trans('No collection selected'),
'one_collection_selected' => $app->trans('%d collection selected'),
'collections_selected' => $app->trans('%d collections selected'),
'all_collections' => $app->trans('Select all collections'),
// password strength
'weak' => _('Weak'),
'ordinary' => _('Ordinary'),
'good' => _('Good'),
'great' => _('Great'),
'weak' => $app->trans('Weak'),
'ordinary' => $app->trans('Ordinary'),
'good' => $app->trans('Good'),
'great' => $app->trans('Great'),
]);
$response->setExpires(new \DateTime('+1 day'));
@@ -268,7 +268,7 @@ class Login implements ControllerProviderInterface
try {
$provider = $this->findProvider($app, $data['provider-id']);
} catch (NotFoundHttpException $e) {
$app->addFlash('error', _('You tried to register with an unknown provider'));
$app->addFlash('error', $app->trans('You tried to register with an unknown provider'));
return $app->redirectPath('login_register');
}
@@ -276,7 +276,7 @@ class Login implements ControllerProviderInterface
try {
$token = $provider->getToken();
} catch (NotAuthenticatedException $e) {
$app->addFlash('error', _('You tried to register with an unknown provider'));
$app->addFlash('error', $app->trans('You tried to register with an unknown provider'));
return $app->redirectPath('login_register');
}
@@ -303,7 +303,7 @@ class Login implements ControllerProviderInterface
$captcha = $app['recaptcha']->bind($request);
if ($app['phraseanet.registry']->get('GV_captchas') && !$captcha->isValid()) {
throw new FormProcessingException(_('Invalid captcha answer.'));
throw new FormProcessingException($app->trans('Invalid captcha answer.'));
}
require_once $app['root.path'] . '/lib/classes/deprecated/inscript.api.php';
@@ -408,10 +408,10 @@ class Login implements ControllerProviderInterface
try {
$this->sendAccountUnlockEmail($app, $user);
$app->addFlash('info', _('login::notification: demande de confirmation par mail envoyee'));
$app->addFlash('info', $app->trans('login::notification: demande de confirmation par mail envoyee'));
} catch (InvalidArgumentException $e) {
// todo, log this failure
$app->addFlash('error', _('Unable to send your account unlock email.'));
$app->addFlash('error', $app->trans('Unable to send your account unlock email.'));
}
return $app->redirectPath('homepage');
@@ -472,17 +472,17 @@ class Login implements ControllerProviderInterface
try {
$user = \User_Adapter::getInstance((int) $usrId, $app);
} catch (\Exception $e) {
$app->addFlash('error', _('Invalid link.'));
$app->addFlash('error', $app->trans('Invalid link.'));
return $app->redirectPath('homepage');
}
try {
$this->sendAccountUnlockEmail($app, $user);
$app->addFlash('success', _('login::notification: demande de confirmation par mail envoyee'));
$app->addFlash('success', $app->trans('login::notification: demande de confirmation par mail envoyee'));
} catch (InvalidArgumentException $e) {
// todo, log this failure
$app->addFlash('error', _('Unable to send your account unlock email.'));
$app->addFlash('error', $app->trans('Unable to send your account unlock email.'));
}
return $app->redirectPath('homepage');
@@ -521,7 +521,7 @@ class Login implements ControllerProviderInterface
public function registerConfirm(PhraseaApplication $app, Request $request)
{
if (null === $code = $request->query->get('code')) {
$app->addFlash('error', _('Invalid unlock link.'));
$app->addFlash('error', $app->trans('Invalid unlock link.'));
return $app->redirectPath('homepage');
}
@@ -529,7 +529,7 @@ class Login implements ControllerProviderInterface
try {
$datas = $app['tokens']->helloToken($code);
} catch (NotFoundHttpException $e) {
$app->addFlash('error', _('Invalid unlock link.'));
$app->addFlash('error', $app->trans('Invalid unlock link.'));
return $app->redirectPath('homepage');
}
@@ -537,13 +537,13 @@ class Login implements ControllerProviderInterface
try {
$user = \User_Adapter::getInstance((int) $datas['usr_id'], $app);
} catch (\Exception $e) {
$app->addFlash('error', _('Invalid unlock link.'));
$app->addFlash('error', $app->trans('Invalid unlock link.'));
return $app->redirectPath('homepage');
}
if (!$user->get_mail_locked()) {
$app->addFlash('info', _('Account is already unlocked, you can login.'));
$app->addFlash('info', $app->trans('Account is already unlocked, you can login.'));
return $app->redirectPath('homepage');
}
@@ -554,7 +554,7 @@ class Login implements ControllerProviderInterface
try {
$receiver = Receiver::fromUser($user);
} catch (InvalidArgumentException $e) {
$app->addFlash('success', _('Account has been unlocked, you can now login.'));
$app->addFlash('success', $app->trans('Account has been unlocked, you can now login.'));
return $app->redirectPath('homepage');
}
@@ -565,12 +565,12 @@ class Login implements ControllerProviderInterface
$mail = MailSuccessEmailConfirmationRegistered::create($app, $receiver);
$app['notification.deliverer']->deliver($mail);
$app->addFlash('success', _('Account has been unlocked, you can now login.'));
$app->addFlash('success', $app->trans('Account has been unlocked, you can now login.'));
} else {
$mail = MailSuccessEmailConfirmationUnregistered::create($app, $receiver);
$app['notification.deliverer']->deliver($mail);
$app->addFlash('info', _('Account has been unlocked, you still have to wait for admin approval.'));
$app->addFlash('info', $app->trans('Account has been unlocked, you still have to wait for admin approval.'));
}
return $app->redirectPath('homepage');
@@ -604,7 +604,7 @@ class Login implements ControllerProviderInterface
$app['tokens']->removeToken($token);
$app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes'));
$app->addFlash('success', $app->trans('login::notification: Mise a jour du mot de passe avec succes'));
return $app->redirectPath('homepage');
}
@@ -640,13 +640,13 @@ class Login implements ControllerProviderInterface
try {
$user = \User_Adapter::getInstance(\User_Adapter::get_usr_id_from_email($app, $data['email']), $app);
} catch (\Exception $e) {
throw new FormProcessingException(_('phraseanet::erreur: Le compte n\'a pas ete trouve'));
throw new FormProcessingException($app->trans('phraseanet::erreur: Le compte n\'a pas ete trouve'));
}
try {
$receiver = Receiver::fromUser($user);
} catch (InvalidArgumentException $e) {
throw new FormProcessingException(_('Invalid email address'));
throw new FormProcessingException($app->trans('Invalid email address'));
}
$token = $app['tokens']->getUrlToken(\random::TYPE_PASSWORD, $user->get_id(), new \DateTime('+1 day'));
@@ -662,7 +662,7 @@ class Login implements ControllerProviderInterface
$mail->setButtonUrl($url);
$app['notification.deliverer']->deliver($mail);
$app->addFlash('info', _('phraseanet:: Un email vient de vous etre envoye'));
$app->addFlash('info', $app->trans('phraseanet:: Un email vient de vous etre envoye'));
return $app->redirectPath('login_forgot_password');
}
@@ -710,7 +710,7 @@ class Login implements ControllerProviderInterface
$app['dispatcher']->dispatch(PhraseaEvents::LOGOUT, new LogoutEvent($app));
$app['authentication']->closeAccount();
$app->addFlash('info', _('Vous etes maintenant deconnecte. A bientot.'));
$app->addFlash('info', $app->trans('Vous etes maintenant deconnecte. A bientot.'));
$response = $app->redirectPath('homepage', [
'redirect' => $request->query->get("redirect")
@@ -737,7 +737,7 @@ class Login implements ControllerProviderInterface
try {
$app['phraseanet.appbox']->get_connection();
} catch (\Exception $e) {
$app->addFlash('error', _('login::erreur: No available connection - Please contact sys-admin'));
$app->addFlash('error', $app->trans('login::erreur: No available connection - Please contact sys-admin'));
}
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->findBy(['public' => true], ['updatedOn' => 'DESC']);
@@ -779,7 +779,7 @@ class Login implements ControllerProviderInterface
public function authenticateAsGuest(PhraseaApplication $app, Request $request)
{
if (!$app->isGuestAllowed()) {
$app->abort(403, _('Phraseanet guest-access is disabled'));
$app->abort(403, $app->trans('Phraseanet guest-access is disabled'));
}
$context = new Context(Context::CONTEXT_GUEST);
@@ -899,7 +899,7 @@ class Login implements ControllerProviderInterface
$provider->onCallback($request);
$token = $provider->getToken();
} catch (NotAuthenticatedException $e) {
$app['session']->getFlashBag()->add('error', sprintf(_('Unable to authenticate with %s'), $provider->getName()));
$app['session']->getFlashBag()->add('error', $app->trans('Unable to authenticate with %provider_name%', array('%provider_name%' => $provider->getName())));
return $app->redirectPath('homepage');
}
@@ -923,7 +923,7 @@ class Login implements ControllerProviderInterface
try {
$user = $app['authentication.suggestion-finder']->find($token);
} catch (NotAuthenticatedException $e) {
$app->addFlash('error', _('Unable to retrieve provider identity'));
$app->addFlash('error', $app->trans('Unable to retrieve provider identity'));
return $app->redirectPath('homepage');
}
@@ -962,7 +962,7 @@ class Login implements ControllerProviderInterface
return $app->redirectPath('login_register_classic', ['providerId' => $providerId]);
}
$app->addFlash('error', _('Your identity is not recognized.'));
$app->addFlash('error', $app->trans('Your identity is not recognized.'));
return $app->redirectPath('homepage');
}
@@ -994,7 +994,7 @@ class Login implements ControllerProviderInterface
$form->bind($request);
if (!$form->isValid()) {
$app->addFlash('error', _('An unexpected error occured during authentication process, please contact an admin'));
$app->addFlash('error', $app->trans('An unexpected error occured during authentication process, please contact an admin'));
throw new AuthenticationException(call_user_func($redirector));
}
@@ -1009,18 +1009,18 @@ class Login implements ControllerProviderInterface
$usr_id = $app['auth.native']->getUsrId($request->request->get('login'), $request->request->get('password'), $request);
} catch (RequireCaptchaException $e) {
$app->requireCaptcha();
$app->addFlash('warning', _('Please fill the captcha'));
$app->addFlash('warning', $app->trans('Please fill the captcha'));
throw new AuthenticationException(call_user_func($redirector, $params));
} catch (AccountLockedException $e) {
$app->addFlash('warning', _('login::erreur: Vous n\'avez pas confirme votre email'));
$app->addFlash('warning', $app->trans('login::erreur: Vous n\'avez pas confirme votre email'));
$app->addUnlockAccountData($e->getUsrId());
throw new AuthenticationException(call_user_func($redirector, $params));
}
if (null === $usr_id) {
$app['session']->getFlashBag()->set('error', _('login::erreur: Erreur d\'authentification'));
$app['session']->getFlashBag()->set('error', $app->trans('login::erreur: Erreur d\'authentification'));
throw new AuthenticationException(call_user_func($redirector, $params));
}

View File

@@ -111,7 +111,7 @@ class Session implements ControllerProviderInterface
if (in_array($app['session']->get('phraseanet.message'), ['1', null])) {
if ($app['conf']->get(['main', 'maintenance'])) {
$ret['message'] .= _('The application is going down for maintenance, please logout.');
$ret['message'] .= $app->trans('The application is going down for maintenance, please logout.');
}
if ($app['phraseanet.registry']->get('GV_message_on')) {

View File

@@ -96,7 +96,7 @@ class Setup implements ControllerProviderInterface
}
if ($request->getScheme() == 'http') {
$warnings[] = _('It is not recommended to install Phraseanet without HTTPS support');
$warnings[] = $app->trans('It is not recommended to install Phraseanet without HTTPS support');
}
return $app['twig']->render('/setup/step2.html.twig', [
@@ -131,7 +131,7 @@ class Setup implements ControllerProviderInterface
$abConn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $ab_password, $appbox_name, [], $app['debug']);
} catch (\Exception $e) {
return $app->redirectPath('install_step2', [
'error' => _('Appbox is unreachable'),
'error' => $app->trans('Appbox is unreachable'),
]);
}
@@ -141,7 +141,7 @@ class Setup implements ControllerProviderInterface
}
} catch (\Exception $e) {
return $app->redirectPath('install_step2', [
'error' => _('Databox is unreachable'),
'error' => $app->trans('Databox is unreachable'),
]);
}
@@ -180,7 +180,7 @@ class Setup implements ControllerProviderInterface
]);
} catch (\Exception $e) {
return $app->redirectPath('install_step2', [
'error' => sprintf(_('an error occured : %s'), $e->getMessage()),
'error' => $app->trans('an error occured : %message%', array('%message%' => $e->getMessage())),
]);
}
}

View File

@@ -429,13 +429,13 @@ class Thesaurus implements ControllerProviderInterface
$dom->formatOutput = true;
$root = $dom->appendChild($dom->createElementNS('www.phraseanet.com', 'phraseanet:topics'));
$root->appendChild($dom->createComment(sprintf(_('thesaurus:: fichier genere le %s'), $now)));
$root->appendChild($dom->createComment($app->trans('thesaurus:: fichier genere le %date%', array('%date%' => $now))));
$root->appendChild($dom->createElement('display'))
->appendChild($dom->createElement('defaultview'))
->appendChild($dom->createTextNode($default_display));
$this->export0Topics($xpathth->query($q)->item(0), $dom, $root, $lng, $request->get("srt"), $request->get("sth"), $request->get("sand"), $opened_display, $obr);
$this->export0Topics($app, $xpathth->query($q)->item(0), $dom, $root, $lng, $request->get("srt"), $request->get("sth"), $request->get("sand"), $opened_display, $obr);
if ($request->get("ofm") == 'toscreen') {
$lngs[$lng] = str_replace(['&', '<', '>'], ['&amp;', '&lt;', '&gt;'], $dom->saveXML());
@@ -445,9 +445,9 @@ class Thesaurus implements ControllerProviderInterface
@rename($app['root.path'] . '/config/topics/' . $fname, $app['root.path'] . '/config/topics/topics_' . $lng . '_BKP_' . $now . '.xml');
if ($dom->save($app['root.path'] . '/config/topics/' . $fname)) {
$lngs[$lng] = \p4string::MakeString(sprintf(_('thesaurus:: fichier genere : %s'), $fname));
$lngs[$lng] = \p4string::MakeString($app->trans('thesaurus:: fichier genere : %filename%', array('%filename%' => $fname)));
} else {
$lngs[$lng] = \p4string::MakeString(_('thesaurus:: erreur lors de l\'enregsitrement du fichier'));
$lngs[$lng] = \p4string::MakeString($app->trans('thesaurus:: erreur lors de l\'enregsitrement du fichier'));
}
}
}
@@ -462,13 +462,13 @@ class Thesaurus implements ControllerProviderInterface
]);
}
private function export0Topics($znode, \DOMDocument $dom, \DOMNode $root, $lng, $srt, $sth, $sand, $opened_display, $obr)
private function export0Topics(Application $app, $znode, \DOMDocument $dom, \DOMNode $root, $lng, $srt, $sth, $sand, $opened_display, $obr)
{
$topics = $root->appendChild($dom->createElement('topics'));
$this->doExportTopics($znode, $dom, $topics, '', $lng, $srt, $sth, $sand, $opened_display, $obr, 0);
$this->doExportTopics($app, $znode, $dom, $topics, '', $lng, $srt, $sth, $sand, $opened_display, $obr, 0);
}
private function doExportTopics($node, \DOMDocument $dom, \DOMNode $topics, $prevQuery, $lng, $srt, $sth, $sand, $opened_display, $obr, $depth = 0)
private function doExportTopics(Application $app, $node, \DOMDocument $dom, \DOMNode $topics, $prevQuery, $lng, $srt, $sth, $sand, $opened_display, $obr, $depth = 0)
{
$ntopics = 0;
if ($node->nodeType == XML_ELEMENT_NODE) {
@@ -506,7 +506,11 @@ class Thesaurus implements ControllerProviderInterface
}
$t_sort[$i] = $query; // tri sur w
$t_node[$i] = ['label' => $label, 'node' => $n];
$t_node[$i] = [
/** @Ignore */
'label' => $label,
'node' => $n
];
$i ++;
}
@@ -531,14 +535,14 @@ class Thesaurus implements ControllerProviderInterface
}
if ($sand && $prevQuery != '') {
$query = $prevQuery . ' ' . _('phraseanet::technique:: et') . ' ' . $query . '';
$query = $prevQuery . ' ' . $app->trans('phraseanet::technique:: et') . ' ' . $query . '';
}
$topic->appendChild($dom->createElement('query'))->appendChild($dom->createTextNode('' . $query . ''));
$topics2 = $dom->createElement('topics');
if ($this->doExportTopics($t_node[$i]['node'], $dom, $topics2, $query, $lng, $srt, $sth, $sand, $opened_display, $obr, $depth + 1) > 0) {
if ($this->doExportTopics($app, $t_node[$i]['node'], $dom, $topics2, $query, $lng, $srt, $sth, $sand, $opened_display, $obr, $depth + 1) > 0) {
$topic->appendChild($topics2);
}
}
@@ -604,20 +608,20 @@ class Thesaurus implements ControllerProviderInterface
$line = substr($line, 1);
}
if ($depth > $curdepth + 1) {
$err = sprintf(_("over-indent at line %s"), $iline);
$err = $app->trans("over-indent at line %line%", array('%line%' => $iline));
continue;
}
$line = trim($line);
if ( ! $this->checkEncoding($line, 'UTF-8')) {
$err = sprintf(_("bad encoding at line %s"), $iline);
$err = $app->trans("bad encoding at line %line%", array('%line%' => $iline));
continue;
}
$line = str_replace($cbad, $cok, ($oldline = $line));
if ($line != $oldline) {
$err = sprintf(_("bad character at line %s"), $iline);
$err = $app->trans("bad character at line %line%", array('%line%' => $iline));
continue;
}
@@ -1751,7 +1755,7 @@ class Thesaurus implements ControllerProviderInterface
$domct->documentElement->setAttribute("nextid", (int) ($id) + 1);
$del = $domct->documentElement->appendChild($domct->createElement("te"));
$del->setAttribute("id", "C" . $id);
$del->setAttribute("field", _('thesaurus:: corbeille'));
$del->setAttribute("field", $app->trans('thesaurus:: corbeille'));
$del->setAttribute("nextid", "0");
$del->setAttribute("delbranch", "1");
@@ -1881,7 +1885,7 @@ class Thesaurus implements ControllerProviderInterface
$domct->documentElement->setAttribute("nextid", (int) ($id) + 1);
$ct = $domct->documentElement->appendChild($domct->createElement("te"));
$ct->setAttribute("id", "C" . $id);
$ct->setAttribute("field", _('thesaurus:: corbeille'));
$ct->setAttribute("field", $app->trans('thesaurus:: corbeille'));
$ct->setAttribute("nextid", "0");
$ct->setAttribute("delbranch", "1");
@@ -2978,7 +2982,7 @@ class Thesaurus implements ControllerProviderInterface
}
// on considere que la source 'deleted' est toujours valide
$fields["[deleted]"] = [
"name" => _('thesaurus:: corbeille'),
"name" => $app->trans('thesaurus:: corbeille'),
"tbranch" => null,
"cid" => null,
"sourceok" => true

View File

@@ -486,7 +486,7 @@ class Xmlhttp implements ControllerProviderInterface
<h1 style="position:relative; top:0px; left:0px; width:100%; height:auto;">
<a class="triangle" href="#"><span class='triRight'>&#x25BA;</span><span class='triDown'>&#x25BC;</span></a>
<a class="title" href="#"><?php echo $row['title'] ?></a>
<a class="delete" style="position:absolute;right:0px;" href="#"><?php echo _('boutton::supprimer') ?></a>
<a class="delete" style="position:absolute;right:0px;" href="#"><?php echo $app->trans('boutton::supprimer') ?></a>
</h1>
<div>
<?php echo $desc ?>
@@ -963,6 +963,7 @@ class Xmlhttp implements ControllerProviderInterface
}
}
$tts[$key0 . '_' . $uniq] = [
/** @Ignore */
'label' => $label,
'nts' => $nts0,
'n' => $n
@@ -1507,10 +1508,10 @@ class Xmlhttp implements ControllerProviderInterface
$databox->saveCterms($sbas['domct']);
}
}
$ret['msg'] = sprintf(_('prod::thesaurusTab:dlg:%d record(s) updated'), $ret['nRecsUpdated']);
$ret['msg'] = $app->trans('prod::thesaurusTab:dlg:%number% record(s) updated', array('%number%' => $ret['nRecsUpdated']));
} else {
// too many records to update
$ret['msg'] = sprintf(_('prod::thesaurusTab:dlg:too many (%1$d) records to update (limit=%2$d)'), $ret['nRecsToUpdate'], self::SEARCH_REPLACE_MAXREC);
$ret['msg'] = $app->trans('prod::thesaurusTab:dlg:too many (%number%) records to update (limit=%maximum%)', array('%number%' => $ret['nRecsToUpdate'], '%maximum%' => self::SEARCH_REPLACE_MAXREC));
}
return $app->json($ret);
@@ -1659,7 +1660,12 @@ class Xmlhttp implements ControllerProviderInterface
if (!isset($tts[$key0 . '_' . $uniq]))
break;
}
$tts[$key0 . '_' . $uniq] = ['label' => $label, 'nts' => $nts0, 'n' => $n];
$tts[$key0 . '_' . $uniq] = [
/** @Ignore */
'label' => $label,
'nts' => $nts0,
'n' => $n
];
$ntsopened++;
}
$nts++;

View File

@@ -57,12 +57,12 @@ class Preferences implements ControllerProviderInterface
$prop = $request->request->get('prop');
$value = $request->request->get('value');
$success = false;
$msg = _('Error while saving preference');
$msg = $app->trans('Error while saving preference');
if ($prop && $value) {
$app['session']->set('phraseanet.' . $prop, $value);
$success = true;
$msg = _('Preference saved !');
$msg = $app->trans('Preference saved !');
}
return new JsonResponse(['success' => $success, 'message' => $msg]);
@@ -81,7 +81,7 @@ class Preferences implements ControllerProviderInterface
$app->abort(400);
}
$msg = _('Error while saving preference');
$msg = $app->trans('Error while saving preference');
$prop = $request->request->get('prop');
$value = $request->request->get('value');
@@ -89,7 +89,7 @@ class Preferences implements ControllerProviderInterface
if (null !== $prop && null !== $value) {
$app['authentication']->getUser()->setPrefs($prop, $value);
$success = true;
$msg = _('Preference saved !');
$msg = $app->trans('Preference saved !');
}
return new JsonResponse(['success' => $success, 'message' => $msg]);

View File

@@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Core\CLIProvider;
use Alchemy\TaskManager\TaskManager;
use Alchemy\Phrasea\TaskManager\TaskList;
use Monolog\Logger;
use Monolog\Handler\NullHandler;
use Silex\Application;
use Silex\ServiceProviderInterface;
@@ -24,7 +23,7 @@ class TaskManagerServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['task-manager.logger'] = $app->share(function (Application $app) {
$logger = new Logger('task-manager logger');
$logger = new $app['monolog.logger.class']('task-manager logger');
$logger->pushHandler(new NullHandler());
return $logger;

View File

@@ -17,14 +17,17 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\Translation\TranslatorInterface;
class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface
{
private $handler;
private $translator;
public function __construct(ExceptionHandler $handler)
public function __construct(ExceptionHandler $handler, TranslatorInterface $translator)
{
$this->handler = $handler;
$this->translator = $translator;
}
public static function getSubscribedEvents()
@@ -45,7 +48,7 @@ class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface
$e = $event->getException();
$code = 500;
$msg = _('Whoops, looks like something went wrong.');
$msg = $this->translator->trans('Whoops, looks like something went wrong.');
$headers = [];
if ($e instanceof HttpExceptionInterface) {

View File

@@ -15,9 +15,17 @@ use Symfony\Component\Debug\ExceptionHandler as SymfonyExceptionHandler;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
class PhraseaExceptionHandler extends SymfonyExceptionHandler
{
private $translator;
public function setTranslator(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function createResponseBasedOnRequest(Request $request, $exception)
{
return parent::createResponse($exception);
@@ -27,23 +35,43 @@ class PhraseaExceptionHandler extends SymfonyExceptionHandler
{
switch (true) {
case 404 === $exception->getStatusCode():
$title = _('Sorry, the page you are looking for could not be found.');
if (null !== $this->translator) {
$title = $this->translator->trans('Sorry, the page you are looking for could not be found.');
} else {
$title = 'Sorry, the page you are looking for could not be found.';
}
break;
case 403 === $exception->getStatusCode():
$title = _('Sorry, you do have access to the page you are looking for.');
if (null !== $this->translator) {
$title = $this->translator->trans('Sorry, you do have access to the page you are looking for.');
} else {
$title = 'Sorry, you do have access to the page you are looking for.';
}
break;
case 500 === $exception->getStatusCode():
$title = _('Whoops, looks like something went wrong.');
if (null !== $this->translator) {
$title = $this->translator->trans('Whoops, looks like something went wrong.');
} else {
$title = 'Whoops, looks like something went wrong.';
}
break;
case 503 === $exception->getStatusCode():
$title = _('Sorry, site is currently undergoing maintenance, come back soon.');
if (null !== $this->translator) {
$title = $this->translator->trans('Sorry, site is currently undergoing maintenance, come back soon.');
} else {
$title = 'Sorry, site is currently undergoing maintenance, come back soon.';
}
break;
case isset(Response::$statusTexts[$exception->getStatusCode()]):
$title = $exception->getStatusCode() . ' : ' . Response::$statusTexts[$exception->getStatusCode()];
break;
default:
if (null !== $this->translator) {
$title = $this->translator->trans('Whoops, looks like something went wrong.');
} else {
$title = 'Whoops, looks like something went wrong.';
}
}
$content = parent::getContent($exception);
$start = strpos($content, '</h1>');

View File

@@ -23,7 +23,7 @@ class ManipulatorServiceProvider implements ServiceProviderInterface
public function register(SilexApplication $app)
{
$app['manipulator.task'] = $app->share(function (SilexApplication $app) {
return new TaskManipulator($app['EM'], $app['task-manager.notifier']);
return new TaskManipulator($app['EM'], $app['task-manager.notifier'], $app['translator']);
});
$app['manipulator.user'] = $app->share(function ($app) {

View File

@@ -24,7 +24,6 @@ use Doctrine\ORM\Configuration as ORMConfiguration;
use Doctrine\DBAL\Types\Type;
use Gedmo\DoctrineExtensions;
use Gedmo\Timestampable\TimestampableListener;
use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler;
use Silex\Application;
use Silex\ServiceProviderInterface;
@@ -37,7 +36,7 @@ class ORMServiceProvider implements ServiceProviderInterface
$app['EM.sql-logger.max-files'] = 5;
$app['EM.sql-logger'] = $app->share(function (Application $app) {
$logger = new Logger('doctrine-logger');
$logger = new $app['monolog.logger.class']('doctrine-logger');
$logger->pushHandler(new RotatingFileHandler($app['EM.sql-logger.file'], $app['EM.sql-logger.max-files']));
return new MonologSQLLogger($logger, 'yaml');

View File

@@ -43,7 +43,7 @@ class RegistrationServiceProvider implements ServiceProviderInterface
$app['registration.optional-fields'] = $app->share(function (Application $app) {
return [
'login'=> [
'label' => _('admin::compte-utilisateur identifiant'),
'label' => 'admin::compte-utilisateur identifiant',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
@@ -51,81 +51,81 @@ class RegistrationServiceProvider implements ServiceProviderInterface
]
],
'gender' => [
'label' => _('admin::compte-utilisateur sexe'),
'label' => 'admin::compte-utilisateur sexe',
'type' => 'choice',
'multiple' => false,
'expanded' => false,
'choices' => [
'0' => _('admin::compte-utilisateur:sexe: mademoiselle'),
'1' => _('admin::compte-utilisateur:sexe: madame'),
'2' => _('admin::compte-utilisateur:sexe: monsieur'),
'0' => 'admin::compte-utilisateur:sexe: mademoiselle',
'1' => 'admin::compte-utilisateur:sexe: madame',
'2' => 'admin::compte-utilisateur:sexe: monsieur',
]
],
'firstname' => [
'label' => _('admin::compte-utilisateur prenom'),
'label' => 'admin::compte-utilisateur prenom',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'lastname' => [
'label' => _('admin::compte-utilisateur nom'),
'label' => 'admin::compte-utilisateur nom',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'address' => [
'label' => _('admin::compte-utilisateur adresse'),
'label' => 'admin::compte-utilisateur adresse',
'type' => 'textarea',
'constraints' => [
new Assert\NotBlank(),
]
],
'zipcode' => [
'label' => _('admin::compte-utilisateur code postal'),
'label' => 'admin::compte-utilisateur code postal',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'geonameid' => [
'label' => _('admin::compte-utilisateur ville'),
'label' => 'admin::compte-utilisateur ville',
'type' => new \Alchemy\Phrasea\Form\Type\GeonameType(),
'constraints' => [
new Assert\NotBlank(),
]
],
'position' => [
'label' => _('admin::compte-utilisateur poste'),
'label' => 'admin::compte-utilisateur poste',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'company' => [
'label' => _('admin::compte-utilisateur societe'),
'label' => 'admin::compte-utilisateur societe',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'job' => [
'label' => _('admin::compte-utilisateur activite'),
'label' => 'admin::compte-utilisateur activite',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'tel' => [
'label' => _('admin::compte-utilisateur tel'),
'label' => 'admin::compte-utilisateur tel',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'fax' => [
'label' => _('admin::compte-utilisateur fax'),
'label' => 'admin::compte-utilisateur fax',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),

View File

@@ -45,7 +45,7 @@ class TasksServiceProvider implements ServiceProviderInterface
});
$app['task-manager.job-factory'] = $app->share(function (Application $app) {
return new JobFactory($app['dispatcher'],isset($app['task-manager.logger']) ? $app['task-manager.logger'] : $app['logger']);
return new JobFactory($app['dispatcher'],isset($app['task-manager.logger']) ? $app['task-manager.logger'] : $app['logger'], $app['translator']);
});
$app['task-manager.status'] = $app->share(function (Application $app) {
@@ -66,14 +66,14 @@ class TasksServiceProvider implements ServiceProviderInterface
$app['task-manager.available-jobs'] = $app->share(function (Application $app) {
return [
new FtpJob(),
new ArchiveJob(),
new BridgeJob(),
new FtpPullJob(),
new PhraseanetIndexerJob(),
new RecordMoverJob(),
new SubdefsJob(),
new WriteMetadataJob(),
new FtpJob($app['dispatcher'], $app['logger'], $app['translator']),
new ArchiveJob($app['dispatcher'], $app['logger'], $app['translator']),
new BridgeJob($app['dispatcher'], $app['logger'], $app['translator']),
new FtpPullJob($app['dispatcher'], $app['logger'], $app['translator']),
new PhraseanetIndexerJob($app['dispatcher'], $app['logger'], $app['translator']),
new RecordMoverJob($app['dispatcher'], $app['logger'], $app['translator']),
new SubdefsJob($app['dispatcher'], $app['logger'], $app['translator']),
new WriteMetadataJob($app['dispatcher'], $app['logger'], $app['translator']),
];
});
}

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\Feed\RSS;
class Image implements FeedRSSImageInterface
class Image implements ImageInterface
{
/**
*

View File

@@ -11,6 +11,7 @@
namespace Alchemy\Phrasea\Form\Constraint;
use Alchemy\Phrasea\Application;
use Symfony\Component\Validator\Constraint;
use Alchemy\Geonames\Connector;
use Alchemy\Geonames\Exception\TransportException;
@@ -18,12 +19,11 @@ use Alchemy\Geonames\Exception\NotFoundException;
class Geoname extends Constraint
{
public $message = 'This place does not seem to exist.';
private $connector;
private $message;
public function __construct(Connector $connector)
{
$this->message = _('This place does not seem to exist.');
$this->connector = $connector;
parent::__construct();
}
@@ -40,4 +40,9 @@ class Geoname extends Constraint
return true;
}
public static function create(Application $app)
{
return new static($app['geonames.connector']);
}
}

View File

@@ -22,7 +22,7 @@ class GeonameValidator extends ConstraintValidator
public function validate($value, Constraint $constraint)
{
if (!$constraint->isValid($value)) {
$this->context->addViolation(_('This place does not seem to exist.'));
$this->context->addViolation($constraint->message);
}
}
}

View File

@@ -16,12 +16,11 @@ use Symfony\Component\Validator\Constraint;
class NewEmail extends Constraint
{
public $message = 'This email is already bound to an account';
private $app;
private $message;
public function __construct(Application $app)
{
$this->message = _('This email is already bound to an account');
$this->app = $app;
parent::__construct();
}
@@ -32,4 +31,9 @@ class NewEmail extends Constraint
return $ret;
}
public static function create(Application $app)
{
return new static($app);
}
}

View File

@@ -22,7 +22,7 @@ class NewEmailValidator extends ConstraintValidator
public function validate($value, Constraint $constraint)
{
if ($constraint->isAlreadyRegistered($value)) {
$this->context->addViolation(_('There is already an account bound to this email address'));
$this->context->addViolation($constraint->message);
}
}
}

View File

@@ -16,12 +16,11 @@ use Symfony\Component\Validator\Constraint;
class NewLogin extends Constraint
{
public $message = 'This login is already registered';
private $app;
private $message;
public function __construct(Application $app)
{
$this->message = _('This login is already registered');
$this->app = $app;
parent::__construct();
}
@@ -32,4 +31,9 @@ class NewLogin extends Constraint
return $ret;
}
public static function create(Application $app)
{
return new static($app);
}
}

View File

@@ -22,7 +22,7 @@ class NewLoginValidator extends ConstraintValidator
public function validate($value, Constraint $constraint)
{
if ($constraint->isAlreadyRegistered($value)) {
$this->context->addViolation(_('This login is already registered'));
$this->context->addViolation($constraint->message);
}
}
}

View File

@@ -17,13 +17,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class PasswordToken extends Constraint
{
public $message = 'The token provided is not valid anymore';
private $app;
private $random;
private $message;
public function __construct(Application $app, \random $random)
{
$this->message = _('The token provided is not valid anymore');
$this->app = $app;
$this->random = $random;
parent::__construct();
@@ -39,4 +38,9 @@ class PasswordToken extends Constraint
return \random::TYPE_PASSWORD === $data['type'];
}
public static function create(Application $app)
{
return new static($app, $app['tokens']);
}
}

View File

@@ -22,7 +22,7 @@ class PasswordTokenValidator extends ConstraintValidator
public function validate($value, Constraint $constraint)
{
if (!$constraint->isValid($value)) {
$this->context->addViolation('The token provided is not valid anymore');
$this->context->addViolation($constraint->message);
}
}
}

View File

@@ -20,7 +20,7 @@ class PhraseaAuthenticationForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('login', 'text', [
'label' => _('Login'),
'label' => 'Login',
'required' => true,
'disabled' => $options['disabled'],
'constraints' => [
@@ -29,7 +29,7 @@ class PhraseaAuthenticationForm extends AbstractType
]);
$builder->add('password', 'password', [
'label' => _('Password'),
'label' => 'Password',
'required' => true,
'disabled' => $options['disabled'],
'constraints' => [
@@ -38,7 +38,7 @@ class PhraseaAuthenticationForm extends AbstractType
]);
$builder->add('remember-me', 'checkbox', [
'label' => _('Remember me'),
'label' => 'Remember me',
'mapped' => false,
'required' => false,
'attr' => [

View File

@@ -20,7 +20,7 @@ class PhraseaForgotPasswordForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('email', 'email', [
'label' => _('E-mail'),
'label' => ('E-mail'),
'required' => true,
'constraints' => [
new Assert\NotBlank(),

View File

@@ -41,11 +41,11 @@ class PhraseaRecoverPasswordForm extends AbstractType
$builder->add('password', 'repeated', [
'type' => 'password',
'required' => true,
'invalid_message' => _('Please provide the same passwords.'),
'invalid_message' => 'Please provide the same passwords.',
'first_name' => 'password',
'second_name' => 'confirm',
'first_options' => ['label' => _('New password')],
'second_options' => ['label' => _('New password (confirmation)')],
'first_options' => ['label' => ('New password')],
'second_options' => ['label' => ('New password (confirmation)')],
'constraints' => [
new Assert\NotBlank(),
new Assert\Length(['min' => 5]),

View File

@@ -35,7 +35,7 @@ class PhraseaRegisterForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('email', 'email', [
'label' => _('E-mail'),
'label' => ('E-mail'),
'required' => true,
'constraints' => [
new Assert\NotBlank(),
@@ -47,11 +47,11 @@ class PhraseaRegisterForm extends AbstractType
$builder->add('password', 'repeated', [
'type' => 'password',
'required' => true,
'invalid_message' => _('Please provide the same passwords.'),
'invalid_message' => 'Please provide the same passwords.',
'first_name' => 'password',
'second_name' => 'confirm',
'first_options' => ['label' => _('Password')],
'second_options' => ['label' => _('Password (confirmation)')],
'first_options' => ['label' => 'Password'],
'second_options' => ['label' => 'Password (confirmation)'],
'constraints' => [
new Assert\NotBlank(),
new Assert\Length(['min' => 5]),
@@ -60,11 +60,11 @@ class PhraseaRegisterForm extends AbstractType
if ($this->app->hasTermsOfUse()) {
$builder->add('accept-tou', 'checkbox', [
'label' => _('Terms of Use'),
'label' => ('Terms of Use'),
'mapped' => false,
"constraints" => [
new Assert\True([
"message" => _("Please accept the Terms and conditions in order to register.")
"message" => ("Please accept the Terms and conditions in order to register.")
])],
]);
}
@@ -115,7 +115,7 @@ class PhraseaRegisterForm extends AbstractType
'constraints' => [
new Assert\Choice([
'choices' => $baseIds,
'minMessage' => _('You must select at least %s collection.'),
'minMessage' => ('You must select at least %s collection.'),
'multiple' => true,
'min' => 1,
]),

View File

@@ -23,7 +23,7 @@ class PhraseaRenewPasswordForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('oldPassword', 'password', [
'label' => _('Current password'),
'label' => 'Current password',
'required' => true,
'constraints' => [
new Assert\NotBlank()
@@ -33,11 +33,11 @@ class PhraseaRenewPasswordForm extends AbstractType
$builder->add('password', 'repeated', [
'type' => 'password',
'required' => true,
'invalid_message' => _('Please provide the same passwords.'),
'invalid_message' => 'Please provide the same passwords.',
'first_name' => 'password',
'second_name' => 'confirm',
'first_options' => ['label' => _('New password')],
'second_options' => ['label' => _('New password (confirmation)')],
'first_options' => ['label' => 'New password'],
'second_options' => ['label' => 'New password (confirmation)'],
'constraints' => [
new Assert\NotBlank(),
new Assert\Length(['min' => 5]),

View File

@@ -22,14 +22,14 @@ class TaskForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', 'text', [
'label' => _('Task name'),
'label' => 'Task name',
'required' => true,
'constraints' => [
new Assert\NotBlank(),
],
]);
$builder->add('period', 'integer', [
'label' => _('Task period (in seconds)'),
'label' => 'Task period (in seconds)',
'required' => true,
'constraints' => [
new Assert\NotBlank(),
@@ -37,7 +37,7 @@ class TaskForm extends AbstractType
],
]);
$builder->add('status', 'choice', [
'label' => _('The task status'),
'label' => 'The task status',
'choices' => [
Task::STATUS_STARTED => 'Started',
Task::STATUS_STOPPED => 'Stopped',

View File

@@ -589,7 +589,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
$parm = $this->unserializedRequestData($this->app['request'], $infos, 'user_infos');
if ($parm['email'] && !\Swift_Validate::email($parm['email'])) {
throw new \Exception_InvalidArgument(_('Email addess is not valid'));
throw new \Exception_InvalidArgument('Email addess is not valid');
}
$old_email = $user->get_email();
@@ -617,7 +617,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
}
if ($oldReceiver) {
$mailOldAddress = MailSuccessEmailUpdate::create($this->app, $oldReceiver, null, sprintf(_('You will now receive notifications at %s'), $new_email));
$mailOldAddress = MailSuccessEmailUpdate::create($this->app, $oldReceiver, null, $this->app->trans('You will now receive notifications at %new_email%', array('%new_email%' => $new_email)));
$this->app['notification.deliverer']->deliver($mailOldAddress);
}
@@ -628,7 +628,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
}
if ($newReceiver) {
$mailNewAddress = MailSuccessEmailUpdate::create($this->app, $newReceiver, null, sprintf(_('You will no longer receive notifications at %s'), $old_email));
$mailNewAddress = MailSuccessEmailUpdate::create($this->app, $newReceiver, null, $this->app->trans('You will no longer receive notifications at %old_email%', array('%old_email%' => $old_email)));
$this->app['notification.deliverer']->deliver($mailNewAddress);
}
}

View File

@@ -148,7 +148,7 @@ class Manage extends Helper
$email = $this->request->get('value');
if ( ! \Swift_Validate::email($email)) {
throw new \Exception_InvalidArgument(_('Invalid mail address'));
throw new \Exception_InvalidArgument('Invalid mail address');
}
$conn = $this->app['phraseanet.appbox']->get_connection();
@@ -210,7 +210,7 @@ class Manage extends Helper
$name = $this->request->get('value');
if (trim($name) === '') {
throw new \Exception_InvalidArgument(_('Invalid template name'));
throw new \Exception_InvalidArgument('Invalid template name');
}
$created_user = \User_Adapter::create($this->app, $name, \random::generatePassword(16), null, false, false);

View File

@@ -45,7 +45,7 @@ class WorkZone extends Helper
if (0 === count($baskets)) {
$basket = new BasketEntity();
$basket->setName(_('Default basket'));
$basket->setName($this->app->trans('Default basket'));
$basket->setOwner($this->app['authentication']->getUser());
$this->app['EM']->persist($basket);

View File

@@ -11,6 +11,8 @@
namespace Alchemy\Phrasea\Media\Subdef;
use Symfony\Component\Translation\TranslatorInterface;
class Audio extends Provider
{
const OPTION_AUDIOBITRATE = 'audiobitrate';
@@ -18,16 +20,18 @@ class Audio extends Provider
const OPTION_ACODEC = 'acodec';
const OPTION_AUDIOSAMPLERATE = 'audiosamplerate';
public function __construct()
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
$AVaudiosamplerate = [
8000, 11025, 16000, 22050, 32000, 44056, 44100,
47250, 48000, 50000, 50400, 88200, 96000
];
$this->registerOption(new OptionType\Range(_('Audio Birate'), self::OPTION_AUDIOBITRATE, 32, 320, 128, 32));
$this->registerOption(new OptionType\Enum(_('AudioSamplerate'), self::OPTION_AUDIOSAMPLERATE, $AVaudiosamplerate));
$this->registerOption(new OptionType\Enum(_('Audio Codec'), self::OPTION_ACODEC, ['libmp3lame', 'flac'], 'libmp3lame'));
$this->registerOption(new OptionType\Range($this->translator->trans('Audio Birate'), self::OPTION_AUDIOBITRATE, 32, 320, 128, 32));
$this->registerOption(new OptionType\Enum($this->translator->trans('AudioSamplerate'), self::OPTION_AUDIOSAMPLERATE, $AVaudiosamplerate));
$this->registerOption(new OptionType\Enum($this->translator->trans('Audio Codec'), self::OPTION_ACODEC, ['libmp3lame', 'flac'], 'libmp3lame'));
}
public function getType()
@@ -37,7 +41,7 @@ class Audio extends Provider
public function getDescription()
{
return _('Generates an audio file');
return $this->translator->trans('Generates an audio file');
}
public function getMediaAlchemystSpec()

View File

@@ -11,13 +11,15 @@
namespace Alchemy\Phrasea\Media\Subdef;
use Symfony\Component\Translation\TranslatorInterface;
class FlexPaper extends Provider
{
protected $options = [];
public function __construct()
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function getType()
@@ -27,7 +29,7 @@ class FlexPaper extends Provider
public function getDescription()
{
return _('Generates a flexpaper flash file');
return $this->translator->trans('Generates a flexpaper flash file');
}
public function getMediaAlchemystSpec()

View File

@@ -11,15 +11,17 @@
namespace Alchemy\Phrasea\Media\Subdef;
use Symfony\Component\Translation\TranslatorInterface;
class Gif extends Image
{
const OPTION_DELAY = 'delay';
public function __construct()
public function __construct(TranslatorInterface $translator)
{
parent::__construct();
parent::__construct($translator);
$this->registerOption(new OptionType\Range(_('Delay'), self::OPTION_DELAY, 50, 500, 100));
$this->registerOption(new OptionType\Range($this->translator->trans('Delay'), self::OPTION_DELAY, 50, 500, 100));
}
public function getType()
@@ -29,7 +31,7 @@ class Gif extends Image
public function getDescription()
{
return _('Generates an animated Gif file');
return $this->translator->trans('Generates an animated Gif file');
}
public function getMediaAlchemystSpec()

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Media\Subdef;
use MediaAlchemyst\Specification\Image as ImageSpecification;
use Symfony\Component\Translation\TranslatorInterface;
class Image extends Provider
{
@@ -22,12 +23,14 @@ class Image extends Provider
protected $options = [];
public function __construct()
public function __construct(TranslatorInterface $translator)
{
$this->registerOption(new OptionType\Range(_('Dimension'), self::OPTION_SIZE, 20, 3000, 800));
$this->registerOption(new OptionType\Range(_('Resolution'), self::OPTION_RESOLUTION, 50, 300, 72));
$this->registerOption(new OptionType\Boolean(_('Remove ICC Profile'), self::OPTION_STRIP, false));
$this->registerOption(new OptionType\Range(_('Quality'), self::OPTION_QUALITY, 0, 100, 75));
$this->translator = $translator;
$this->registerOption(new OptionType\Range($this->translator->trans('Dimension'), self::OPTION_SIZE, 20, 3000, 800));
$this->registerOption(new OptionType\Range($this->translator->trans('Resolution'), self::OPTION_RESOLUTION, 50, 300, 72));
$this->registerOption(new OptionType\Boolean($this->translator->trans('Remove ICC Profile'), self::OPTION_STRIP, false));
$this->registerOption(new OptionType\Range($this->translator->trans('Quality'), self::OPTION_QUALITY, 0, 100, 75));
}
public function getType()
@@ -37,7 +40,7 @@ class Image extends Provider
public function getDescription()
{
return _('Generates a Jpeg image');
return $this->translator->trans('Generates a Jpeg image');
}
public function getMediaAlchemystSpec()

View File

@@ -15,6 +15,7 @@ abstract class Provider implements Subdef
{
protected $options = [];
protected $spec;
protected $translator;
public function registerOption(OptionType\OptionType $option)
{

View File

@@ -11,6 +11,8 @@
namespace Alchemy\Phrasea\Media\Subdef;
use Symfony\Component\Translation\TranslatorInterface;
class Video extends Audio
{
const OPTION_SIZE = 'size';
@@ -21,17 +23,17 @@ class Video extends Audio
protected $options = [];
public function __construct()
public function __construct(TranslatorInterface $translator)
{
parent::__construct();
parent::__construct($translator);
$this->registerOption(new OptionType\Range(_('Bitrate'), self::OPTION_BITRATE, 100, 12000, 800));
$this->registerOption(new OptionType\Range(_('GOP size'), self::OPTION_GOPSIZE, 1, 300, 10));
$this->registerOption(new OptionType\Range(_('Dimension'), self::OPTION_SIZE, 64, 2000, 600, 16));
$this->registerOption(new OptionType\Range(_('Frame Rate'), self::OPTION_FRAMERATE, 1, 200, 20));
$this->registerOption(new OptionType\Enum(_('Video Codec'), self::OPTION_VCODEC, ['libx264', 'libvpx', 'libtheora'], 'libx264'));
$this->registerOption(new OptionType\Range($this->translator->trans('Bitrate'), self::OPTION_BITRATE, 100, 12000, 800));
$this->registerOption(new OptionType\Range($this->translator->trans('GOP size'), self::OPTION_GOPSIZE, 1, 300, 10));
$this->registerOption(new OptionType\Range($this->translator->trans('Dimension'), self::OPTION_SIZE, 64, 2000, 600, 16));
$this->registerOption(new OptionType\Range($this->translator->trans('Frame Rate'), self::OPTION_FRAMERATE, 1, 200, 20));
$this->registerOption(new OptionType\Enum($this->translator->trans('Video Codec'), self::OPTION_VCODEC, ['libx264', 'libvpx', 'libtheora'], 'libx264'));
$this->unregisterOption(self::OPTION_ACODEC);
$this->registerOption(new OptionType\Enum(_('Audio Codec'), self::OPTION_ACODEC, ['libfaac', 'libvo_aacenc', 'libmp3lame', 'libvorbis'], 'libfaac'));
$this->registerOption(new OptionType\Enum($this->translator->trans('Audio Codec'), self::OPTION_ACODEC, ['libfaac', 'libvo_aacenc', 'libmp3lame', 'libvorbis'], 'libfaac'));
}
public function getType()
@@ -41,7 +43,7 @@ class Video extends Audio
public function getDescription()
{
return _('Generates a video file');
return $this->translator->trans('Generates a video file');
}
public function getMediaAlchemystSpec()

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Model\Entities;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Translation\TranslatorInterface;
/**
* @ORM\Table(name="LazaretChecks")
@@ -98,14 +99,14 @@ class LazaretCheck
*
* @return string
*/
public function getMessage()
public function getMessage(TranslatorInterface $translator)
{
$className = $this->getCheckClassname();
if (method_exists($className, "getMessage")) {
return $className::getMessage();
} else {
return $className::getMessage($translator);
}
return '';
}
}
}

View File

@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Translation\TranslatorInterface;
/**
* @ORM\Table(name="Users",
@@ -961,10 +962,10 @@ class User
/**
* @return string
*/
public function getDisplayName()
public function getDisplayName(TranslatorInterface $translator)
{
if ($this->isTemplate()) {
return sprintf(_('modele %s'), $this->getLogin());
return $translator->trans('modele %name%', array('%name%' => $this->getLogin()));
}
if (trim($this->lastName) !== '' || trim($this->firstName) !== '') {
@@ -975,6 +976,6 @@ class User
return $this->email;
}
return _('Unnamed user');
return $translator->trans('Unnamed user');
}
}

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\ValidationParticipant;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -263,27 +264,15 @@ class ValidationSession
if ($this->isInitiator($user)) {
if ($this->isFinished()) {
return sprintf(
_('Vous aviez envoye cette demande a %d utilisateurs')
, (count($this->getParticipants()) - 1)
);
return $app->trans('Vous aviez envoye cette demande a %n% utilisateurs', array('%n%' => count($this->getParticipants()) - 1));
} else {
return sprintf(
_('Vous avez envoye cette demande a %d utilisateurs')
, (count($this->getParticipants()) - 1)
);
return $app->trans('Vous avez envoye cette demande a %n% utilisateurs', array('%n%' => count($this->getParticipants()) - 1));
}
} else {
if ($this->getParticipant($user, $app)->getCanSeeOthers()) {
return sprintf(
_('Processus de validation recu de %s et concernant %d utilisateurs')
, $this->getInitiator($app)->get_display_name()
, (count($this->getParticipants()) - 1));
return $app->trans('Processus de validation recu de %user% et concernant %n% utilisateurs', array('%user%' => $this->getInitiator($app)->get_display_name(), '%n%' => count($this->getParticipants()) - 1));
} else {
return sprintf(
_('Processus de validation recu de %s')
, $this->getInitiator($app)->get_display_name()
);
return $app->trans('Processus de validation recu de %user%', array('%user%' => $this->getInitiator($app)->get_display_name()));
}
}
}
@@ -291,7 +280,7 @@ class ValidationSession
/**
* Get a participant
*
* @return Alchemy\Phrasea\Model\Entities\ValidationParticipant
* @return ValidationParticipant
*/
public function getParticipant(\User_Adapter $user, Application $app)
{

View File

@@ -11,10 +11,11 @@
namespace Alchemy\Phrasea\Model\Manipulator;
use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\TaskManager\Job\EmptyCollectionJob;
use Alchemy\Phrasea\TaskManager\Notifier;
use Doctrine\Common\Persistence\ObjectManager;
use Alchemy\Phrasea\Model\Entities\Task;
use Symfony\Component\Translation\TranslatorInterface;
class TaskManipulator implements ManipulatorInterface
{
@@ -22,11 +23,14 @@ class TaskManipulator implements ManipulatorInterface
private $notifier;
/** @var Objectmanager */
private $om;
/** @var TranslatorInterface */
private $translator;
public function __construct(ObjectManager $om, Notifier $notifier)
public function __construct(ObjectManager $om, Notifier $notifier, TranslatorInterface $translator)
{
$this->om = $om;
$this->notifier = $notifier;
$this->translator = $translator;
}
/**
@@ -64,7 +68,7 @@ class TaskManipulator implements ManipulatorInterface
*/
public function createEmptyCollectionJob(\collection $collection)
{
$job = new EmptyCollectionJob();
$job = new EmptyCollectionJob(null, null, $this->translator);
$settings = simplexml_load_string($job->getEditor()->getDefaultSettings());
$settings->bas_id = $collection->get_base_id();

View File

@@ -235,12 +235,12 @@ class LazaretCheck extends \Alchemy\Phrasea\Model\Entities\LazaretCheck implemen
/**
* {@inheritDoc}
*/
public function getMessage()
public function getMessage(\Symfony\Component\Translation\TranslatorInterface $translator)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getMessage', array());
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getMessage', array($translator));
return parent::getMessage();
return parent::getMessage($translator);
}
}

View File

@@ -1082,12 +1082,12 @@ class User extends \Alchemy\Phrasea\Model\Entities\User implements \Doctrine\ORM
/**
* {@inheritDoc}
*/
public function getDisplayName()
public function getDisplayName(\Symfony\Component\Translation\TranslatorInterface $translator)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getDisplayName', array());
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getDisplayName', array($translator));
return parent::getDisplayName();
return parent::getDisplayName($translator);
}
}

View File

@@ -48,7 +48,7 @@ class BasketElementRepository extends EntityRepository
/* @var $element BasketElement */
if (null === $element) {
throw new NotFoundHttpException(_('Element is not found'));
throw new NotFoundHttpException('Element is not found');
}
return $element;

View File

@@ -39,11 +39,11 @@ class UsrListOwnerRepository extends EntityRepository
/* @var $owner UsrListOwner */
if (null === $owner) {
throw new NotFoundHttpException(_('Owner is not found'));
throw new NotFoundHttpException('Owner is not found');
}
if ( ! $owner->getList()->getid() != $list->getId()) {
throw new AccessDeniedHttpException(_('Owner and list mismatch'));
throw new AccessDeniedHttpException('Owner and list mismatch');
}
return $owner;
@@ -74,7 +74,7 @@ class UsrListOwnerRepository extends EntityRepository
/* @var $owner UsrListOwner */
if (null === $owner) {
throw new NotFoundHttpException(_('Owner is not found'));
throw new NotFoundHttpException('Owner is not found');
}
return $owner;

View File

@@ -60,11 +60,11 @@ class UsrListRepository extends EntityRepository
/* @var $list UsrList */
if (null === $list) {
throw new NotFoundHttpException(_('List is not found'));
throw new NotFoundHttpException('List is not found.');
}
if ( ! $list->hasAccess($user, $app)) {
throw new AccessDeniedHttpException(_('You have not access to this list'));
throw new AccessDeniedHttpException('You have not access to this list.');
}
return $list;

View File

@@ -45,10 +45,7 @@ class MailInfoBridgeUploadFailed extends AbstractMailWithLink
*/
public function getSubject()
{
return sprintf(
_('Upload failed on %s'),
$this->getPhraseanetTitle()
);
return $this->app->trans('Upload failed on %application%', array('%application%' => $this->getPhraseanetTitle()));
}
/**
@@ -63,11 +60,7 @@ class MailInfoBridgeUploadFailed extends AbstractMailWithLink
throw new LogicException('You must set a reason before calling getMessage');
}
return sprintf(
_('An upload on %s failed, the resaon is : %s'),
$this->adapter,
$this->reason
);
return $this->app->trans('An upload on %bridge_adapter% failed, the resaon is : %reason%', array('%bridge_adapter%' => $this->adapter, '%reason%' => $this->reason));
}
/**

View File

@@ -33,10 +33,7 @@ class MailInfoNewOrder extends AbstractMail
*/
public function getSubject()
{
return sprintf(
_('admin::register: Nouvelle commande sur %s'),
$this->getPhraseanetTitle()
);
return $this->app->trans('admin::register: Nouvelle commande sur %s', array('%application%' => $this->getPhraseanetTitle()));
}
/**
@@ -48,7 +45,7 @@ class MailInfoNewOrder extends AbstractMail
throw new LogicException('You must set a user before calling getMessage()');
}
return sprintf(_('%s has ordered documents'),$this->user->get_display_name());
return $this->app->trans('%user% has ordered documents', array('%user%' => $this->user->get_display_name()));
}
/**
@@ -56,7 +53,7 @@ class MailInfoNewOrder extends AbstractMail
*/
public function getButtonText()
{
return sprintf(_('See order on %s'), $this->getPhraseanetTitle());
return $this->app->trans('Review order on %website%', array('%website%' => $this->getPhraseanetTitle()));
}
/**

View File

@@ -49,7 +49,7 @@ class MailInfoNewPublication extends AbstractMailWithLink
throw new LogicException('You must set an title before calling getMessage');
}
return sprintf(_('Nouvelle publication : %s'), $this->title);
return $this->app->trans('Nouvelle publication : %title%', array('%title%' => $this->title));
}
/**
@@ -64,7 +64,7 @@ class MailInfoNewPublication extends AbstractMailWithLink
throw new LogicException('You must set an title before calling getMessage');
}
return sprintf('%s vient de publier %s', $this->author, $this->title);
return $this->app->trans('%user% vient de publier %title%', array('%user%' => $this->author, '%title%' => $this->title));
}
/**
@@ -72,7 +72,7 @@ class MailInfoNewPublication extends AbstractMailWithLink
*/
public function getButtonText()
{
return sprintf(_('View on %s'), $this->getPhraseanetTitle());
return $this->app->trans('View on %title%', array('%title%' => $this->getPhraseanetTitle()));
}
/**

View File

@@ -45,7 +45,7 @@ class MailInfoOrderCancelled extends AbstractMail
*/
public function getSubject()
{
return _('push::mail:: Refus d\'elements de votre commande');
return $this->app->trans('push::mail:: Refus d\'elements de votre commande');
}
/**
@@ -60,11 +60,10 @@ class MailInfoOrderCancelled extends AbstractMail
throw new LogicException('You must set a deliverer before calling getMessage()');
}
return sprintf(
_('%s a refuse %d elements de votre commande'),
$this->deliverer->get_display_name(),
$this->quantity
);
return $this->app->trans('%user% a refuse %quantity% elements de votre commande', array(
'%user%' => $this->deliverer->get_display_name(),
'%quantity%' => $this->quantity,
));
}
/**
@@ -72,7 +71,7 @@ class MailInfoOrderCancelled extends AbstractMail
*/
public function getButtonText()
{
return _('See my order');
return $this->app->trans('See my order');
}
/**

View File

@@ -50,9 +50,7 @@ class MailInfoOrderDelivered extends AbstractMail
throw new LogicException('You must set a basket before calling getSubject');
}
return sprintf(
_('push::mail:: Reception de votre commande %s'), $this->basket->getName()
);
return $this->app->trans('push::mail:: Reception de votre commande %title%', array('%title%' => $this->basket->getName()));
}
/**
@@ -64,10 +62,7 @@ class MailInfoOrderDelivered extends AbstractMail
throw new LogicException('You must set a deliverer before calling getMessage');
}
return sprintf(
_('%s vous a delivre votre commande, consultez la en ligne a l\'adresse suivante'),
$this->deliverer->get_display_name()
);
return $this->app->trans('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', array('%user%' => $this->deliverer->get_display_name()));
}
/**
@@ -75,7 +70,7 @@ class MailInfoOrderDelivered extends AbstractMail
*/
public function getButtonText()
{
return _('See my order');
return $this->app->trans('See my order');
}
/**

Some files were not shown because too many files have changed in this diff Show More