@@ -17,43 +17,43 @@ |
||
17 | 17 | */ |
18 | 18 | class LocaleHelper implements ProtectedContextAwareInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * @Flow\Inject |
|
22 | - * @var Service |
|
23 | - */ |
|
24 | - protected $i18nService; |
|
20 | + /** |
|
21 | + * @Flow\Inject |
|
22 | + * @var Service |
|
23 | + */ |
|
24 | + protected $i18nService; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Given a node this tries to set the current locale for the Flow i18n service |
|
28 | - * from the content dimension "language", if possible. |
|
29 | - * |
|
30 | - * The input node is returned as is for chaining, to make sure the operation is |
|
31 | - * actually evaluated. |
|
32 | - * |
|
33 | - * @param NodeInterface $node |
|
34 | - * @return NodeInterface |
|
35 | - * @throws \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException |
|
36 | - */ |
|
37 | - public function setCurrentFromNode(NodeInterface $node, string $languageDimensionName): NodeInterface |
|
38 | - { |
|
39 | - $dimensions = $node->getContext()->getDimensions(); |
|
40 | - if (array_key_exists($languageDimensionName, $dimensions) && $dimensions[$languageDimensionName] !== []) { |
|
41 | - $currentLocale = new Locale($dimensions[$languageDimensionName][0]); |
|
42 | - $this->i18nService->getConfiguration()->setCurrentLocale($currentLocale); |
|
43 | - $this->i18nService->getConfiguration()->setFallbackRule(['strict' => false, 'order' => array_reverse($dimensions[$languageDimensionName])]); |
|
44 | - } |
|
26 | + /** |
|
27 | + * Given a node this tries to set the current locale for the Flow i18n service |
|
28 | + * from the content dimension "language", if possible. |
|
29 | + * |
|
30 | + * The input node is returned as is for chaining, to make sure the operation is |
|
31 | + * actually evaluated. |
|
32 | + * |
|
33 | + * @param NodeInterface $node |
|
34 | + * @return NodeInterface |
|
35 | + * @throws \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException |
|
36 | + */ |
|
37 | + public function setCurrentFromNode(NodeInterface $node, string $languageDimensionName): NodeInterface |
|
38 | + { |
|
39 | + $dimensions = $node->getContext()->getDimensions(); |
|
40 | + if (array_key_exists($languageDimensionName, $dimensions) && $dimensions[$languageDimensionName] !== []) { |
|
41 | + $currentLocale = new Locale($dimensions[$languageDimensionName][0]); |
|
42 | + $this->i18nService->getConfiguration()->setCurrentLocale($currentLocale); |
|
43 | + $this->i18nService->getConfiguration()->setFallbackRule(['strict' => false, 'order' => array_reverse($dimensions[$languageDimensionName])]); |
|
44 | + } |
|
45 | 45 | |
46 | - return $node; |
|
47 | - } |
|
46 | + return $node; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * All methods are considered safe |
|
51 | - * |
|
52 | - * @param string $methodName |
|
53 | - * @return boolean |
|
54 | - */ |
|
55 | - public function allowsCallOfMethod($methodName) |
|
56 | - { |
|
57 | - return true; |
|
58 | - } |
|
49 | + /** |
|
50 | + * All methods are considered safe |
|
51 | + * |
|
52 | + * @param string $methodName |
|
53 | + * @return boolean |
|
54 | + */ |
|
55 | + public function allowsCallOfMethod($methodName) |
|
56 | + { |
|
57 | + return true; |
|
58 | + } |
|
59 | 59 | } |
60 | 60 | \ No newline at end of file |