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 PHPExiftool\PHPExiftoolServiceProvider;
use Silex\Application as SilexApplication; use Silex\Application as SilexApplication;
use Silex\Application\UrlGeneratorTrait; use Silex\Application\UrlGeneratorTrait;
use Silex\Application\TranslationTrait;
use Silex\Provider\FormServiceProvider; use Silex\Provider\FormServiceProvider;
use Silex\Provider\MonologServiceProvider; use Silex\Provider\MonologServiceProvider;
use Silex\Provider\SessionServiceProvider; use Silex\Provider\SessionServiceProvider;
@@ -157,6 +158,7 @@ use Symfony\Component\Form\Exception\FormException;
class Application extends SilexApplication class Application extends SilexApplication
{ {
use UrlGeneratorTrait; use UrlGeneratorTrait;
use TranslationTrait;
private static $availableLanguages = [ private static $availableLanguages = [
'de_DE' => 'Deutsch', 'de_DE' => 'Deutsch',
@@ -332,7 +334,10 @@ class Application extends SilexApplication
$this->register(new PluginServiceProvider()); $this->register(new PluginServiceProvider());
$this['phraseanet.exception_handler'] = $this->share(function ($app) { $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) { $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('count', new \Twig_Filter_Function('count'));
$twig->addFilter('formatOctets', new \Twig_Filter_Function('p4string::format_octets')); $twig->addFilter('formatOctets', new \Twig_Filter_Function('p4string::format_octets'));
$twig->addFilter('base_from_coll', new \Twig_Filter_Function('phrasea::baseFromColl')); $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) { $twig->addFilter(new \Twig_SimpleFilter('escapeSimpleQuote', function ($value) {
$ret = str_replace("'", "\'", $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/oauthv2', new Oauth2());
$app->mount('/api/v1', new V1()); $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()); $app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_END, new ApiLoadEndEvent());
return $app; return $app;

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* The checker interface * The checker interface
@@ -39,6 +40,10 @@ interface CheckerInterface
/** /**
* Get a localized message about the Checker * 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\Application;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
class Colorspace extends AbstractChecker class Colorspace extends AbstractChecker
{ {
@@ -60,8 +61,8 @@ class Colorspace extends AbstractChecker
return new Response($boolean, $this); 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\Application;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
class Dimension extends AbstractChecker class Dimension extends AbstractChecker
{ {
@@ -52,8 +53,8 @@ class Dimension extends AbstractChecker
return new Response($boolean, $this); 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\Application;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
class Extension extends AbstractChecker class Extension extends AbstractChecker
{ {
@@ -40,8 +41,8 @@ class Extension extends AbstractChecker
return new Response($boolean, $this); 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\Application;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* Checks if a file with the same filename already exists in the destination databox * Checks if a file with the same filename already exists in the destination databox
@@ -53,8 +54,8 @@ class Filename extends AbstractChecker
/** /**
* {@inheritdoc} * {@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 Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use MediaVorus\Media\MediaInterface; use MediaVorus\Media\MediaInterface;
use Symfony\Component\Translation\TranslatorInterface;
class MediaType extends AbstractChecker class MediaType extends AbstractChecker
{ {
@@ -48,8 +49,8 @@ class MediaType extends AbstractChecker
return new Response($boolean, $this); 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; namespace Alchemy\Phrasea\Border\Checker;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* The response of a check * The response of a check
*/ */
@@ -54,9 +56,9 @@ class Response
* *
* @return string * @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\Application;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* Checks if a file with the same Sha256 checksum already exists in the * Checks if a file with the same Sha256 checksum already exists in the
@@ -42,8 +43,8 @@ class Sha256 extends AbstractChecker
/** /**
* {@inheritdoc} * {@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\Application;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* Checks if a file with the same UUID already exists in the destination databox * Checks if a file with the same UUID already exists in the destination databox
@@ -41,8 +42,8 @@ class UUID extends AbstractChecker
/** /**
* {@inheritdoc} * {@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')) { switch ($errorMsg = $request->query->get('error')) {
case 'file-error': case 'file-error':
$errorMsg = _('Error while sending the file'); $errorMsg = $app->trans('Error while sending the file');
break; break;
case 'file-invalid': case 'file-invalid':
$errorMsg = _('Invalid file format'); $errorMsg = $app->trans('Invalid file format');
break; break;
case 'file-file-too-big': case 'file-file-too-big':
$errorMsg = _('The file is too big'); $errorMsg = $app->trans('The file is too big');
break; break;
case 'collection-not-empty': case 'collection-not-empty':
$errorMsg = _('Empty the collection before removing'); $errorMsg = $app->trans('Empty the collection before removing');
break; break;
} }
@@ -227,17 +227,17 @@ class Collection implements ControllerProviderInterface
public function emptyCollection(Application $app, Request $request, $bas_id) public function emptyCollection(Application $app, Request $request, $bas_id)
{ {
$success = false; $success = false;
$msg = _('An error occurred'); $msg = $app->trans('An error occurred');
$collection = \collection::get_from_base_id($app, $bas_id); $collection = \collection::get_from_base_id($app, $bas_id);
try { try {
if ($collection->get_record_amount() <= 500) { if ($collection->get_record_amount() <= 500) {
$collection->empty_collection(500); $collection->empty_collection(500);
$msg = _('Collection empty successful'); $msg = $app->trans('Collection empty successful');
} else { } else {
$app['manipulator.task']->createEmptyCollectionJob($collection); $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; $success = true;
@@ -283,7 +283,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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() 'bas_id' => $collection->get_base_id()
]); ]);
} }
@@ -318,7 +318,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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() 'bas_id' => $collection->get_base_id()
]); ]);
} }
@@ -353,7 +353,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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() 'bas_id' => $collection->get_base_id()
]); ]);
} }
@@ -389,7 +389,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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() 'bas_id' => $collection->get_base_id()
]); ]);
} }
@@ -609,18 +609,18 @@ class Collection implements ControllerProviderInterface
public function delete(Application $app, Request $request, $bas_id) public function delete(Application $app, Request $request, $bas_id)
{ {
$success = false; $success = false;
$msg = _('An error occured'); $msg = $app->trans('An error occured');
$collection = \collection::get_from_base_id($app, $bas_id); $collection = \collection::get_from_base_id($app, $bas_id);
try { try {
if ($collection->get_record_amount() > 0) { if ($collection->get_record_amount() > 0) {
$msg = _('Empty the collection before removing'); $msg = $app->trans('Empty the collection before removing');
} else { } else {
$collection->unmount_collection($app); $collection->unmount_collection($app);
$collection->delete(); $collection->delete();
$success = true; $success = true;
$msg = _('Successful removal'); $msg = $app->trans('Successful removal');
} }
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -679,7 +679,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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) public function rename(Application $app, Request $request, $bas_id)
{ {
if (trim($name = $request->request->get('name')) === '') { if (trim($name = $request->request->get('name')) === '') {
$app->abort(400, _('Missing name parameter')); $app->abort(400, $app->trans('Missing name parameter'));
} }
$success = false; $success = false;
@@ -717,7 +717,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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) public function labels(Application $app, Request $request, $bas_id)
{ {
if (null === $labels = $request->request->get('labels')) { 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)) { 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); $collection = \collection::get_from_base_id($app, $bas_id);
@@ -755,7 +755,7 @@ class Collection implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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() 'bas_id' => $collection->get_base_id()
]); ]);
} }

View File

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

View File

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

View File

@@ -166,13 +166,13 @@ class Databox implements ControllerProviderInterface
switch ($errorMsg = $request->query->get('error')) { switch ($errorMsg = $request->query->get('error')) {
case 'file-error': case 'file-error':
$errorMsg = _('Error while sending the file'); $errorMsg = $app->trans('Error while sending the file');
break; break;
case 'file-invalid': case 'file-invalid':
$errorMsg = _('Invalid file format'); $errorMsg = $app->trans('Invalid file format');
break; break;
case 'file-too-big': case 'file-too-big':
$errorMsg = _('The file is too big'); $errorMsg = $app->trans('The file is too big');
break; break;
} }
@@ -212,18 +212,18 @@ class Databox implements ControllerProviderInterface
public function deleteBase(Application $app, Request $request, $databox_id) public function deleteBase(Application $app, Request $request, $databox_id)
{ {
$success = false; $success = false;
$msg = _('An error occured'); $msg = $app->trans('An error occured');
try { try {
$databox = $app['phraseanet.appbox']->get_databox($databox_id); $databox = $app['phraseanet.appbox']->get_databox($databox_id);
if ($databox->get_record_amount() > 0) { 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 { } else {
$databox->unmount_databox(); $databox->unmount_databox();
$app['phraseanet.appbox']->write_databox_pic($app['media-alchemyst'], $app['filesystem'], $databox, null, \databox::PIC_PDF); $app['phraseanet.appbox']->write_databox_pic($app['media-alchemyst'], $app['filesystem'], $databox, null, \databox::PIC_PDF);
$databox->delete(); $databox->delete();
$success = true; $success = true;
$msg = _('Successful removal'); $msg = $app->trans('Successful removal');
} }
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -252,10 +252,10 @@ class Databox implements ControllerProviderInterface
public function setLabels(Application $app, Request $request, $databox_id) public function setLabels(Application $app, Request $request, $databox_id)
{ {
if (null === $labels = $request->request->get('labels')) { 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)) { 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); $databox = $app['phraseanet.appbox']->get_databox($databox_id);
@@ -276,7 +276,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, 'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'), 'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id 'sbas_id' => $databox_id
]); ]);
} }
@@ -338,7 +338,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, 'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'), 'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id 'sbas_id' => $databox_id
]); ]);
} }
@@ -493,7 +493,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, 'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'), 'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
'sbas_id' => $databox_id 'sbas_id' => $databox_id
]); ]);
} }
@@ -526,7 +526,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, 'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'), 'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id 'sbas_id' => $databox_id
]); ]);
} }
@@ -548,7 +548,7 @@ class Databox implements ControllerProviderInterface
public function changeViewName(Application $app, Request $request, $databox_id) public function changeViewName(Application $app, Request $request, $databox_id)
{ {
if (null === $viewName = $request->request->get('viewname')) { 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; $success = false;
@@ -563,7 +563,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, 'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'), 'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id 'sbas_id' => $databox_id
]); ]);
} }
@@ -598,7 +598,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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 'sbas_id' => $databox_id
]); ]);
} }
@@ -618,7 +618,7 @@ class Databox implements ControllerProviderInterface
*/ */
public function emptyDatabase(Application $app, Request $request, $databox_id) public function emptyDatabase(Application $app, Request $request, $databox_id)
{ {
$msg = _('An error occurred'); $msg = $app->trans('An error occurred');
$success = false; $success = false;
$taskCreated = false; $taskCreated = false;
@@ -633,11 +633,11 @@ class Databox implements ControllerProviderInterface
} }
} }
$msg = _('Base empty successful'); $msg = $app->trans('Base empty successful');
$success = true; $success = true;
if ($taskCreated) { 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) { } catch (\Exception $e) {
@@ -668,14 +668,14 @@ class Databox implements ControllerProviderInterface
public function progressBarInfos(Application $app, Request $request, $databox_id) public function progressBarInfos(Application $app, Request $request, $databox_id)
{ {
if (!$app['request']->isXmlHttpRequest() || 'json' !== $app['request']->getRequestFormat()) { 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']; $app['phraseanet.appbox'] = $app['phraseanet.appbox'];
$ret = [ $ret = [
'success' => false, 'success' => false,
'msg' => _('An error occured'), 'msg' => $app->trans('An error occured'),
'sbas_id' => null, 'sbas_id' => null,
'indexable' => false, 'indexable' => false,
'records' => 0, 'records' => 0,
@@ -690,7 +690,7 @@ class Databox implements ControllerProviderInterface
$datas = $databox->get_indexed_record_amount(); $datas = $databox->get_indexed_record_amount();
$ret['indexable'] = $app['phraseanet.appbox']->is_databox_indexable($databox); $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['records'] = $databox->get_record_amount();
$ret['sbas_id'] = $databox_id; $ret['sbas_id'] = $databox_id;
$ret['xml_indexed'] = $datas['xml_indexed']; $ret['xml_indexed'] = $datas['xml_indexed'];
@@ -701,7 +701,7 @@ class Databox implements ControllerProviderInterface
} }
$ret['success'] = true; $ret['success'] = true;
$ret['msg'] = _('Successful update'); $ret['msg'] = $app->trans('Successful update');
} catch (\Exception $e) { } catch (\Exception $e) {
} }
@@ -747,7 +747,7 @@ class Databox implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, 'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'), 'msg' => $success ? $app->trans('Successful update') : $app->trans('An error occured'),
'sbas_id' => $databox_id 'sbas_id' => $databox_id
]); ]);
} }

View File

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

View File

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

View File

@@ -160,15 +160,15 @@ class Root implements ControllerProviderInterface
$controllers->get('/test-paths/', function (Application $app, Request $request) { $controllers->get('/test-paths/', function (Application $app, Request $request) {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { 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', []))) { 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')) { 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) { foreach ($tests as $test) {
@@ -198,7 +198,7 @@ class Root implements ControllerProviderInterface
$databox = $app['phraseanet.appbox']->get_databox((int) $databox_id); $databox = $app['phraseanet.appbox']->get_databox((int) $databox_id);
$structure = $databox->get_structure(); $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)) { if ($updateOk = !!$request->query->get('success', false)) {
$updateOk = true; $updateOk = true;
@@ -224,10 +224,10 @@ class Root implements ControllerProviderInterface
} }
if (null === $structure = $request->request->get('structure')) { 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 = new \DOMDocument('1.0', 'UTF-8');
$domst->preserveWhiteSpace = false; $domst->preserveWhiteSpace = false;
@@ -266,19 +266,19 @@ class Root implements ControllerProviderInterface
switch ($errorMsg = $request->query->get('error')) { switch ($errorMsg = $request->query->get('error')) {
case 'rights': case 'rights':
$errorMsg = _('You do not enough rights to update status'); $errorMsg = $app->trans('You do not enough rights to update status');
break; break;
case 'too-big': case 'too-big':
$errorMsg = _('File is too big : 64k max'); $errorMsg = $app->trans('File is too big : 64k max');
break; break;
case 'upload-error': case 'upload-error':
$errorMsg = _('Status icon upload failed : upload error'); $errorMsg = $app->trans('Status icon upload failed : upload error');
break; break;
case 'wright-error': 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; break;
case 'unknow-error': case 'unknow-error':
$errorMsg = _('Something wrong happend'); $errorMsg = $app->trans('Something wrong happend');
break; 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) { $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()))) { 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')) { 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 (null !== $update = $request->query->get('update')) {
if (!!$update) { if (!!$update) {
$update = _('Update succeed'); $update = $app->trans('Update succeed');
} else { } else {
$update = _('Update failed'); $update = $app->trans('Update failed');
} }
} }

View File

@@ -290,20 +290,20 @@ class Users implements ControllerProviderInterface
$buffer[] = [ $buffer[] = [
'ID' 'ID'
, 'Login' , 'Login'
, _('admin::compte-utilisateur nom') , $app->trans('admin::compte-utilisateur nom')
, _('admin::compte-utilisateur prenom') , $app->trans('admin::compte-utilisateur prenom')
, _('admin::compte-utilisateur email') , $app->trans('admin::compte-utilisateur email')
, 'CreationDate' , 'CreationDate'
, 'ModificationDate' , 'ModificationDate'
, _('admin::compte-utilisateur adresse') , $app->trans('admin::compte-utilisateur adresse')
, _('admin::compte-utilisateur ville') , $app->trans('admin::compte-utilisateur ville')
, _('admin::compte-utilisateur code postal') , $app->trans('admin::compte-utilisateur code postal')
, _('admin::compte-utilisateur pays') , $app->trans('admin::compte-utilisateur pays')
, _('admin::compte-utilisateur telephone') , $app->trans('admin::compte-utilisateur telephone')
, _('admin::compte-utilisateur fax') , $app->trans('admin::compte-utilisateur fax')
, _('admin::compte-utilisateur poste') , $app->trans('admin::compte-utilisateur poste')
, _('admin::compte-utilisateur societe') , $app->trans('admin::compte-utilisateur societe')
, _('admin::compte-utilisateur activite') , $app->trans('admin::compte-utilisateur activite')
]; ];
do { do {
$elligible_users->limit($offset, 20); $elligible_users->limit($offset, 20);
@@ -558,10 +558,10 @@ class Users implements ControllerProviderInterface
if (($accept != '' || $deny != '')) { if (($accept != '' || $deny != '')) {
$message = ''; $message = '';
if ($accept != '') { 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 != '') { 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']); $receiver = new Receiver(null, $row['usr_mail']);
@@ -656,12 +656,12 @@ class Users implements ControllerProviderInterface
if ($sqlField === 'usr_login') { if ($sqlField === 'usr_login') {
$loginToAdd = $value; $loginToAdd = $value;
if ($loginToAdd === "") { 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)) { } 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 { } else {
if (\User_Adapter::get_usr_id_from_login($app, $loginToAdd)) { 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 { } else {
$loginValid = true; $loginValid = true;
} }
@@ -672,9 +672,9 @@ class Users implements ControllerProviderInterface
$mailToAdd = $value; $mailToAdd = $value;
if ($mailToAdd === "") { 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)) { } 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 { } else {
$mailValid = true; $mailValid = true;
} }
@@ -684,7 +684,7 @@ class Users implements ControllerProviderInterface
$passwordToVerif = $value; $passwordToVerif = $value;
if ($passwordToVerif === "") { 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 { } else {
$pwdValid = true; $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); $usr_id = $app['auth.native']->getUsrId($request->get("login"), $request->get("password"), $request);
if (null === $usr_id) { 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'); 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 if ($oAuth2App->get_client_id() == \API_OAuth2_Application_Navigator::CLIENT_ID
&& !$app['phraseanet.registry']->get('GV_client_navigator')) { && !$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 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) public function getClientLanguage(Application $app, Request $request)
{ {
$out = []; $out = [];
$out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?'); $out['createWinInvite'] = $app->trans('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['chuNameEmpty'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?'); $out['chuNameEmpty'] = $app->trans('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['noDLok'] = _('export:: aucun document n\'est disponible au telechargement'); $out['noDLok'] = $app->trans('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['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['serverName'] = $app['phraseanet.registry']->get('GV_ServerName');
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique'); $out['serverError'] = $app->trans('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['serverTimeout'] = $app->trans('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); $out['serverDisconnected'] = $app->trans('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['confirmDelBasket'] = $app->trans('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
$out['annuler'] = _('boutton::annuler'); $out['annuler'] = $app->trans('boutton::annuler');
$out['fermer'] = _('boutton::fermer'); $out['fermer'] = $app->trans('boutton::fermer');
$out['renewRss'] = _('boutton::renouveller'); $out['renewRss'] = $app->trans('boutton::renouveller');
$out['print'] = _('Print'); $out['print'] = $app->trans('Print');
$out['no_basket'] = _('Please create a basket before adding an element'); $out['no_basket'] = $app->trans('Please create a basket before adding an element');
return $app->json($out); return $app->json($out);
} }
@@ -246,7 +246,7 @@ class Root implements ControllerProviderInterface
$renderTopics = ''; $renderTopics = '';
if ($app['phraseanet.registry']->get('GV_client_render_topics') == 'popups') { 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') { } elseif ($app['phraseanet.registry']->get('GV_client_render_topics') == 'tree') {
$renderTopics = \queries::tree_topics($app['locale.I18n']); $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'))) { 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'); return $app->redirectPath('homepage');
} }
@@ -238,7 +238,7 @@ class Lightbox implements ControllerProviderInterface
'basket' => $basket, 'basket' => $basket,
'local_title' => strip_tags($basket->getName()), 'local_title' => strip_tags($basket->getName()),
'module' => 'lightbox', 'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation') 'module_name' => $app->trans('admin::monitor: module validation')
] ]
)); ));
$response->setCharset('UTF-8'); $response->setCharset('UTF-8');
@@ -285,7 +285,7 @@ class Lightbox implements ControllerProviderInterface
'basket' => $basket, 'basket' => $basket,
'local_title' => strip_tags($basket->getName()), 'local_title' => strip_tags($basket->getName()),
'module' => 'lightbox', 'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation') 'module_name' => $app->trans('admin::monitor: module validation')
] ]
)); ));
$response->setCharset('UTF-8'); $response->setCharset('UTF-8');
@@ -319,7 +319,7 @@ class Lightbox implements ControllerProviderInterface
'first_item' => $first, 'first_item' => $first,
'local_title' => $feed_entry->getTitle(), 'local_title' => $feed_entry->getTitle(),
'module' => 'lightbox', 'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation') 'module_name' => $app->trans('admin::monitor: module validation')
] ]
); );
$response = new Response($output, 200); $response = new Response($output, 200);
@@ -337,7 +337,7 @@ class Lightbox implements ControllerProviderInterface
->assert('basket', '\d+'); ->assert('basket', '\d+');
$controllers->post('/ajax/SET_NOTE/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) { $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']; $request = $app['request'];
$note = $request->request->get('note'); $note = $request->request->get('note');
@@ -390,7 +390,7 @@ class Lightbox implements ControllerProviderInterface
$ret = [ $ret = [
'error' => true, 'error' => true,
'releasable' => false, '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'); $repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
@@ -420,7 +420,7 @@ class Lightbox implements ControllerProviderInterface
$releasable = false; $releasable = false;
if ($participant->isReleasable() === true) { if ($participant->isReleasable() === true) {
$releasable = _('Do you want to send your report ?'); $releasable = $app->trans('Do you want to send your report ?');
} }
$ret = [ $ret = [
@@ -459,7 +459,7 @@ class Lightbox implements ControllerProviderInterface
} }
if (!$agreed) { 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 */ /* @var $basket Basket */
@@ -488,7 +488,7 @@ class Lightbox implements ControllerProviderInterface
$app['EM']->merge($participant); $app['EM']->merge($participant);
$app['EM']->flush(); $app['EM']->flush();
$datas = ['error' => false, 'datas' => _('Envoie avec succes')]; $datas = ['error' => false, 'datas' => $app->trans('Envoie avec succes')];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$datas = ['error' => true, 'datas' => $e->getMessage()]; $datas = ['error' => true, 'datas' => $e->getMessage()];
} }

