Skip to content

Commit

Permalink
Do not use default translation if text is not translated
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jul 31, 2024
1 parent d21100a commit a023ab8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lhc_web/lib/models/lhabstract/erlhabstractmodelwidgettheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,11 @@ public function customForm()

public function translate() {

$chatLocaleFallback = erConfigClassLhConfig::getInstance()->getDirLanguage('content_language');
$config = erConfigClassLhConfig::getInstance();
$chatLocaleFallback = $config->getDirLanguage('content_language');
$defaultSiteAccess = $config->getSetting( 'site', 'default_site_access',false);
$chatLocale = erLhcoreClassChatValidator::getVisitorLocale();
$siteAccess = erLhcoreClassSystem::instance()->SiteAccess;

$attributesDirect = array(
'pending_join_queue',
Expand Down Expand Up @@ -502,10 +505,9 @@ public function translate() {
$attributes = $this->bot_configuration_array;

foreach ($translatableAttributes as $attr) {
if (isset($attributes[$attr . '_lang'])) {

$translated = false;
$translated = false;

if (isset($attributes[$attr . '_lang'])) {
if ($chatLocale !== null) {
foreach ($attributes[$attr . '_lang'] as $attrTrans) {
if (in_array($chatLocale, $attrTrans['languages']) && $attrTrans['content'] != '') {
Expand All @@ -530,6 +532,14 @@ public function translate() {
$this->$attr = $attributes[$attr];
}
}

if ($translated === false && !empty($defaultSiteAccess) && $siteAccess !== $defaultSiteAccess) {
if (in_array($attr,$attributesDirect)) {
$this->$attr = '';
} elseif (isset($attributes[$attr])) {
unset($attributes[$attr]);
}
}
}

$this->bot_configuration_array = $attributes;
Expand Down

0 comments on commit a023ab8

Please sign in to comment.