19 declare(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)) {
97 if ($langObj->isInstalled()) {
98 $a_lang_keys[] = $langObj->getKey();
107 foreach ($langs as
$lang) {
109 if (!in_array($lang[
'key'], $a_lang_keys,
true)) {
120 if (is_array(
$txt)) {
121 foreach (
$txt as $row) {
122 if ($row[0] !==
"#" && strpos($row,
"#:#") > 0) {
123 $a = explode(
"#:#", trim($row));
124 $identifier = $prefix .
"_" . trim(
$a[0]);
125 $value = trim(
$a[1]);
127 if (isset($local_changes[$identifier])) {
128 $lang_array[$identifier] = $local_changes[$identifier];
130 $lang_array[$identifier] = $value;
145 $ilDB = $DIC->database();
152 "DELETE FROM lng_data" .
153 " WHERE module = " .
$ilDB->quote($prefix,
"text")
156 "DELETE FROM lng_modules" .
157 " WHERE module = " .
$ilDB->quote($prefix,
"text")
168 $lng = $DIC->language();
170 if (is_object(
$lng)) {
178 public function txt(
string $a_var): string
181 $lng = $DIC->language();
txt(string $a_var)
Get Language Variable (prefix will be prepended automatically)
static getInstalledLanguages()
Get the language objects of the installed languages.
__construct(ilPluginInfo $plugin_info)
getAvailableLangFiles()
Get array of all language files in the plugin.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
updateLanguages(?array $a_lang_keys=null)
Simple value class for information about a plugin.
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.
loadLanguageModule()
Load language module for plugin.
static replaceLangModule(string $a_key, string $a_module, array $a_array)
Replace language module array.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
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...
ilPluginInfo $plugin_info