View File

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

View File

@@ -178,9 +178,9 @@ class Bridge implements ControllerProviderInterface
$account->delete(); $account->delete();
$success = true; $success = true;
} catch (\Bridge_Exception_AccountNotFound $e) { } catch (\Bridge_Exception_AccountNotFound $e) {
$message = _('Account is not found.'); $message = $app->trans('Account is not found.');
} catch (\Exception $e) { } 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]); return $app->json(['success' => $success, 'message' => $message]);
@@ -274,7 +274,7 @@ class Bridge implements ControllerProviderInterface
'account_id' => $account_id, 'account_id' => $account_id,
'type' => $element_type, 'type' => $element_type,
'page' => '', '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) { foreach ($elements as $element_id) {
@@ -295,7 +295,7 @@ class Bridge implements ControllerProviderInterface
break; break;
default: 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; break;
} }
@@ -333,7 +333,7 @@ class Bridge implements ControllerProviderInterface
switch ($action) { switch ($action) {
case 'modify': case 'modify':
if (count($elements) != 1) { 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 { try {
foreach ($elements as $element_id) { foreach ($elements as $element_id) {
@@ -350,7 +350,7 @@ class Bridge implements ControllerProviderInterface
'action' => $action, 'action' => $action,
'elements' => $elements, 'elements' => $elements,
'adapter_action' => $action, 'adapter_action' => $action,
'error_message' => _('Request contains invalid datas'), 'error_message' => $app->trans('Request contains invalid datas'),
'constraint_errors' => $errors, 'constraint_errors' => $errors,
'notice_message' => $request->request->get('notice'), 'notice_message' => $request->request->get('notice'),
]; ];
@@ -451,7 +451,7 @@ class Bridge implements ControllerProviderInterface
$params = [ $params = [
'route' => $route, 'route' => $route,
'account' => $account, 'account' => $account,
'error_message' => _('Request contains invalid datas'), 'error_message' => $app->trans('Request contains invalid datas'),
'constraint_errors' => $errors, 'constraint_errors' => $errors,
'notice_message' => $request->request->get('notice'), 'notice_message' => $request->request->get('notice'),
'adapter_action' => 'upload', '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); \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( return new Response($app['twig']->render(
'/prod/actions/Download/prepare.html.twig', [ '/prod/actions/Download/prepare.html.twig', [
'module_name' => _('Export'), 'module_name' => $app->trans('Export'),
'module' => _('Export'), 'module' => $app->trans('Export'),
'list' => $list, 'list' => $list,
'records' => $records, 'records' => $records,
'token' => $token, 'token' => $token,

View File

@@ -55,25 +55,27 @@ class Edit implements ControllerProviderInterface
$separator = $meta->get_separator(); $separator = $meta->get_separator();
/** @Ignore */
$JSFields[$meta->get_id()] = [ $JSFields[$meta->get_id()] = [
'meta_struct_id' => $meta->get_id() 'meta_struct_id' => $meta->get_id(),
, 'name' => $meta->get_name() 'name' => $meta->get_name(),
, '_status' => 0 '_status' => 0,
, '_value' => '' '_value' => '',
, '_sgval' => [] '_sgval' => [],
, 'required' => $meta->is_required() 'required' => $meta->is_required(),
, 'label' => $meta->get_label($app['locale.I18n']) /** @Ignore */
, 'readonly' => $meta->is_readonly() 'label' => $meta->get_label($app['locale.I18n']),
, 'type' => $meta->get_type() 'readonly' => $meta->is_readonly(),
, 'format' => '' 'type' => $meta->get_type(),
, 'explain' => '' 'format' => '',
, 'tbranch' => $meta->get_tbranch() 'explain' => '',
, 'maxLength' => $meta->get_tag()->getMaxLength() 'tbranch' => $meta->get_tbranch(),
, 'minLength' => $meta->get_tag()->getMinLength() 'maxLength' => $meta->get_tag()->getMaxLength(),
, 'multi' => $meta->is_multi() 'minLength' => $meta->get_tag()->getMinLength(),
, 'separator' => $separator 'multi' => $meta->is_multi(),
, 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null 'separator' => $separator,
, 'vocabularyRestricted' => $meta->getVocabularyControl() ? $meta->isVocabularyRestricted() : false 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null,
'vocabularyRestricted' => $meta->getVocabularyControl() ? $meta->isVocabularyRestricted() : false,
]; ];
if (trim($meta->get_tbranch()) !== '') { if (trim($meta->get_tbranch()) !== '') {
@@ -237,7 +239,7 @@ class Edit implements ControllerProviderInterface
$VC = VocabularyController::get($app, $vocabulary); $VC = VocabularyController::get($app, $vocabulary);
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
} catch (\Exception $e) { } catch (\Exception $e) {
$datas['message'] = _('Vocabulary not found'); $datas['message'] = $app->trans('Vocabulary not found');
return $app->json($datas); 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 = $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->login($request->request->get('login', 'anonymous'), $request->request->get('password', 'anonymous'));
$ftpClient->close(); $ftpClient->close();
$msg = _('Connection to FTP succeed'); $msg = $app->trans('Connection to FTP succeed');
$success = true; $success = true;
} catch (\Exception $e) { } catch (\Exception $e) {
$msg = sprintf(_('Error while connecting to FTP')); $msg = $app->trans('Error while connecting to FTP');
} }
return $app->json([ return $app->json([
@@ -127,7 +127,7 @@ class Export implements ControllerProviderInterface
if (count($download->get_display_ftp()) == 0) { if (count($download->get_display_ftp()) == 0) {
return $app->json([ return $app->json([
'success' => false, '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([ return $app->json([
'success' => true, 'success' => true,
'message' => _('Export saved in the waiting queue') 'message' => $app->trans('Export saved in the waiting queue')
]); ]);
} catch (\Exception $e) { } catch (\Exception $e) {
return $app->json([ return $app->json([
'success' => false, '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'); $app->abort(404, 'Entry not found');
} }
if (!$entry->isPublisher($app['authentication']->getUser()) && $entry->getFeed()->isOwner($app['authentication']->getUser()) === false) { 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); $app['EM']->remove($entry);
@@ -245,10 +245,10 @@ class Feed implements ControllerProviderInterface
); );
$output = [ $output = [
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') 'texte' => '<p>' . $app->trans('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> . '</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>', <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); 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); $link = $app['feed.user-link-generator']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS, null, $renew);
$output = [ $output = [
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') 'texte' => '<p>' . $app->trans('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> . '</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>', <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); return $app->json($output);

View File

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

View File

@@ -113,7 +113,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile LazaretFile */ /* @var $lazaretFile LazaretFile */
if (null === $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); return $app->json($ret);
} }
@@ -157,7 +157,7 @@ class Lazaret implements ControllerProviderInterface
//Mandatory parameter //Mandatory parameter
if (null === $request->request->get('bas_id')) { 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); return $app->json($ret);
} }
@@ -166,7 +166,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile LazaretFile */ /* @var $lazaretFile LazaretFile */
if (null === $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); return $app->json($ret);
} }
@@ -246,7 +246,7 @@ class Lazaret implements ControllerProviderInterface
$ret['success'] = true; $ret['success'] = true;
} catch (\Exception $e) { } catch (\Exception $e) {
$ret['message'] = _('An error occured'); $ret['message'] = $app->trans('An error occured');
} }
try { try {
@@ -274,7 +274,7 @@ class Lazaret implements ControllerProviderInterface
$lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id); $lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id);
/* @var $lazaretFile LazaretFile */ /* @var $lazaretFile LazaretFile */
if (null === $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); return $app->json($ret);
} }
@@ -330,7 +330,7 @@ class Lazaret implements ControllerProviderInterface
$ret['success'] = true; $ret['success'] = true;
} catch (\Exception $e) { } catch (\Exception $e) {
$app['EM']->rollback(); $app['EM']->rollback();
$ret['message'] = _('An error occured'); $ret['message'] = $app->trans('An error occured');
} }
return $app->json($ret); return $app->json($ret);
@@ -351,7 +351,7 @@ class Lazaret implements ControllerProviderInterface
//Mandatory parameter //Mandatory parameter
if (null === $recordId = $request->request->get('record_id')) { 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); return $app->json($ret);
} }
@@ -360,7 +360,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile LazaretFile */ /* @var $lazaretFile LazaretFile */
if (null === $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); return $app->json($ret);
} }
@@ -378,7 +378,7 @@ class Lazaret implements ControllerProviderInterface
} }
if (!$found) { 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); return $app->json($ret);
} }
@@ -404,7 +404,7 @@ class Lazaret implements ControllerProviderInterface
$ret['success'] = true; $ret['success'] = true;
} catch (\Exception $e) { } catch (\Exception $e) {
$ret['message'] = _('An error occured'); $ret['message'] = $app->trans('An error occured');
} }
try { try {

View File

@@ -70,13 +70,13 @@ class MoveCollection implements ControllerProviderInterface
try { try {
if (null === $request->request->get('base_id')) { if (null === $request->request->get('base_id')) {
$datas['message'] = _('Missing target collection'); $datas['message'] = $app->trans('Missing target collection');
return $app->json($datas); return $app->json($datas);
} }
if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) { 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); return $app->json($datas);
} }
@@ -84,7 +84,7 @@ class MoveCollection implements ControllerProviderInterface
try { try {
$collection = \collection::get_from_base_id($app, $request->request->get('base_id')); $collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
} catch (\Exception_Databox_CollectionNotFound $e) { } catch (\Exception_Databox_CollectionNotFound $e) {
$datas['message'] = _('Invalid target collection'); $datas['message'] = $app->trans('Invalid target collection');
return $app->json($datas); return $app->json($datas);
} }
@@ -103,12 +103,12 @@ class MoveCollection implements ControllerProviderInterface
$ret = [ $ret = [
'success' => true, 'success' => true,
'message' => _('Records have been successfuly moved'), 'message' => $app->trans('Records have been successfuly moved'),
]; ];
} catch (\Exception $e) { } catch (\Exception $e) {
$ret = [ $ret = [
'success' => false, 'success' => false,
'message' => _('An error occured'), 'message' => $app->trans('An error occured'),
]; ];
} }

