19declare(strict_types=1);
35 return $this->plugin_info->getPath() .
"/lang";
46 if (!@is_dir($directory)) {
52 $dir = opendir($directory);
53 while ($file = readdir($dir)) {
54 if ($file ===
"." || $file ===
"..") {
59 if (@is_file($directory .
"/" . $file) &&
60 strpos($file,
"ilias_") === 0 &&
61 substr($file, strlen($file) - 5) ===
".lang") {
63 "key" => substr($file, 6, 2),
80 $component =
$plugin->getComponent();
81 $slot =
$plugin->getPluginSlot();
83 return $component->getId() .
"_" . $slot->getId() .
"_" .
$plugin->getId();
94 if (!isset($a_lang_keys)) {
102 foreach ($langs as $lang) {
104 if (!in_array($lang[
'key'], $a_lang_keys,
true)) {
115 if (is_array($txt)) {
116 foreach ($txt as $row) {
117 if ($row[0] !==
"#" && strpos($row,
"#:#") > 0) {
118 $a = explode(
"#:#", trim($row));
119 $identifier = $prefix .
"_" . trim(
$a[0]);
120 $value = trim(
$a[1]);
122 if (isset($local_changes[$identifier])) {
123 $lang_array[$identifier] = $local_changes[$identifier];
125 $lang_array[$identifier] = $value;
147 "DELETE FROM lng_data" .
148 " WHERE module = " .
$ilDB->quote($prefix,
"text")
151 "DELETE FROM lng_modules" .
152 " WHERE module = " .
$ilDB->quote($prefix,
"text")
165 if (is_object(
$lng)) {
173 public function txt(
string $a_var): string
static getLangKeysOfInstalledLanguages()
Return the language keys of the installed languages.
static replaceLangEntry(string $a_module, string $a_identifier, string $a_lang_key, string $a_value, ?string $a_local_change=null, ?string $a_remarks=null)
Replace lang entry.
static replaceLangModule(string $a_key, string $a_module, array $a_array)
Replace language module array.
static _getLocalChangesByModule(string $a_key, string $a_module)
Get the local changes of a language module $a_key Language key $a_module Module key Return array iden...
Simple value class for information about a plugin.
__construct(ilPluginInfo $plugin_info)
txt(string $a_var)
Get Language Variable (prefix will be prepended automatically)
getAvailableLangFiles()
Get array of all language files in the plugin.
loadLanguageModule()
Load language module for plugin.
updateLanguages(?array $a_lang_keys=null)
ilPluginInfo $plugin_info
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples