-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #617 from paulandrieux/bugfix/608-js-tranlsation-v…
…ictoire-admin Bugfix/608 js tranlsation victoire admin
- Loading branch information
Showing
5 changed files
with
45 additions
and
81 deletions.
There are no files selected for viewing
7 changes: 6 additions & 1 deletion
7
Bundle/CoreBundle/Resources/script/ngApp/filters/translateFilter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
angular.module('ngApp').filter('translate', function() { | ||
return function(input) { | ||
return Translator.trans(input, {}, 'victoire'); | ||
var originalLocale = Translator.locale; | ||
Translator.locale = adminLocale; | ||
var trans = Translator.trans(input, {}, 'victoire'); | ||
Translator.locale = originalLocale; | ||
|
||
return trans; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Victoire\Bundle\I18nBundle\Listener; | ||
|
||
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | ||
|
||
/** | ||
* KernelRequestListener add the available locas as global twig variable. | ||
* | ||
* @author Paul Andrieux <[email protected]> | ||
*/ | ||
class KernelRequestListener | ||
{ | ||
protected $twig; | ||
protected $availableLocales; | ||
|
||
public function __construct(\Twig_Environment $twig, $availableLocales) | ||
{ | ||
$this->twig = $twig; | ||
$this->availableLocales = $availableLocales; | ||
} | ||
|
||
public function onKernelRequest(GetResponseEvent $event) | ||
{ | ||
$this->twig->addGlobal('victoire_i18n_available_locales', $this->availableLocales); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters