ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory Class Reference
+ Inheritance diagram for ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory:
+ Collaboration diagram for ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory:

Public Member Functions

 __construct (private readonly Component $component, private readonly string $prefix, private readonly string $path_inside_component='lang/', ?string $shipped_file_name_pattern=null)
 
 getShippedFileNamePattern ()
 The name without ".po": exactly one "%s" (language key), otherwise only letters, digits, "_", "-" and "." (no "/", no ".."), e.g. More...
 
 getPrefix ()
 
 getPath ()
 
 getSuffix ()
 
 isLocal ()
 
 getPrefix ()
 
 getPath ()
 
 getSuffix ()
 
 isLocal ()
 
 getShippedFileNamePattern ()
 The name without ".po": exactly one "%s" (language key), otherwise only letters, digits, "_", "-" and "." (no "/", no ".."), e.g. More...
 

Private Attributes

string $base_directory
 
readonly string $shipped_file_name_pattern
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::__construct ( private readonly Component  $component,
private readonly string  $prefix,
private readonly string  $path_inside_component = 'lang/',
?string  $shipped_file_name_pattern = null 
)
Parameters
string | null$shipped_file_name_patternsee NamesShippedLanguageFiles, e.g. "ilias_%s"; default "<prefix>_%s"
Exceptions

InvalidArgumentException for an invalid pattern, see MigratedLanguageFilePaths::assertValidShippedFileNamePattern()

Definition at line 37 of file ComponentLanguageFileDirectory.php.

42 {
43 $this->shipped_file_name_pattern = $shipped_file_name_pattern ?? $prefix . '_%s';
45 }

References ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory\$shipped_file_name_pattern, and ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\assertValidShippedFileNamePattern().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPath()

ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::getPath ( )

Implements ILIAS\Language\ComponentTranslation\LanguageFileDirectory.

Definition at line 57 of file ComponentLanguageFileDirectory.php.

57 : string
58 {
59 // cached: the location never changes and this is called repeatedly per directory loop
60 if (!isset($this->base_directory)) {
61 $reflector = new \ReflectionClass($this->component);
62 $ilias_base_dir = (string) realpath(__DIR__ . '/../../../../../');
63 $this->base_directory = str_replace($ilias_base_dir . '/', '', dirname($reflector->getFileName()));
64 }
65
66 return $this->base_directory . '/' . $this->path_inside_component;
67 }

◆ getPrefix()

ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::getPrefix ( )

Implements ILIAS\Language\ComponentTranslation\LanguageFileDirectory.

Definition at line 52 of file ComponentLanguageFileDirectory.php.

52 : string
53 {
54 return $this->prefix;
55 }

◆ getShippedFileNamePattern()

ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::getShippedFileNamePattern ( )

The name without ".po": exactly one "%s" (language key), otherwise only letters, digits, "_", "-" and "." (no "/", no ".."), e.g.

"ilias_%s".

Implements ILIAS\Language\ComponentTranslation\NamesShippedLanguageFiles.

Definition at line 47 of file ComponentLanguageFileDirectory.php.

47 : string
48 {
50 }

References ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory\$shipped_file_name_pattern.

◆ getSuffix()

ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::getSuffix ( )

Implements ILIAS\Language\ComponentTranslation\LanguageFileDirectory.

Definition at line 69 of file ComponentLanguageFileDirectory.php.

69 : string
70 {
71 return '';
72 }

◆ isLocal()

ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::isLocal ( )

Implements ILIAS\Language\ComponentTranslation\LanguageFileDirectory.

Definition at line 74 of file ComponentLanguageFileDirectory.php.

74 : bool
75 {
76 return false;
77 }

Field Documentation

◆ $base_directory

string ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::$base_directory
private

Definition at line 30 of file ComponentLanguageFileDirectory.php.

◆ $shipped_file_name_pattern

readonly string ILIAS\Language\ComponentTranslation\ComponentLanguageFileDirectory::$shipped_file_name_pattern
private

The documentation for this class was generated from the following file: