-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathLanguageResolver.php
More file actions
79 lines (70 loc) · 2.86 KB
/
Copy pathLanguageResolver.php
File metadata and controls
79 lines (70 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\Contracts\Core\Repository;
/**
* Resolve language settings for Repository layer.
*/
interface LanguageResolver
{
/**
* For use by custom events / logic setting language for all retrieved objects from repository.
*
* If set, user (context) language will be prepended to a list of configured prioritized languages.
*
* Languages forced by PHP API consumer when retrieving Repository objects will still take priority,
* setting both context language and prioritized languages list as a fallback.
*
* @param string|null $contextLanguage
*/
public function setContextLanguage(?string $contextLanguage): void;
/**
* Get prioritized languages taking into account forced, context, and configured languages.
*
* @param array|null $forcedLanguages Optional, typically arguments provided to API, will be used first if set.
*
* @return string[]
*/
public function getPrioritizedLanguages(?array $forcedLanguages = null): array;
/**
* Get first prioritized language taking into account forced, context, and configured languages.
*
* @param array|null $forcedLanguages Optional, typically arguments provided to API, will be used first if set.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\OutOfBoundsException If no prioritized language is found.
*/
public function getFirstPrioritizedLanguage(?array $forcedLanguages = null): string;
/**
* Get currently set UseAlwaysAvailable.
*
* @param bool|null $forcedUseAlwaysAvailable Optional, if set will be used instead of configured value,
* typically arguments provided to API.
*
* @return bool
*/
public function getUseAlwaysAvailable(?bool $forcedUseAlwaysAvailable = null): bool;
/**
* Get currently set showAllTranslations.
*
* @param bool|null $forcedShowAllTranslations Optional, if set will be used instead of configured value,
* typically arguments provided to API.
*
* @return bool
*/
public function getShowAllTranslations(?bool $forcedShowAllTranslations = null): bool;
/**
* For use by event listening to config resolver scope changes (or other event changing configured languages).
*
* @param bool $defaultShowAllTranslations
*/
public function setShowAllTranslations(bool $defaultShowAllTranslations): void;
/**
* For use by event listening to config resolver scope changes (or other event changing configured languages).
*
* @param bool $defaultUseAlwaysAvailable
*/
public function setDefaultUseAlwaysAvailable(bool $defaultUseAlwaysAvailable): void;
}