View File

@@ -135,7 +135,7 @@ class Order implements ControllerProviderInterface
}); });
if ($noAdmins) { 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()); $order->setTodo($order->getElements()->count());
@@ -154,12 +154,12 @@ class Order implements ControllerProviderInterface
} }
if ($success) { if ($success) {
$msg = _('The records have been properly ordered'); $msg = $app->trans('The records have been properly ordered');
} else { } else {
$msg = _('An error occured'); $msg = $app->trans('An error occured');
} }
} else { } 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()) { if ('json' === $app['request']->getRequestFormat()) {
@@ -247,7 +247,7 @@ class Order implements ControllerProviderInterface
if (null === $basket) { if (null === $basket) {
$basket = new 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->setOwner($dest_user);
$basket->setPusher($app['authentication']->getUser()); $basket->setPusher($app['authentication']->getUser());
@@ -301,7 +301,7 @@ class Order implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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 'order_id' => $order_id
]); ]);
} }
@@ -361,7 +361,7 @@ class Order implements ControllerProviderInterface
if ('json' === $app['request']->getRequestFormat()) { if ('json' === $app['request']->getRequestFormat()) {
return $app->json([ return $app->json([
'success' => $success, '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 'order_id' => $order_id
]); ]);
} }

View File

@@ -154,30 +154,30 @@ class Push implements ControllerProviderInterface
$ret = [ $ret = [
'success' => false, 'success' => false,
'message' => _('Unable to send the documents') 'message' => $app->trans('Unable to send the documents')
]; ];
try { try {
$pusher = new RecordHelper\Push($app, $app['request']); $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'); $push_description = $request->request->get('push_description');
$receivers = $request->request->get('participants'); $receivers = $request->request->get('participants');
if (!is_array($receivers) || count($receivers) === 0) { 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) { 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) { foreach ($receivers as $receiver) {
try { try {
$user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $app); $user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $app);
} catch (\Exception $e) { } 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(); $Basket = new Basket();
@@ -247,11 +247,10 @@ class Push implements ControllerProviderInterface
$app['EM']->flush(); $app['EM']->flush();
$message = sprintf( $message = $app->trans('%quantity_records% records have been sent to %quantity_users% users', array(
_('%1$d records have been sent to %2$d users') '%quantity_records%' => count($pusher->get_elements()),
, count($pusher->get_elements()) '%quantity_users%' => count($receivers),
, count($receivers) ));
);
$ret = [ $ret = [
'success' => true, 'success' => true,
@@ -269,7 +268,7 @@ class Push implements ControllerProviderInterface
$ret = [ $ret = [
'success' => false, 'success' => false,
'message' => _('Unable to send the documents') 'message' => $app->trans('Unable to send the documents')
]; ];
$app['EM']->beginTransaction(); $app['EM']->beginTransaction();
@@ -279,17 +278,17 @@ class Push implements ControllerProviderInterface
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket'); $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'); $validation_description = $request->request->get('validation_description');
$participants = $request->request->get('participants'); $participants = $request->request->get('participants');
if (!is_array($participants) || count($participants) === 0) { 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) { 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()) { if ($pusher->is_basket()) {
@@ -355,13 +354,13 @@ class Push implements ControllerProviderInterface
foreach ($participants as $key => $participant) { foreach ($participants as $key => $participant) {
foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) { foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) {
if (!array_key_exists($mandatoryparam, $participant)) 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 { try {
$participant_user = \User_Adapter::getInstance($participant['usr_id'], $app); $participant_user = \User_Adapter::getInstance($participant['usr_id'], $app);
} catch (\Exception $e) { } 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 { try {
@@ -446,11 +445,10 @@ class Push implements ControllerProviderInterface
$app['EM']->flush(); $app['EM']->flush();
$message = sprintf( $message = $app->trans('%quantity_records% records have been sent for validation to %quantity_users% users', array(
_('%1$d records have been sent for validation to %2$d users') '%quantity_records%' => count($pusher->get_elements()),
, count($pusher->get_elements()) '%quantity_users%' => count($request->request->get('participants')),
, count($request->request->get('participants')) ));
);
$ret = [ $ret = [
'success' => true, 'success' => true,
@@ -511,19 +509,19 @@ class Push implements ControllerProviderInterface
try { try {
if (!$app['acl']->get($app['authentication']->getUser())->has_right('manageusers')) 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')) 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')) 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')) 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'))) 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) { } catch (ControllerException $e) {
$result['message'] = $e->getMessage(); $result['message'] = $e->getMessage();
@@ -537,7 +535,7 @@ class Push implements ControllerProviderInterface
$usr_id = \User_Adapter::get_usr_id_from_email($app, $email); $usr_id = \User_Adapter::get_usr_id_from_email($app, $email);
$user = \User_Adapter::getInstance($usr_id, $app); $user = \User_Adapter::getInstance($usr_id, $app);
$result['message'] = _('User already exists'); $result['message'] = $app->trans('User already exists');
$result['success'] = true; $result['success'] = true;
$result['user'] = $userFormatter($user); $result['user'] = $userFormatter($user);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -560,11 +558,11 @@ class Push implements ControllerProviderInterface
if ($request->request->get('form_geonameid')) if ($request->request->get('form_geonameid'))
$user->set_geonameid($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['success'] = true;
$result['user'] = $userFormatter($user); $result['user'] = $userFormatter($user);
} catch (\Exception $e) { } 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>"; $explain .= "<img src=\"/skins/icons/answers.gif\" /><span><b>";
if ($result->getTotal() != $result->getAvailable()) { 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 { } else {
$explain .= sprintf(_('reponses:: %d Resultats'), $result->getTotal()); $explain .= $app->trans('reponses:: %total% Resultats', array('%total%' => $result->getTotal()));
} }
$explain .= " </b></span>"; $explain .= " </b></span>";
$explain .= '<br><div>' . $result->getDuration() . ' s</div>dans index ' . $result->getIndexes(); $explain .= '<br><div>' . $result->getDuration() . ' s</div>dans index ' . $result->getIndexes();
$explain .= "</div>"; $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['infos'] = $infoResult;
$json['navigation'] = $string; $json['navigation'] = $string;

View File

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

View File

@@ -87,7 +87,7 @@ class Story implements ControllerProviderInterface
if ($request->getRequestFormat() == 'json') { if ($request->getRequestFormat() == 'json') {
$data = [ $data = [
'success' => true 'success' => true
, 'message' => _('Story created') , 'message' => $app->trans('Story created')
, 'WorkZone' => $StoryWZ->getId() , 'WorkZone' => $StoryWZ->getId()
, 'story' => [ , 'story' => [
'sbas_id' => $Story->get_sbas_id(), 'sbas_id' => $Story->get_sbas_id(),
@@ -136,7 +136,7 @@ class Story implements ControllerProviderInterface
$data = [ $data = [
'success' => true 'success' => true
, 'message' => sprintf(_('%d records added'), $n) , 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n))
]; ];
if ($request->getRequestFormat() == 'json') { if ($request->getRequestFormat() == 'json') {
@@ -158,7 +158,7 @@ class Story implements ControllerProviderInterface
$data = [ $data = [
'success' => true 'success' => true
, 'message' => _('Record removed from story') , 'message' => $app->trans('Record removed from story')
]; ];
if ($request->getRequestFormat() == 'json') { if ($request->getRequestFormat() == 'json') {
@@ -195,7 +195,7 @@ class Story implements ControllerProviderInterface
->assert('record_id', '\d+'); ->assert('record_id', '\d+');
$controllers->post('/{sbas_id}/{record_id}/reorder/', function (Application $app, $sbas_id, $record_id) { $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 { try {
$story = new \record_adapter($app, $sbas_id, $record_id); $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')) { 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 $sql = 'UPDATE regroup SET ord = :ord
@@ -223,7 +223,7 @@ class Story implements ControllerProviderInterface
$stmt->closeCursor(); $stmt->closeCursor();
$ret = ['success' => true, 'message' => _('Story updated')]; $ret = ['success' => true, 'message' => $app->trans('Story updated')];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$ret = ['success' => false, 'message' => $e->getMessage()]; $ret = ['success' => false, 'message' => $e->getMessage()];
} catch (\Exception $e) { } catch (\Exception $e) {

View File

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

View File

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

View File

@@ -153,13 +153,13 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => false '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 , 'list_id' => null
]; ];
try { try {
if (!$list_name) { if (!$list_name) {
throw new ControllerException(_('List name is required')); throw new ControllerException($app->trans('List name is required'));
} }
$List = new UsrList(); $List = new UsrList();
@@ -178,7 +178,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true '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() , 'list_id' => $List->getId()
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
@@ -243,14 +243,14 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => false 'success' => false
, 'message' => _('Unable to update list') , 'message' => $app->trans('Unable to update list')
]; ];
try { try {
$list_name = $request->request->get('name'); $list_name = $request->request->get('name');
if (!$list_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'); $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); $list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) { 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); $list->setName($list_name);
@@ -267,7 +267,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => _('List has been updated') , 'message' => $app->trans('List has been updated')
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$datas = [ $datas = [
@@ -289,7 +289,7 @@ class UsrLists implements ControllerProviderInterface
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id); $list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) { 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); $app['EM']->remove($list);
@@ -297,7 +297,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => sprintf(_('List has been deleted')) , 'message' => $app->trans('List has been deleted')
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$datas = [ $datas = [
@@ -308,7 +308,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => false '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 */ /* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) { 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'); $entry_repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrListEntry');
@@ -336,7 +336,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => _('Entry removed from list') , 'message' => $app->trans('Entry removed from list')
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$datas = [ $datas = [
@@ -344,10 +344,9 @@ class UsrLists implements ControllerProviderInterface
, 'message' => $e->getMessage() , 'message' => $e->getMessage()
]; ];
} catch (\Exception $e) { } catch (\Exception $e) {
$datas = [ $datas = [
'success' => false 'success' => false,
, 'message' => _('Unable to remove entry from list ' . $e->getMessage()) 'message' => $app->trans('Unable to remove entry from list'),
]; ];
} }
@@ -367,7 +366,7 @@ class UsrLists implements ControllerProviderInterface
/* @var $list UsrList */ /* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) { 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 = []; $inserted_usr_ids = [];
@@ -394,13 +393,13 @@ class UsrLists implements ControllerProviderInterface
if (count($inserted_usr_ids) > 1) { if (count($inserted_usr_ids) > 1) {
$datas = [ $datas = [
'success' => true '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 , 'result' => $inserted_usr_ids
]; ];
} else { } else {
$datas = [ $datas = [
'success' => true '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 , 'result' => $inserted_usr_ids
]; ];
} }
@@ -413,7 +412,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => false '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) { if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
$list = null; $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) { } catch (\Exception $e) {
@@ -461,7 +460,7 @@ class UsrLists implements ControllerProviderInterface
/* @var $list UsrList */ /* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) { 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); $new_owner = \User_Adapter::getInstance($usr_id, $app);
@@ -490,7 +489,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => _('List shared to user') , 'message' => $app->trans('List shared to user')
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$datas = [ $datas = [
@@ -501,7 +500,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => false '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 */ /* @var $list UsrList */
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) { 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'); $owners_repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrListOwner');
@@ -529,7 +528,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => _('Owner removed from list') , 'message' => $app->trans('Owner removed from list')
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
$datas = [ $datas = [
@@ -539,7 +538,7 @@ class UsrLists implements ControllerProviderInterface
} catch (\Exception $e) { } catch (\Exception $e) {
$datas = [ $datas = [
'success' => false '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 ($alreadyFixed === 0) {
if ($done <= 1) { if ($done <= 1) {
$message = sprintf( $message = $app->trans('%quantity% Story attached to the WorkZone', array('%quantity%' => $done));
_('%d Story attached to the WorkZone')
, $done
);
} else { } else {
$message = sprintf( $message = $app->trans('%quantity% Stories attached to the WorkZone', array('%quantity%' => $done));
_('%d Stories attached to the WorkZone')
, $done
);
} }
} else { } else {
if ($done <= 1) { if ($done <= 1) {
$message = sprintf( $message = $app->trans('%quantity% Story attached to the WorkZone, %quantity_already% already attached', array('%quantity%' => $done, '%quantity_already%' => $alreadyFixed));
_('%1$d Story attached to the WorkZone, %2$d already attached')
, $done
, $alreadyFixed
);
} else { } else {
$message = sprintf( $message = $app->trans('%quantity% Stories attached to the WorkZone, %quantity_already% already attached', array('%quantity%' => $done, '%quantity_already%' => $alreadyFixed));
_('%1$d Stories attached to the WorkZone, %2$d already attached')
, $done
, $alreadyFixed
);
} }
} }
@@ -200,7 +186,6 @@ class WorkZone implements ControllerProviderInterface
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\StoryWZ'); $repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\StoryWZ');
/* @var $repository Alchemy\Phrasea\Model\Repositories\StoryWZRepository */
$StoryWZ = $repository->findUserStory($app, $app['authentication']->getUser(), $Story); $StoryWZ = $repository->findUserStory($app, $app['authentication']->getUser(), $Story);
if (!$StoryWZ) { if (!$StoryWZ) {
@@ -213,7 +198,7 @@ class WorkZone implements ControllerProviderInterface
if ($request->getRequestFormat() == 'json') { if ($request->getRequestFormat() == 'json') {
return $app->json([ return $app->json([
'success' => true '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) public function doReportDownloadsByUsers(Application $app, Request $request)
{ {
$conf = [ $conf = [
'user' => [_('report:: utilisateur'), 0, 1, 0, 0], 'user' => [$app->trans('report:: utilisateur'), 0, 1, 0, 0],
'nbdoc' => [_('report:: nombre de documents'), 0, 0, 0, 0], 'nbdoc' => [$app->trans('report:: nombre de documents'), 0, 0, 0, 0],
'poiddoc' => [_('report:: poids des documents'), 0, 0, 0, 0], 'poiddoc' => [$app->trans('report:: poids des documents'), 0, 0, 0, 0],
'nbprev' => [_('report:: nombre de preview'), 0, 0, 0, 0], 'nbprev' => [$app->trans('report:: nombre de preview'), 0, 0, 0, 0],
'poidprev' => [_('report:: poids des previews'), 0, 0, 0, 0] 'poidprev' => [$app->trans('report:: poids des previews'), 0, 0, 0, 0]
]; ];
$activity = new \module_report_activity( $activity = new \module_report_activity(
@@ -198,9 +198,9 @@ class Activity implements ControllerProviderInterface
public function doReportBestOfQuestions(Application $app, Request $request) public function doReportBestOfQuestions(Application $app, Request $request)
{ {
$conf = [ $conf = [
'search' => [_('report:: question'), 0, 0, 0, 0], 'search' => [$app->trans('report:: question'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [_('report:: nombre de reponses'), 0, 0, 0, 0] 'nb_rep' => [$app->trans('report:: nombre de reponses'), 0, 0, 0, 0]
]; ];
$activity = new \module_report_activity( $activity = new \module_report_activity(
@@ -256,9 +256,9 @@ class Activity implements ControllerProviderInterface
public function doReportNoBestOfQuestions(Application $app, Request $request) public function doReportNoBestOfQuestions(Application $app, Request $request)
{ {
$conf = [ $conf = [
'search' => [_('report:: question'), 0, 0, 0, 0], 'search' => [$app->trans('report:: question'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [_('report:: nombre de reponses'), 0, 0, 0, 0] 'nb_rep' => [$app->trans('report:: nombre de reponses'), 0, 0, 0, 0]
]; ];
$activity = new \module_report_activity( $activity = new \module_report_activity(
@@ -369,10 +369,10 @@ class Activity implements ControllerProviderInterface
public function doReportSiteActiviyPerDays(Application $app, Request $request) public function doReportSiteActiviyPerDays(Application $app, Request $request)
{ {
$conf = [ $conf = [
'ddate' => [_('report:: jour'), 0, 0, 0, 0], 'ddate' => [$app->trans('report:: jour'), 0, 0, 0, 0],
'total' => [_('report:: total des telechargements'), 0, 0, 0, 0], 'total' => [$app->trans('report:: total des telechargements'), 0, 0, 0, 0],
'preview' => [_('report:: preview'), 0, 0, 0, 0], 'preview' => [$app->trans('report:: preview'), 0, 0, 0, 0],
'document' => [_('report:: document original'), 0, 0, 0, 0] 'document' => [$app->trans('report:: document original'), 0, 0, 0, 0]
]; ];
$activity = new \module_report_activity( $activity = new \module_report_activity(
@@ -700,7 +700,7 @@ class Activity implements ControllerProviderInterface
'record_id' => ['', 1, 1, 1, 1], 'record_id' => ['', 1, 1, 1, 1],
'file' => ['', 1, 0, 1, 1], 'file' => ['', 1, 0, 1, 1],
'mime' => ['', 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( $activity = new \module_report_sent(
@@ -792,7 +792,7 @@ class Activity implements ControllerProviderInterface
if ($request->request->get('conf') == 'on') { if ($request->request->get('conf') == 'on') {
return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [ return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [
'conf' => $base_conf 'conf' => $base_conf
]), "title" => _("configuration")]); ]), "title" => $app->trans("configuration")]);
} }
//set order //set order
@@ -819,7 +819,7 @@ class Activity implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field), 'result' => $report->colFilter($field),
'field' => $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) { if ($field === $value) {
@@ -864,7 +864,7 @@ class Activity implements ControllerProviderInterface
'is_doc' => false 'is_doc' => false
]), ]),
'display_nav' => 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 = [ $conf = [
'config' => [ 'config' => [
'photo' => [_('report:: document'), 0, 0, 0, 0], 'photo' => [$app->trans('report:: document'), 0, 0, 0, 0],
'record_id' => [_('report:: record id'), 0, 0, 0, 0], 'record_id' => [$app->trans('report:: record id'), 0, 0, 0, 0],
'date' => [_('report:: date'), 0, 0, 0, 0], 'date' => [$app->trans('report:: date'), 0, 0, 0, 0],
'type' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], 'type' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [_('report:: titre'), 0, 0, 0, 0], 'titre' => [$app->trans('report:: titre'), 0, 0, 0, 0],
'taille' => [_('report:: poids'), 0, 0, 0, 0] 'taille' => [$app->trans('report:: poids'), 0, 0, 0, 0]
], ],
'conf' => [ 'conf' => [
'identifiant' => [_('report:: identifiant'), 0, 0, 0, 0], 'identifiant' => [$app->trans('report:: identifiant'), 0, 0, 0, 0],
'nom' => [_('report:: nom'), 0, 0, 0, 0], 'nom' => [$app->trans('report:: nom'), 0, 0, 0, 0],
'mail' => [_('report:: email'), 0, 0, 0, 0], 'mail' => [$app->trans('report:: email'), 0, 0, 0, 0],
'adresse' => [_('report:: adresse'), 0, 0, 0, 0], 'adresse' => [$app->trans('report:: adresse'), 0, 0, 0, 0],
'tel' => [_('report:: telephone'), 0, 0, 0, 0] 'tel' => [$app->trans('report:: telephone'), 0, 0, 0, 0]
], ],
'config_cnx' => [ 'config_cnx' => [
'ddate' => [_('report:: date'), 0, 0, 0, 0], 'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0],
'appli' => [_('report:: modules'), 0, 0, 0, 0], 'appli' => [$app->trans('report:: modules'), 0, 0, 0, 0],
], ],
'config_dl' => [ 'config_dl' => [
'ddate' => [_('report:: date'), 0, 0, 0, 0], 'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0],
'record_id' => [_('report:: record id'), 0, 1, 0, 0], 'record_id' => [$app->trans('report:: record id'), 0, 1, 0, 0],
'final' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], 'final' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [_('report:: collections'), 0, 0, 0, 0], 'coll_id' => [$app->trans('report:: collections'), 0, 0, 0, 0],
'comment' => [_('report:: commentaire'), 0, 0, 0, 0], 'comment' => [$app->trans('report:: commentaire'), 0, 0, 0, 0],
], ],
'config_ask' => [ 'config_ask' => [
'search' => [_('report:: question'), 0, 0, 0, 0], 'search' => [$app->trans('report:: question'), 0, 0, 0, 0],
'ddate' => [_('report:: date'), 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) { if ('' !== $on && $app['phraseanet.registry']->get('GV_anonymousReport') == true) {
$conf['conf'] = [ $conf['conf'] = [
$on => [$on, 0, 0, 0, 0], $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' $request->request->get('collection'
)); ));
$conf_array = $conf['config_cnx']; $conf_array = $conf['config_cnx'];
$title = _('report:: historique des connexions'); $title = $app->trans('report:: historique des connexions');
} elseif ($from == 'USR' || $from == 'GEN') { } elseif ($from == 'USR' || $from == 'GEN') {
$report = new \module_report_download( $report = new \module_report_download(
$app, $app,
@@ -119,7 +119,7 @@ class Informations implements ControllerProviderInterface
$request->request->get('collection') $request->request->get('collection')
); );
$conf_array = $conf['config_dl']; $conf_array = $conf['config_dl'];
$title = _('report:: historique des telechargements'); $title = $app->trans('report:: historique des telechargements');
} elseif ($from == 'ASK') { } elseif ($from == 'ASK') {
$report = new \module_report_question( $report = new \module_report_question(
$app, $app,
@@ -129,7 +129,7 @@ class Informations implements ControllerProviderInterface
$request->request->get('collection') $request->request->get('collection')
); );
$conf_array = $conf['config_ask']; $conf_array = $conf['config_ask'];
$title = _('report:: historique des questions'); $title = $app->trans('report:: historique des questions');
} }
if ($report) { if ($report) {
@@ -151,7 +151,7 @@ class Informations implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field), 'result' => $report->colFilter($field),
'field' => $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) { if ($field === $value) {
@@ -252,8 +252,8 @@ class Informations implements ControllerProviderInterface
public function doReportinformationsBrowser(Application $app, Request $request) public function doReportinformationsBrowser(Application $app, Request $request)
{ {
$conf = [ $conf = [
'version' => [_('report::version '), 0, 0, 0, 0], 'version' => [$app->trans('report::version'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0] 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0]
]; ];
$info = new \module_report_nav( $info = new \module_report_nav(
@@ -297,24 +297,24 @@ class Informations implements ControllerProviderInterface
public function doReportInformationsDocument(Application $app, Request $request) public function doReportInformationsDocument(Application $app, Request $request)
{ {
$config = [ $config = [
'photo' => [_('report:: document'), 0, 0, 0, 0], 'photo' => [$app->trans('report:: document'), 0, 0, 0, 0],
'record_id' => [_('report:: record id'), 0, 0, 0, 0], 'record_id' => [$app->trans('report:: record id'), 0, 0, 0, 0],
'date' => [_('report:: date'), 0, 0, 0, 0], 'date' => [$app->trans('report:: date'), 0, 0, 0, 0],
'type' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], 'type' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [_('report:: titre'), 0, 0, 0, 0], 'titre' => [$app->trans('report:: titre'), 0, 0, 0, 0],
'taille' => [_('report:: poids'), 0, 0, 0, 0] 'taille' => [$app->trans('report:: poids'), 0, 0, 0, 0]
]; ];
$config_dl = [ $config_dl = [
'ddate' => [_('report:: date'), 0, 0, 0, 0], 'ddate' => [$app->trans('report:: date'), 0, 0, 0, 0],
'user' => [_('report:: utilisateurs'), 0, 0, 0, 0], 'user' => [$app->trans('report:: utilisateurs'), 0, 0, 0, 0],
'final' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], 'final' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [_('report:: collections'), 0, 0, 0, 0], 'coll_id' => [$app->trans('report:: collections'), 0, 0, 0, 0],
'comment' => [_('report:: commentaire'), 0, 0, 0, 0], 'comment' => [$app->trans('report:: commentaire'), 0, 0, 0, 0],
'fonction' => [_('report:: fonction'), 0, 0, 0, 0], 'fonction' => [$app->trans('report:: fonction'), 0, 0, 0, 0],
'activite' => [_('report:: activite'), 0, 0, 0, 0], 'activite' => [$app->trans('report:: activite'), 0, 0, 0, 0],
'pays' => [_('report:: pays'), 0, 0, 0, 0], 'pays' => [$app->trans('report:: pays'), 0, 0, 0, 0],
'societe' => [_('report:: societe'), 0, 0, 0, 0] 'societe' => [$app->trans('report:: societe'), 0, 0, 0, 0]
]; ];
//format conf according user preferences //format conf according user preferences
@@ -409,7 +409,7 @@ class Informations implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $download->colFilter($field), 'result' => $download->colFilter($field),
'field' => $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) { if ($field === $value) {
@@ -423,7 +423,7 @@ class Informations implements ControllerProviderInterface
$download->setFilter($filter->getTabFilter()); $download->setFilter($filter->getTabFilter());
$download->setOrder('ddate', 'DESC'); $download->setOrder('ddate', 'DESC');
$download->setTitle(_('report:: historique des telechargements')); $download->setTitle($app->trans('report:: historique des telechargements'));
$download->setConfig(false); $download->setConfig(false);
$reportArray = $download->buildReport($config_dl); $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') { if ($app['phraseanet.registry']->get('GV_anonymousReport') == false && $from !== 'DOC' && $from !== 'DASH' && $from !== 'GEN' && $from !== 'PUSHDOC') {
$conf = [ $conf = [
'identifiant' => [_('report:: identifiant'), 0, 0, 0, 0], 'identifiant' => [$app->trans('report:: identifiant'), 0, 0, 0, 0],
'nom' => [_('report:: nom'), 0, 0, 0, 0], 'nom' => [$app->trans('report:: nom'), 0, 0, 0, 0],
'mail' => [_('report:: email'), 0, 0, 0, 0], 'mail' => [$app->trans('report:: email'), 0, 0, 0, 0],
'adresse' => [_('report:: adresse'), 0, 0, 0, 0], 'adresse' => [$app->trans('report:: adresse'), 0, 0, 0, 0],
'tel' => [_('report:: telephone'), 0, 0, 0, 0] 'tel' => [$app->trans('report:: telephone'), 0, 0, 0, 0]
]; ];
$info = new \module_report_nav( $info = new \module_report_nav(
@@ -475,11 +475,11 @@ class Informations implements ControllerProviderInterface
$info->setPeriode(''); $info->setPeriode('');
$info->setConfig(false); $info->setConfig(false);
$info->setTitle(_('report:: utilisateur')); $info->setTitle($app->trans('report:: utilisateur'));
$reportArray = $info->buildTabGrpInfo(false, [], $request->request->get('user'), $conf, false); $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); $download->setPrettyString(false);
try { try {

View File

@@ -169,14 +169,14 @@ class Root implements ControllerProviderInterface
); );
$conf = [ $conf = [
'user' => [_('phraseanet::utilisateurs'), 1, 1, 1, 1], 'user' => [$app->trans('phraseanet::utilisateurs'), 1, 1, 1, 1],
'ddate' => [_('report:: date'), 1, 0, 1, 1], 'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1],
'ip' => [_('report:: IP'), 1, 0, 0, 0], 'ip' => [$app->trans('report:: IP'), 1, 0, 0, 0],
'appli' => [_('report:: modules'), 1, 0, 0, 0], 'appli' => [$app->trans('report:: modules'), 1, 0, 0, 0],
'fonction' => [_('report::fonction'), 1, 1, 1, 1], 'fonction' => [$app->trans('report::fonction'), 1, 1, 1, 1],
'activite' => [_('report::activite'), 1, 1, 1, 1], 'activite' => [$app->trans('report::activite'), 1, 1, 1, 1],
'pays' => [_('report::pays'), 1, 1, 1, 1], 'pays' => [$app->trans('report::pays'), 1, 1, 1, 1],
'societe' => [_('report::societe'), 1, 1, 1, 1] 'societe' => [$app->trans('report::societe'), 1, 1, 1, 1]
]; ];
if ($request->request->get('printcsv') == 'on') { if ($request->request->get('printcsv') == 'on') {
@@ -235,13 +235,13 @@ class Root implements ControllerProviderInterface
); );
$conf = [ $conf = [
'user' => [_('report:: utilisateur'), 1, 1, 1, 1], 'user' => [$app->trans('report:: utilisateur'), 1, 1, 1, 1],
'search' => [_('report:: question'), 1, 0, 1, 1], 'search' => [$app->trans('report:: question'), 1, 0, 1, 1],
'ddate' => [_('report:: date'), 1, 0, 1, 1], 'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1],
'fonction' => [_('report:: fonction'), 1, 1, 1, 1], 'fonction' => [$app->trans('report:: fonction'), 1, 1, 1, 1],
'activite' => [_('report:: activite'), 1, 1, 1, 1], 'activite' => [$app->trans('report:: activite'), 1, 1, 1, 1],
'pays' => [_('report:: pays'), 1, 1, 1, 1], 'pays' => [$app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [_('report:: societe'), 1, 1, 1, 1] 'societe' => [$app->trans('report:: societe'), 1, 1, 1, 1]
]; ];
if ($request->request->get('printcsv') == 'on') { if ($request->request->get('printcsv') == 'on') {
@@ -306,16 +306,16 @@ class Root implements ControllerProviderInterface
} }
$conf = array_merge([ $conf = array_merge([
'user' => [_('report:: utilisateurs'), 1, 1, 1, 1], 'user' => [$app->trans('report:: utilisateurs'), 1, 1, 1, 1],
'ddate' => [_('report:: date'), 1, 0, 1, 1], 'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1],
'record_id' => [_('report:: record id'), 1, 1, 1, 1], 'record_id' => [$app->trans('report:: record id'), 1, 1, 1, 1],
'final' => [_('phrseanet:: sous definition'), 1, 0, 1, 1], 'final' => [$app->trans('phrseanet:: sous definition'), 1, 0, 1, 1],
'coll_id' => [_('report:: collections'), 1, 0, 1, 1], 'coll_id' => [$app->trans('report:: collections'), 1, 0, 1, 1],
'comment' => [_('report:: commentaire'), 1, 0, 0, 0], 'comment' => [$app->trans('report:: commentaire'), 1, 0, 0, 0],
'fonction' => [_('report:: fonction'), 1, 1, 1, 1], 'fonction' => [$app->trans('report:: fonction'), 1, 1, 1, 1],
'activite' => [_('report:: activite'), 1, 1, 1, 1], 'activite' => [$app->trans('report:: activite'), 1, 1, 1, 1],
'pays' => [_('report:: pays'), 1, 1, 1, 1], 'pays' => [$app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [_('report:: societe'), 1, 1, 1, 1] 'societe' => [$app->trans('report:: societe'), 1, 1, 1, 1]
], $conf_pref); ], $conf_pref);
if ($request->request->get('printcsv') == 'on') { if ($request->request->get('printcsv') == 'on') {
@@ -380,12 +380,12 @@ class Root implements ControllerProviderInterface
} }
$conf = array_merge([ $conf = array_merge([
'telechargement' => [_('report:: telechargements'), 1, 0, 0, 0], 'telechargement' => [$app->trans('report:: telechargements'), 1, 0, 0, 0],
'record_id' => [_('report:: record id'), 1, 1, 1, 0], 'record_id' => [$app->trans('report:: record id'), 1, 1, 1, 0],
'final' => [_('phraseanet:: sous definition'), 1, 0, 1, 1], 'final' => [$app->trans('phraseanet:: sous definition'), 1, 0, 1, 1],
'file' => [_('report:: fichier'), 1, 0, 0, 1], 'file' => [$app->trans('report:: fichier'), 1, 0, 0, 1],
'mime' => [_('report:: type'), 1, 0, 1, 1], 'mime' => [$app->trans('report:: type'), 1, 0, 1, 1],
'size' => [_('report:: taille'), 1, 0, 1, 1] 'size' => [$app->trans('report:: taille'), 1, 0, 1, 1]
], $conf_pref); ], $conf_pref);
if ($request->request->get('printcsv') == 'on') { if ($request->request->get('printcsv') == 'on') {
@@ -444,30 +444,30 @@ class Root implements ControllerProviderInterface
); );
$conf_nav = [ $conf_nav = [
'nav' => [_('report:: navigateur'), 0, 1, 0, 0], 'nav' => [$app->trans('report:: navigateur'), 0, 1, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
]; ];
$conf_combo = [ $conf_combo = [
'combo' => [_('report:: navigateurs et plateforme'), 0, 0, 0, 0], 'combo' => [$app->trans('report:: navigateurs et plateforme'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
]; ];
$conf_os = [ $conf_os = [
'os' => [_('report:: plateforme'), 0, 0, 0, 0], 'os' => [$app->trans('report:: plateforme'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
]; ];
$conf_res = [ $conf_res = [
'res' => [_('report:: resolution'), 0, 0, 0, 0], 'res' => [$app->trans('report:: resolution'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
]; ];
$conf_mod = [ $conf_mod = [
'appli' => [_('report:: module'), 0, 0, 0, 0], 'appli' => [$app->trans('report:: module'), 0, 0, 0, 0],
'nb' => [_('report:: nombre'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]
]; ];
$report = [ $report = [
@@ -543,7 +543,7 @@ class Root implements ControllerProviderInterface
if ($request->request->get('conf') == 'on') { if ($request->request->get('conf') == 'on') {
return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [ return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [
'conf' => $base_conf 'conf' => $base_conf
]), 'title' => _('configuration')]); ]), 'title' => $app->trans('configuration')]);
} }
//set order //set order
@@ -570,7 +570,7 @@ class Root implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field), 'result' => $report->colFilter($field),
'field' => $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) { if ($field === $value) {
@@ -615,7 +615,7 @@ class Root implements ControllerProviderInterface
'is_doc' => false 'is_doc' => false
]), ]),
'display_nav' => 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())) { if ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) {
$user->set_password($data['password']); $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'); return $app->redirectPath('account');
} else { } 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'))) { 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(); $user = $app['authentication']->getUser();
if (!$app['auth.password-encoder']->isPasswordValid($user->get_password(), $password, $user->get_nonce())) { 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'); return $app->redirectPath('account_reset_email');
} }
if (!\Swift_Validate::email($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'); return $app->redirectPath('account_reset_email');
} }
if ($email !== $emailConfirm) { 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'); return $app->redirectPath('account_reset_email');
} }
@@ -153,7 +153,7 @@ class Account implements ControllerProviderInterface
try { try {
$receiver = Receiver::fromUser($app['authentication']->getUser()); $receiver = Receiver::fromUser($app['authentication']->getUser());
} catch (InvalidArgumentException $e) { } 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'); return $app->redirectPath('account_reset_email');
} }
@@ -164,7 +164,7 @@ class Account implements ControllerProviderInterface
$app['notification.deliverer']->deliver($mail); $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'); return $app->redirectPath('account');
} }
@@ -185,11 +185,11 @@ class Account implements ControllerProviderInterface
$user->set_email($datas['datas']); $user->set_email($datas['datas']);
$app['tokens']->removeToken($token); $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'); return $app->redirectPath('account');
} catch (\Exception $e) { } 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'); return $app->redirectPath('account');
} }
@@ -210,7 +210,7 @@ class Account implements ControllerProviderInterface
public function grantAccess(Application $app, Request $request, $application_id) public function grantAccess(Application $app, Request $request, $application_id)
{ {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { 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; $error = false;
@@ -344,7 +344,7 @@ class Account implements ControllerProviderInterface
foreach ($demands as $baseId) { foreach ($demands as $baseId) {
try { try {
$register->add_request($app['authentication']->getUser(), \collection::get_from_base_id($app, $baseId)); $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) { } catch (\Exception $e) {
} }
@@ -403,9 +403,9 @@ class Account implements ControllerProviderInterface
$app['phraseanet.appbox']->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();
$app['EM']->persist($ftpCredential); $app['EM']->persist($ftpCredential);
$app['EM']->flush(); $app['EM']->flush();
$app->addFlash('success', _('login::notification: Changements enregistres')); $app->addFlash('success', $app->trans('login::notification: Changements enregistres'));
} catch (\Exception $e) { } 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(); $app['phraseanet.appbox']->get_connection()->rollBack();
} }
} }

View File

@@ -73,7 +73,7 @@ class Developers implements ControllerProviderInterface
public function deleteApp(Application $app, Request $request, $id) public function deleteApp(Application $app, Request $request, $id)
{ {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { 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; $error = false;
@@ -99,7 +99,7 @@ class Developers implements ControllerProviderInterface
public function renewAppCallback(Application $app, Request $request, $id) public function renewAppCallback(Application $app, Request $request, $id)
{ {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { 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; $error = false;
@@ -130,7 +130,7 @@ class Developers implements ControllerProviderInterface
public function renewAccessToken(Application $app, Request $request, $id) public function renewAccessToken(Application $app, Request $request, $id)
{ {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { 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; $error = false;
@@ -167,7 +167,7 @@ class Developers implements ControllerProviderInterface
public function authorizeGrantpassword(Application $app, Request $request, $id) public function authorizeGrantpassword(Application $app, Request $request, $id)
{ {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { 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; $error = false;

View File

@@ -217,23 +217,23 @@ class Login implements ControllerProviderInterface
public function getLanguage(Application $app, Request $request) public function getLanguage(Application $app, Request $request)
{ {
$response = $app->json([ $response = $app->json([
'validation_blank' => _('Please provide a value.'), 'validation_blank' => $app->trans('Please provide a value.'),
'validation_choice_min' => _('Please select at least %s choice.'), 'validation_choice_min' => $app->trans('Please select at least %s choice.'),
'validation_email' => _('Please provide a valid email address.'), 'validation_email' => $app->trans('Please provide a valid email address.'),
'validation_ip' => _('Please provide a valid IP address.'), 'validation_ip' => $app->trans('Please provide a valid IP address.'),
'validation_length_min' => _('Please provide a longer value. It should have %s character or more.'), 'validation_length_min' => $app->trans('Please provide a longer value. It should have %s character or more.'),
'password_match' => _('Please provide the same passwords.'), 'password_match' => $app->trans('Please provide the same passwords.'),
'email_match' => _('Please provide the same emails.'), 'email_match' => $app->trans('Please provide the same emails.'),
'accept_tou' => _('Please accept the terms of use to register.'), 'accept_tou' => $app->trans('Please accept the terms of use to register.'),
'no_collection_selected' => _('No collection selected'), 'no_collection_selected' => $app->trans('No collection selected'),
'one_collection_selected' => _('%d collection selected'), 'one_collection_selected' => $app->trans('%d collection selected'),
'collections_selected' => _('%d collections selected'), 'collections_selected' => $app->trans('%d collections selected'),
'all_collections' => _('Select all collections'), 'all_collections' => $app->trans('Select all collections'),
// password strength // password strength
'weak' => _('Weak'), 'weak' => $app->trans('Weak'),
'ordinary' => _('Ordinary'), 'ordinary' => $app->trans('Ordinary'),
'good' => _('Good'), 'good' => $app->trans('Good'),
'great' => _('Great'), 'great' => $app->trans('Great'),
]); ]);
$response->setExpires(new \DateTime('+1 day')); $response->setExpires(new \DateTime('+1 day'));
@@ -268,7 +268,7 @@ class Login implements ControllerProviderInterface
try { try {
$provider = $this->findProvider($app, $data['provider-id']); $provider = $this->findProvider($app, $data['provider-id']);
} catch (NotFoundHttpException $e) { } 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'); return $app->redirectPath('login_register');
} }
@@ -276,7 +276,7 @@ class Login implements ControllerProviderInterface
try { try {
$token = $provider->getToken(); $token = $provider->getToken();
} catch (NotAuthenticatedException $e) { } 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'); return $app->redirectPath('login_register');
} }
@@ -303,7 +303,7 @@ class Login implements ControllerProviderInterface
$captcha = $app['recaptcha']->bind($request); $captcha = $app['recaptcha']->bind($request);
if ($app['phraseanet.registry']->get('GV_captchas') && !$captcha->isValid()) { 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'; require_once $app['root.path'] . '/lib/classes/deprecated/inscript.api.php';
@@ -408,10 +408,10 @@ class Login implements ControllerProviderInterface
try { try {
$this->sendAccountUnlockEmail($app, $user); $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) { } catch (InvalidArgumentException $e) {
// todo, log this failure // 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'); return $app->redirectPath('homepage');
@@ -472,17 +472,17 @@ class Login implements ControllerProviderInterface
try { try {
$user = \User_Adapter::getInstance((int) $usrId, $app); $user = \User_Adapter::getInstance((int) $usrId, $app);
} catch (\Exception $e) { } catch (\Exception $e) {
$app->addFlash('error', _('Invalid link.')); $app->addFlash('error', $app->trans('Invalid link.'));
return $app->redirectPath('homepage'); return $app->redirectPath('homepage');
} }
try { try {
$this->sendAccountUnlockEmail($app, $user); $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) { } catch (InvalidArgumentException $e) {
// todo, log this failure // 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'); return $app->redirectPath('homepage');
@@ -521,7 +521,7 @@ class Login implements ControllerProviderInterface
public function registerConfirm(PhraseaApplication $app, Request $request) public function registerConfirm(PhraseaApplication $app, Request $request)
{ {
if (null === $code = $request->query->get('code')) { 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'); return $app->redirectPath('homepage');
} }
@@ -529,7 +529,7 @@ class Login implements ControllerProviderInterface
try { try {
$datas = $app['tokens']->helloToken($code); $datas = $app['tokens']->helloToken($code);
} catch (NotFoundHttpException $e) { } catch (NotFoundHttpException $e) {
$app->addFlash('error', _('Invalid unlock link.')); $app->addFlash('error', $app->trans('Invalid unlock link.'));
return $app->redirectPath('homepage'); return $app->redirectPath('homepage');
} }
@@ -537,13 +537,13 @@ class Login implements ControllerProviderInterface
try { try {
$user = \User_Adapter::getInstance((int) $datas['usr_id'], $app); $user = \User_Adapter::getInstance((int) $datas['usr_id'], $app);
} catch (\Exception $e) { } catch (\Exception $e) {
$app->addFlash('error', _('Invalid unlock link.')); $app->addFlash('error', $app->trans('Invalid unlock link.'));
return $app->redirectPath('homepage'); return $app->redirectPath('homepage');
} }
if (!$user->get_mail_locked()) { 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'); return $app->redirectPath('homepage');
} }
@@ -554,7 +554,7 @@ class Login implements ControllerProviderInterface
try { try {
$receiver = Receiver::fromUser($user); $receiver = Receiver::fromUser($user);
} catch (InvalidArgumentException $e) { } 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'); return $app->redirectPath('homepage');
} }
@@ -565,12 +565,12 @@ class Login implements ControllerProviderInterface
$mail = MailSuccessEmailConfirmationRegistered::create($app, $receiver); $mail = MailSuccessEmailConfirmationRegistered::create($app, $receiver);
$app['notification.deliverer']->deliver($mail); $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 { } else {
$mail = MailSuccessEmailConfirmationUnregistered::create($app, $receiver); $mail = MailSuccessEmailConfirmationUnregistered::create($app, $receiver);
$app['notification.deliverer']->deliver($mail); $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'); return $app->redirectPath('homepage');
@@ -604,7 +604,7 @@ class Login implements ControllerProviderInterface
$app['tokens']->removeToken($token); $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'); return $app->redirectPath('homepage');
} }
@@ -640,13 +640,13 @@ class Login implements ControllerProviderInterface
try { try {
$user = \User_Adapter::getInstance(\User_Adapter::get_usr_id_from_email($app, $data['email']), $app); $user = \User_Adapter::getInstance(\User_Adapter::get_usr_id_from_email($app, $data['email']), $app);
} catch (\Exception $e) { } 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 { try {
$receiver = Receiver::fromUser($user); $receiver = Receiver::fromUser($user);
} catch (InvalidArgumentException $e) { } 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')); $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); $mail->setButtonUrl($url);
$app['notification.deliverer']->deliver($mail); $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'); return $app->redirectPath('login_forgot_password');
} }
@@ -710,7 +710,7 @@ class Login implements ControllerProviderInterface
$app['dispatcher']->dispatch(PhraseaEvents::LOGOUT, new LogoutEvent($app)); $app['dispatcher']->dispatch(PhraseaEvents::LOGOUT, new LogoutEvent($app));
$app['authentication']->closeAccount(); $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', [ $response = $app->redirectPath('homepage', [
'redirect' => $request->query->get("redirect") 'redirect' => $request->query->get("redirect")
@@ -737,7 +737,7 @@ class Login implements ControllerProviderInterface
try { try {
$app['phraseanet.appbox']->get_connection(); $app['phraseanet.appbox']->get_connection();
} catch (\Exception $e) { } 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']); $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) public function authenticateAsGuest(PhraseaApplication $app, Request $request)
{ {
if (!$app->isGuestAllowed()) { 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); $context = new Context(Context::CONTEXT_GUEST);
@@ -899,7 +899,7 @@ class Login implements ControllerProviderInterface
$provider->onCallback($request); $provider->onCallback($request);
$token = $provider->getToken(); $token = $provider->getToken();
} catch (NotAuthenticatedException $e) { } 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'); return $app->redirectPath('homepage');
} }
@@ -923,7 +923,7 @@ class Login implements ControllerProviderInterface
try { try {
$user = $app['authentication.suggestion-finder']->find($token); $user = $app['authentication.suggestion-finder']->find($token);
} catch (NotAuthenticatedException $e) { } 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'); return $app->redirectPath('homepage');
} }
@@ -962,7 +962,7 @@ class Login implements ControllerProviderInterface
return $app->redirectPath('login_register_classic', ['providerId' => $providerId]); 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'); return $app->redirectPath('homepage');
} }
@@ -994,7 +994,7 @@ class Login implements ControllerProviderInterface
$form->bind($request); $form->bind($request);
if (!$form->isValid()) { 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)); 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); $usr_id = $app['auth.native']->getUsrId($request->request->get('login'), $request->request->get('password'), $request);
} catch (RequireCaptchaException $e) { } catch (RequireCaptchaException $e) {
$app->requireCaptcha(); $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)); throw new AuthenticationException(call_user_func($redirector, $params));
} catch (AccountLockedException $e) { } 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()); $app->addUnlockAccountData($e->getUsrId());
throw new AuthenticationException(call_user_func($redirector, $params)); throw new AuthenticationException(call_user_func($redirector, $params));
} }
if (null === $usr_id) { 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)); 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 (in_array($app['session']->get('phraseanet.message'), ['1', null])) {
if ($app['conf']->get(['main', 'maintenance'])) { 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')) { if ($app['phraseanet.registry']->get('GV_message_on')) {

View File

@@ -96,7 +96,7 @@ class Setup implements ControllerProviderInterface
} }
if ($request->getScheme() == 'http') { 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', [ 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']); $abConn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $ab_password, $appbox_name, [], $app['debug']);
} catch (\Exception $e) { } catch (\Exception $e) {
return $app->redirectPath('install_step2', [ 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) { } catch (\Exception $e) {
return $app->redirectPath('install_step2', [ 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) { } catch (\Exception $e) {
return $app->redirectPath('install_step2', [ 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; $dom->formatOutput = true;
$root = $dom->appendChild($dom->createElementNS('www.phraseanet.com', 'phraseanet:topics')); $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')) $root->appendChild($dom->createElement('display'))
->appendChild($dom->createElement('defaultview')) ->appendChild($dom->createElement('defaultview'))
->appendChild($dom->createTextNode($default_display)); ->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') { if ($request->get("ofm") == 'toscreen') {
$lngs[$lng] = str_replace(['&', '<', '>'], ['&amp;', '&lt;', '&gt;'], $dom->saveXML()); $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'); @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)) { 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 { } 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')); $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; $ntopics = 0;
if ($node->nodeType == XML_ELEMENT_NODE) { if ($node->nodeType == XML_ELEMENT_NODE) {
@@ -506,7 +506,11 @@ class Thesaurus implements ControllerProviderInterface
} }
$t_sort[$i] = $query; // tri sur w $t_sort[$i] = $query; // tri sur w
$t_node[$i] = ['label' => $label, 'node' => $n]; $t_node[$i] = [
/** @Ignore */
'label' => $label,
'node' => $n
];
$i ++; $i ++;
} }
@@ -531,14 +535,14 @@ class Thesaurus implements ControllerProviderInterface
} }
if ($sand && $prevQuery != '') { 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 . '')); $topic->appendChild($dom->createElement('query'))->appendChild($dom->createTextNode('' . $query . ''));
$topics2 = $dom->createElement('topics'); $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); $topic->appendChild($topics2);
} }
} }
@@ -604,20 +608,20 @@ class Thesaurus implements ControllerProviderInterface
$line = substr($line, 1); $line = substr($line, 1);
} }
if ($depth > $curdepth + 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; continue;
} }
$line = trim($line); $line = trim($line);
if ( ! $this->checkEncoding($line, 'UTF-8')) { 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; continue;
} }
$line = str_replace($cbad, $cok, ($oldline = $line)); $line = str_replace($cbad, $cok, ($oldline = $line));
if ($line != $oldline) { if ($line != $oldline) {
$err = sprintf(_("bad character at line %s"), $iline); $err = $app->trans("bad character at line %line%", array('%line%' => $iline));
continue; continue;
} }
@@ -1751,7 +1755,7 @@ class Thesaurus implements ControllerProviderInterface
$domct->documentElement->setAttribute("nextid", (int) ($id) + 1); $domct->documentElement->setAttribute("nextid", (int) ($id) + 1);
$del = $domct->documentElement->appendChild($domct->createElement("te")); $del = $domct->documentElement->appendChild($domct->createElement("te"));
$del->setAttribute("id", "C" . $id); $del->setAttribute("id", "C" . $id);
$del->setAttribute("field", _('thesaurus:: corbeille')); $del->setAttribute("field", $app->trans('thesaurus:: corbeille'));
$del->setAttribute("nextid", "0"); $del->setAttribute("nextid", "0");
$del->setAttribute("delbranch", "1"); $del->setAttribute("delbranch", "1");
@@ -1881,7 +1885,7 @@ class Thesaurus implements ControllerProviderInterface
$domct->documentElement->setAttribute("nextid", (int) ($id) + 1); $domct->documentElement->setAttribute("nextid", (int) ($id) + 1);
$ct = $domct->documentElement->appendChild($domct->createElement("te")); $ct = $domct->documentElement->appendChild($domct->createElement("te"));
$ct->setAttribute("id", "C" . $id); $ct->setAttribute("id", "C" . $id);
$ct->setAttribute("field", _('thesaurus:: corbeille')); $ct->setAttribute("field", $app->trans('thesaurus:: corbeille'));
$ct->setAttribute("nextid", "0"); $ct->setAttribute("nextid", "0");
$ct->setAttribute("delbranch", "1"); $ct->setAttribute("delbranch", "1");
@@ -2978,7 +2982,7 @@ class Thesaurus implements ControllerProviderInterface
} }
// on considere que la source 'deleted' est toujours valide // on considere que la source 'deleted' est toujours valide
$fields["[deleted]"] = [ $fields["[deleted]"] = [
"name" => _('thesaurus:: corbeille'), "name" => $app->trans('thesaurus:: corbeille'),
"tbranch" => null, "tbranch" => null,
"cid" => null, "cid" => null,
"sourceok" => true "sourceok" => true

View File

@@ -486,7 +486,7 @@ class Xmlhttp implements ControllerProviderInterface
<h1 style="position:relative; top:0px; left:0px; width:100%; height:auto;"> <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="triangle" href="#"><span class='triRight'>&#x25BA;</span><span class='triDown'>&#x25BC;</span></a>
<a class="title" href="#"><?php echo $row['title'] ?></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> </h1>
<div> <div>
<?php echo $desc ?> <?php echo $desc ?>
@@ -963,6 +963,7 @@ class Xmlhttp implements ControllerProviderInterface
} }
} }
$tts[$key0 . '_' . $uniq] = [ $tts[$key0 . '_' . $uniq] = [
/** @Ignore */
'label' => $label, 'label' => $label,
'nts' => $nts0, 'nts' => $nts0,
'n' => $n 'n' => $n
@@ -1507,10 +1508,10 @@ class Xmlhttp implements ControllerProviderInterface
$databox->saveCterms($sbas['domct']); $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 { } else {
// too many records to update // 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); return $app->json($ret);
@@ -1659,7 +1660,12 @@ class Xmlhttp implements ControllerProviderInterface
if (!isset($tts[$key0 . '_' . $uniq])) if (!isset($tts[$key0 . '_' . $uniq]))
break; break;
} }
$tts[$key0 . '_' . $uniq] = ['label' => $label, 'nts' => $nts0, 'n' => $n]; $tts[$key0 . '_' . $uniq] = [
/** @Ignore */
'label' => $label,
'nts' => $nts0,
'n' => $n
];
$ntsopened++; $ntsopened++;
} }
$nts++; $nts++;

View File

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

View File

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

View File

@@ -17,14 +17,17 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\Translation\TranslatorInterface;
class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface
{ {
private $handler; private $handler;
private $translator;
public function __construct(ExceptionHandler $handler) public function __construct(ExceptionHandler $handler, TranslatorInterface $translator)
{ {
$this->handler = $handler; $this->handler = $handler;
$this->translator = $translator;
} }
public static function getSubscribedEvents() public static function getSubscribedEvents()
@@ -45,7 +48,7 @@ class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface
$e = $event->getException(); $e = $event->getException();
$code = 500; $code = 500;
$msg = _('Whoops, looks like something went wrong.'); $msg = $this->translator->trans('Whoops, looks like something went wrong.');
$headers = []; $headers = [];
if ($e instanceof HttpExceptionInterface) { 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\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
class PhraseaExceptionHandler extends SymfonyExceptionHandler class PhraseaExceptionHandler extends SymfonyExceptionHandler
{ {
private $translator;
public function setTranslator(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function createResponseBasedOnRequest(Request $request, $exception) public function createResponseBasedOnRequest(Request $request, $exception)
{ {
return parent::createResponse($exception); return parent::createResponse($exception);
@@ -27,23 +35,43 @@ class PhraseaExceptionHandler extends SymfonyExceptionHandler
{ {
switch (true) { switch (true) {
case 404 === $exception->getStatusCode(): 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; break;
case 403 === $exception->getStatusCode(): 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; break;
case 500 === $exception->getStatusCode(): 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; break;
case 503 === $exception->getStatusCode(): 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; break;
case isset(Response::$statusTexts[$exception->getStatusCode()]): case isset(Response::$statusTexts[$exception->getStatusCode()]):
$title = $exception->getStatusCode() . ' : ' . Response::$statusTexts[$exception->getStatusCode()]; $title = $exception->getStatusCode() . ' : ' . Response::$statusTexts[$exception->getStatusCode()];
break; break;
default: default:
if (null !== $this->translator) {
$title = $this->translator->trans('Whoops, looks like something went wrong.');
} else {
$title = 'Whoops, looks like something went wrong.'; $title = 'Whoops, looks like something went wrong.';
} }
}
$content = parent::getContent($exception); $content = parent::getContent($exception);
$start = strpos($content, '</h1>'); $start = strpos($content, '</h1>');

View File

@@ -23,7 +23,7 @@ class ManipulatorServiceProvider implements ServiceProviderInterface
public function register(SilexApplication $app) public function register(SilexApplication $app)
{ {
$app['manipulator.task'] = $app->share(function (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) { $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 Doctrine\DBAL\Types\Type;
use Gedmo\DoctrineExtensions; use Gedmo\DoctrineExtensions;
use Gedmo\Timestampable\TimestampableListener; use Gedmo\Timestampable\TimestampableListener;
use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\RotatingFileHandler;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
@@ -37,7 +36,7 @@ class ORMServiceProvider implements ServiceProviderInterface
$app['EM.sql-logger.max-files'] = 5; $app['EM.sql-logger.max-files'] = 5;
$app['EM.sql-logger'] = $app->share(function (Application $app) { $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'])); $logger->pushHandler(new RotatingFileHandler($app['EM.sql-logger.file'], $app['EM.sql-logger.max-files']));
return new MonologSQLLogger($logger, 'yaml'); return new MonologSQLLogger($logger, 'yaml');

View File

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

View File

@@ -45,7 +45,7 @@ class TasksServiceProvider implements ServiceProviderInterface
}); });
$app['task-manager.job-factory'] = $app->share(function (Application $app) { $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) { $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) { $app['task-manager.available-jobs'] = $app->share(function (Application $app) {
return [ return [
new FtpJob(), new FtpJob($app['dispatcher'], $app['logger'], $app['translator']),
new ArchiveJob(), new ArchiveJob($app['dispatcher'], $app['logger'], $app['translator']),
new BridgeJob(), new BridgeJob($app['dispatcher'], $app['logger'], $app['translator']),
new FtpPullJob(), new FtpPullJob($app['dispatcher'], $app['logger'], $app['translator']),
new PhraseanetIndexerJob(), new PhraseanetIndexerJob($app['dispatcher'], $app['logger'], $app['translator']),
new RecordMoverJob(), new RecordMoverJob($app['dispatcher'], $app['logger'], $app['translator']),
new SubdefsJob(), new SubdefsJob($app['dispatcher'], $app['logger'], $app['translator']),
new WriteMetadataJob(), new WriteMetadataJob($app['dispatcher'], $app['logger'], $app['translator']),
]; ];
}); });
} }

View File

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

View File

@@ -11,6 +11,7 @@
namespace Alchemy\Phrasea\Form\Constraint; namespace Alchemy\Phrasea\Form\Constraint;
use Alchemy\Phrasea\Application;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Alchemy\Geonames\Connector; use Alchemy\Geonames\Connector;
use Alchemy\Geonames\Exception\TransportException; use Alchemy\Geonames\Exception\TransportException;
@@ -18,12 +19,11 @@ use Alchemy\Geonames\Exception\NotFoundException;
class Geoname extends Constraint class Geoname extends Constraint
{ {
public $message = 'This place does not seem to exist.';
private $connector; private $connector;
private $message;
public function __construct(Connector $connector) public function __construct(Connector $connector)
{ {
$this->message = _('This place does not seem to exist.');
$this->connector = $connector; $this->connector = $connector;
parent::__construct(); parent::__construct();
} }
@@ -40,4 +40,9 @@ class Geoname extends Constraint
return true; 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) public function validate($value, Constraint $constraint)
{ {
if (!$constraint->isValid($value)) { 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 class NewEmail extends Constraint
{ {
public $message = 'This email is already bound to an account';
private $app; private $app;
private $message;
public function __construct(Application $app) public function __construct(Application $app)
{ {
$this->message = _('This email is already bound to an account');
$this->app = $app; $this->app = $app;
parent::__construct(); parent::__construct();
} }
@@ -32,4 +31,9 @@ class NewEmail extends Constraint
return $ret; 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) public function validate($value, Constraint $constraint)
{ {
if ($constraint->isAlreadyRegistered($value)) { 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 class NewLogin extends Constraint
{ {
public $message = 'This login is already registered';
private $app; private $app;
private $message;
public function __construct(Application $app) public function __construct(Application $app)
{ {
$this->message = _('This login is already registered');
$this->app = $app; $this->app = $app;
parent::__construct(); parent::__construct();
} }
@@ -32,4 +31,9 @@ class NewLogin extends Constraint
return $ret; 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) public function validate($value, Constraint $constraint)
{ {
if ($constraint->isAlreadyRegistered($value)) { 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 class PasswordToken extends Constraint
{ {
public $message = 'The token provided is not valid anymore';
private $app; private $app;
private $random; private $random;
private $message;
public function __construct(Application $app, \random $random) public function __construct(Application $app, \random $random)
{ {
$this->message = _('The token provided is not valid anymore');
$this->app = $app; $this->app = $app;
$this->random = $random; $this->random = $random;
parent::__construct(); parent::__construct();
@@ -39,4 +38,9 @@ class PasswordToken extends Constraint
return \random::TYPE_PASSWORD === $data['type']; 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) public function validate($value, Constraint $constraint)
{ {
if (!$constraint->isValid($value)) { 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) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('login', 'text', [ $builder->add('login', 'text', [
'label' => _('Login'), 'label' => 'Login',
'required' => true, 'required' => true,
'disabled' => $options['disabled'], 'disabled' => $options['disabled'],
'constraints' => [ 'constraints' => [
@@ -29,7 +29,7 @@ class PhraseaAuthenticationForm extends AbstractType
]); ]);
$builder->add('password', 'password', [ $builder->add('password', 'password', [
'label' => _('Password'), 'label' => 'Password',
'required' => true, 'required' => true,
'disabled' => $options['disabled'], 'disabled' => $options['disabled'],
'constraints' => [ 'constraints' => [
@@ -38,7 +38,7 @@ class PhraseaAuthenticationForm extends AbstractType
]); ]);
$builder->add('remember-me', 'checkbox', [ $builder->add('remember-me', 'checkbox', [
'label' => _('Remember me'), 'label' => 'Remember me',
'mapped' => false, 'mapped' => false,
'required' => false, 'required' => false,
'attr' => [ 'attr' => [

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,14 +22,14 @@ class TaskForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('name', 'text', [ $builder->add('name', 'text', [
'label' => _('Task name'), 'label' => 'Task name',
'required' => true, 'required' => true,
'constraints' => [ 'constraints' => [
new Assert\NotBlank(), new Assert\NotBlank(),
], ],
]); ]);
$builder->add('period', 'integer', [ $builder->add('period', 'integer', [
'label' => _('Task period (in seconds)'), 'label' => 'Task period (in seconds)',
'required' => true, 'required' => true,
'constraints' => [ 'constraints' => [
new Assert\NotBlank(), new Assert\NotBlank(),
@@ -37,7 +37,7 @@ class TaskForm extends AbstractType
], ],
]); ]);
$builder->add('status', 'choice', [ $builder->add('status', 'choice', [
'label' => _('The task status'), 'label' => 'The task status',
'choices' => [ 'choices' => [
Task::STATUS_STARTED => 'Started', Task::STATUS_STARTED => 'Started',
Task::STATUS_STOPPED => 'Stopped', 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'); $parm = $this->unserializedRequestData($this->app['request'], $infos, 'user_infos');
if ($parm['email'] && !\Swift_Validate::email($parm['email'])) { 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(); $old_email = $user->get_email();
@@ -617,7 +617,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
} }
if ($oldReceiver) { 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); $this->app['notification.deliverer']->deliver($mailOldAddress);
} }
@@ -628,7 +628,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
} }
if ($newReceiver) { 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); $this->app['notification.deliverer']->deliver($mailNewAddress);
} }
} }

View File

@@ -148,7 +148,7 @@ class Manage extends Helper
$email = $this->request->get('value'); $email = $this->request->get('value');
if ( ! \Swift_Validate::email($email)) { 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(); $conn = $this->app['phraseanet.appbox']->get_connection();
@@ -210,7 +210,7 @@ class Manage extends Helper
$name = $this->request->get('value'); $name = $this->request->get('value');
if (trim($name) === '') { 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); $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)) { if (0 === count($baskets)) {
$basket = new BasketEntity(); $basket = new BasketEntity();
$basket->setName(_('Default basket')); $basket->setName($this->app->trans('Default basket'));
$basket->setOwner($this->app['authentication']->getUser()); $basket->setOwner($this->app['authentication']->getUser());
$this->app['EM']->persist($basket); $this->app['EM']->persist($basket);

View File

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

View File

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

View File

@@ -11,15 +11,17 @@
namespace Alchemy\Phrasea\Media\Subdef; namespace Alchemy\Phrasea\Media\Subdef;
use Symfony\Component\Translation\TranslatorInterface;
class Gif extends Image class Gif extends Image
{ {
const OPTION_DELAY = 'delay'; 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() public function getType()
@@ -29,7 +31,7 @@ class Gif extends Image
public function getDescription() public function getDescription()
{ {
return _('Generates an animated Gif file'); return $this->translator->trans('Generates an animated Gif file');
} }
public function getMediaAlchemystSpec() public function getMediaAlchemystSpec()

View File

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

View File

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

View File

@@ -11,6 +11,8 @@
namespace Alchemy\Phrasea\Media\Subdef; namespace Alchemy\Phrasea\Media\Subdef;
use Symfony\Component\Translation\TranslatorInterface;
class Video extends Audio class Video extends Audio
{ {
const OPTION_SIZE = 'size'; const OPTION_SIZE = 'size';
@@ -21,17 +23,17 @@ class Video extends Audio
protected $options = []; 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($this->translator->trans('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($this->translator->trans('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($this->translator->trans('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\Range($this->translator->trans('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\Enum($this->translator->trans('Video Codec'), self::OPTION_VCODEC, ['libx264', 'libvpx', 'libtheora'], 'libx264'));
$this->unregisterOption(self::OPTION_ACODEC); $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() public function getType()
@@ -41,7 +43,7 @@ class Video extends Audio
public function getDescription() public function getDescription()
{ {
return _('Generates a video file'); return $this->translator->trans('Generates a video file');
} }
public function getMediaAlchemystSpec() public function getMediaAlchemystSpec()

View File

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

View File

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

View File

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

View File

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

View File

@@ -235,12 +235,12 @@ class LazaretCheck extends \Alchemy\Phrasea\Model\Entities\LazaretCheck implemen
/** /**
* {@inheritDoc} * {@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} * {@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 */ /* @var $element BasketElement */
if (null === $element) { if (null === $element) {
throw new NotFoundHttpException(_('Element is not found')); throw new NotFoundHttpException('Element is not found');
} }
return $element; return $element;

View File

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

View File

@@ -60,11 +60,11 @@ class UsrListRepository extends EntityRepository
/* @var $list UsrList */ /* @var $list UsrList */
if (null === $list) { if (null === $list) {
throw new NotFoundHttpException(_('List is not found')); throw new NotFoundHttpException('List is not found.');
} }
if ( ! $list->hasAccess($user, $app)) { 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; return $list;

View File

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

View File

@@ -33,10 +33,7 @@ class MailInfoNewOrder extends AbstractMail
*/ */
public function getSubject() public function getSubject()
{ {
return sprintf( return $this->app->trans('admin::register: Nouvelle commande sur %s', array('%application%' => $this->getPhraseanetTitle()));
_('admin::register: Nouvelle commande sur %s'),
$this->getPhraseanetTitle()
);
} }
/** /**
@@ -48,7 +45,7 @@ class MailInfoNewOrder extends AbstractMail
throw new LogicException('You must set a user before calling getMessage()'); 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() 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'); 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'); 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() 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() 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()'); throw new LogicException('You must set a deliverer before calling getMessage()');
} }
return sprintf( return $this->app->trans('%user% a refuse %quantity% elements de votre commande', array(
_('%s a refuse %d elements de votre commande'), '%user%' => $this->deliverer->get_display_name(),
$this->deliverer->get_display_name(), '%quantity%' => $this->quantity,
$this->quantity ));
);
} }
/** /**
@@ -72,7 +71,7 @@ class MailInfoOrderCancelled extends AbstractMail
*/ */
public function getButtonText() 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'); throw new LogicException('You must set a basket before calling getSubject');
} }
return sprintf( return $this->app->trans('push::mail:: Reception de votre commande %title%', array('%title%' => $this->basket->getName()));
_('push::mail:: Reception de votre commande %s'), $this->basket->getName()
);
} }
/** /**
@@ -64,10 +62,7 @@ class MailInfoOrderDelivered extends AbstractMail
throw new LogicException('You must set a deliverer before calling getMessage'); throw new LogicException('You must set a deliverer before calling getMessage');
} }
return sprintf( 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()));
_('%s vous a delivre votre commande, consultez la en ligne a l\'adresse suivante'),
$this->deliverer->get_display_name()
);
} }
/** /**
@@ -75,7 +70,7 @@ class MailInfoOrderDelivered extends AbstractMail
*/ */
public function getButtonText() 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