19declare(strict_types=1);
38 $this->directories = $global_directories;
45 if (!$this->local_directory->getPath()) {
46 throw new \InvalidArgumentException(
47 "CustomizingLanguageFileDirectory must have a non-empty path"
50 if ($this->local_directory->getPrefix() !==
'') {
51 throw new \InvalidArgumentException(
52 "CustomizingLanguageFileDirectory must have an empty prefix"
59 foreach ($this->directories as
$d) {
63 if ($main_files > 1) {
64 throw new \InvalidArgumentException(
65 "There must not be more than one MainLanguageFileDirectory"
70 if (empty(
$d->getPrefix())) {
71 throw new \InvalidArgumentException(
72 "ComponentLanguageFileDirectory must have a non-empty prefix"
75 if (isset($prefixes[
$d->getPrefix()])) {
76 throw new \InvalidArgumentException(
77 "There must not be two ComponentLanguageFileDirectory with the same prefix"
80 $prefixes[
$d->getPrefix()] =
true;
83 if (empty(
$d->getPrefix())) {
84 throw new \InvalidArgumentException(
"LanguageFileDirectory must have a non-empty prefix");
89 if (
$d->getPrefix() !==
'') {
92 }
catch (\InvalidArgumentException) {
96 if (isset($shipped_files[
$files])) {
97 throw new \InvalidArgumentException(
98 "There must not be two LanguageFileDirectory shipping the same files " .
$files
101 $shipped_files[
$files] =
true;
119 yield $this->local_directory;
__construct(private readonly LanguageFileDirectory $local_directory, LanguageFileDirectory ... $global_directories)
getCustomizingDirectories()
static shippedFileNamePattern(LanguageFileDirectory $directory)
The name of $directory's shipped .po without ".po", with "%s" for the language key: its own pattern (...
A directory of language files with a path and a prefix for them.