Restructure language files

This commit is contained in:
2026-04-28 21:39:36 +02:00
parent 37bfb42834
commit dcb916d442
24 changed files with 787 additions and 688 deletions

View File

@@ -60,6 +60,7 @@ class Email extends PhpObject {
$oPHPMailer->setFrom(Settings::MAIL_FROM, 'Spotty');
$oPHPMailer->addReplyTo(Settings::MAIL_FROM, 'Spotty');
$bSuccess = true;
foreach($this->asDests as $asDest) {
//Message
$this->oTemplate->setLanguage($asDest['language'], Spot::DEFAULT_LANG);
@@ -72,7 +73,7 @@ class Email extends PhpObject {
$oPHPMailer->addCustomHeader('List-Unsubscribe-Post','List-Unsubscribe=One-Click');
//Email Content
$this->oTemplate->setTag('timezone', 'lang:city_time', self::getTimeZoneCity($asDest['timezone']));
$this->oTemplate->setTag('timezone', 'lang:time.city', self::getTimeZoneCity($asDest['timezone']));
$sHtmlMessage = $this->oTemplate->getMask();
$sPlainMessage = strip_tags(str_replace('<br />', "\n", $sHtmlMessage));
@@ -86,11 +87,10 @@ class Email extends PhpObject {
//Content
$oPHPMailer->isHTML(true);
$oPHPMailer->Subject = $this->oTemplate->getTranslator()->getTranslation($this->sTemplateName.'_subject');
$oPHPMailer->Subject = $this->oTemplate->getTranslator()->getTranslation($this->sTemplateName.'.subject');
$oPHPMailer->Body = $sHtmlMessage;
$oPHPMailer->AltBody = $sPlainMessage;
$bSuccess = true;
try {
$bSuccess = $bSuccess && $oPHPMailer->send();
}

View File

@@ -52,10 +52,10 @@ class Media extends PhpObject {
$asData = array();
if($this->iMediaId > 0) {
$bResult = $this->oDb->updateRow(self::MEDIA_TABLE, $this->iMediaId, array('comment'=>$sComment));
if(!$bResult) $sError = 'error_commit_db';
if(!$bResult) $sError = 'error.commit_db';
else $asData = $this->getInfo();
}
else $sError = 'media_no_id';
else $sError = 'media.no_id';
return Spot::getResult(($sError==''), $sError, $asData);
}
@@ -101,11 +101,11 @@ class Media extends PhpObject {
$sError = '';
$asParams = array();
if(!$this->isProjectEditable() && $sMethod!='sync') {
$sError = 'upload_mode_archived';
$sError = 'upload.mode_archived';
$asParams[] = $this->oProject->getProjectCodeName();
}
elseif($this->oDb->pingValue(self::MEDIA_TABLE, array('filename'=>$sMediaName)) && $sMethod!='sync') {
$sError = 'upload_media_exist';
$sError = 'upload.media.exists';
$asParams[] = $sMediaName;
}
else {
@@ -131,7 +131,7 @@ class Media extends PhpObject {
if($sMethod=='sync') $iMediaId = $this->oDb->insertUpdateRow(self::MEDIA_TABLE, $asDbInfo, array('filename'));
else $iMediaId = $this->oDb->insertRow(self::MEDIA_TABLE, $asDbInfo);
if(!$iMediaId) $sError = 'error_commit_db';
if(!$iMediaId) $sError = 'error.commit_db';
else {
$this->setMediaId($iMediaId);
$asParams = $this->getInfo(); //Creates thumbnail

View File

@@ -166,7 +166,7 @@ class Spot extends Main
public function getAppMainPage() {
//Cache Page List
$asPages = array_diff($this->asMasks, array('email_update', 'email_conf'));
$asPages = array_diff($this->asMasks, array('email.update', 'email.confirmation'));
if(!$this->oUser->checkUserClearance(User::CLEARANCE_ADMIN)) {
$asPages = array_diff($asPages, array('admin', 'upload'));
}
@@ -231,11 +231,12 @@ class Spot extends Main
}
private function sendEmail() {
$oEmail = new Email($this->asContext['serv_name'], 'email_update');
$oEmail = new Email($this->asContext['serv_name'], 'email.update');
$oEmail->setDestInfo($this->oUser->getActiveUsersInfo());
//Add Position
$asLastMessage = array_shift($this->getSpotMessages(array($this->oProject->getLastMessageId($this->getFeedConstraints(Feed::MSG_TABLE)))));
$asSpotMessages = $this->getSpotMessages(array($this->oProject->getLastMessageId($this->getFeedConstraints(Feed::MSG_TABLE))));
$asLastMessage = array_shift($asSpotMessages);
$oEmail->oTemplate->setTags($asLastMessage);
$oEmail->oTemplate->setTag('date_time', 'time:'.$asLastMessage['unix_time'], 'd/m/Y, H:i');
@@ -326,8 +327,8 @@ class Spot extends Main
$asUserInfo = $this->oUser->getUserInfo();
//Send Confirmation Email
if($asResult['result'] && $asResult['desc']=='lang:nl_subscribed') {
$oConfEmail = new Email($this->asContext['serv_name'], 'email_conf');
if($asResult['result'] && $asResult['desc']=='lang:newsletter.subscribed') {
$oConfEmail = new Email($this->asContext['serv_name'], 'email.confirmation');
$oConfEmail->setDestInfo($asUserInfo);
$oConfEmail->send();
}
@@ -516,7 +517,7 @@ class Spot extends Main
$asResult = array_merge($asResult, $asMarkers);
}
else $sDesc = 'mode_histo';
else $sDesc = 'project.modes.histo';
return self::getJsonResult(true, $sDesc, $asResult);
}
@@ -588,6 +589,7 @@ class Spot extends Main
);
//Replace Array Key with Item ID
$asFeeds = array();
foreach($asFeedAttrs as $sType=>$asFeedAttr) {
foreach($asFeedAttr as $asFeed) {
$asFeeds[$sType][$asFeed['id_'.$sType]] = $asFeed;
@@ -621,7 +623,7 @@ class Spot extends Main
$this->oUser->updateNickname($sName);
}
else $sDesc = 'mode_histo';
else $sDesc = 'project.modes.histo';
return self::getJsonResult(($iPostId > 0), $sDesc);
}
@@ -647,7 +649,7 @@ class Spot extends Main
$bSuccess = $this->sendEmail();
$sDesc = $bSuccess?'mail_sent':'mail_failure';
}
else $sDesc = 'error_commit_db';
else $sDesc = 'error.commit_db';
return self::getJsonResult($bSuccess, $sDesc);
}
@@ -674,7 +676,7 @@ class Spot extends Main
$sDesc = '';
$asResult = array();
if($this->oDb->isId($sField) && $sValue <= 0) return self::getJsonResult(false, $this->oLang->getTranslation('impossible_value', [$sValue, $sField]));
if($this->oDb->isId($sField) && $sValue <= 0) return self::getJsonResult(false, $this->oLang->getTranslation('error.impossible_value', [$sValue, $sField]));
switch($sType) {
case 'project':
@@ -693,7 +695,7 @@ class Spot extends Main
$bSuccess = $oProject->setActivePeriod($sValue.' 23:59:59', 'to');
break;
default:
$sDesc = $this->oLang->getTranslation('unknown_field', $sField);
$sDesc = $this->oLang->getTranslation('error.unknown_field', $sField);
}
$asResult = $oProject->getProject();
$asResult['active_from'] = substr($asResult['active_from'], 0, 10);
@@ -712,7 +714,7 @@ class Spot extends Main
$bSuccess = $oFeed->setProjectId($sValue);
break;
default:
$sDesc = $this->oLang->getTranslation('unknown_field', $sField);
$sDesc = $this->oLang->getTranslation('error.unknown_field', $sField);
}
$asResult = $oFeed->getFeed();
break;
@@ -724,12 +726,12 @@ class Spot extends Main
$sDesc = $asReturnCode['desc'];
break;
default:
$sDesc = $this->oLang->getTranslation('unknown_field', $sField);
$sDesc = $this->oLang->getTranslation('error.unknown_field', $sField);
}
$asResult = $this->oUser->getActiveUserInfo($iId);
break;
}
if(!$bSuccess && $sDesc=='') $sDesc = Mask::LANG_PREFIX.'error_commit_db';
if(!$bSuccess && $sDesc=='') $sDesc = Mask::LANG_PREFIX.'error.commit_db';
return self::getJsonResult($bSuccess, $sDesc, array($sType=>array($asResult)));
}
@@ -837,7 +839,7 @@ class Spot extends Main
$sDate = $oDate->format('d/m/Y');
$sTime = $oDate->format('H:i');
return $this->oLang->getTranslation('date_time', array($sDate, $sTime));
return $this->oLang->getTranslation('time.date_time', array($sDate, $sTime));
}
public static function getTimeZoneDayOffset($iTime, $sLocalTimeZone) {

View File

@@ -38,7 +38,7 @@ class Uploader extends UploadHandler
//Check project mode
if(!$this->oMedia->isProjectEditable()) {
$file->error = $this->get_error_message('upload_mode_archived', array($this->oMedia->getProjectCodeName()));
$file->error = $this->get_error_message('upload.mode_archived', array($this->oMedia->getProjectCodeName()));
$bResult = false;
}

View File

@@ -107,7 +107,7 @@ class User extends PhpObject {
if($iUserId > 0) {
//Just log user in
$sDesc = 'lang:nl_email_exists';
$sDesc = 'lang:newsletter.email_exists';
$bSuccess = true;
}
else {
@@ -118,9 +118,9 @@ class User extends PhpObject {
array('email')
);
if($iUserId==0) $sDesc = 'lang:error_commit_db';
if($iUserId==0) $sDesc = 'lang:error.commit_db';
else {
$sDesc = 'lang:nl_subscribed';
$sDesc = 'lang:newsletter.subscribed';
$bSuccess = true;
}
}
@@ -150,16 +150,16 @@ class User extends PhpObject {
if($bSelf || $this->checkUserClearance(self::CLEARANCE_ADMIN)) {
if($this->getUserId() > 0) {
$iUserId = $this->oDb->updateRow(self::USER_TABLE, $iUserId, array('active' => self::USER_INACTIVE));
if($iUserId==0) $sDesc = 'lang:error_commit_db';
if($iUserId==0) $sDesc = 'lang:error.commit_db';
else {
$sDesc = 'lang:nl_unsubscribed';
$sDesc = 'lang:newsletter.unsubscribed';
if($bSelf) $this->updateCookie(-60 * 60); //Set Cookie in the past, deleting it
$bSuccess = true;
}
}
else $sDesc = 'lang:nl_unknown_email';
else $sDesc = 'lang:newsletter.unknown_email';
}
else $sDesc = 'lang:no_auth';
else $sDesc = 'lang:error.no_auth';
return Spot::getResult($bSuccess, $sDesc);
}
@@ -196,7 +196,7 @@ class User extends PhpObject {
if(!in_array($iClearance, self::CLEARANCES)) $sDesc = 'Setting wrong clearance "'.$iClearance.'" to user ID "'.$iUserId.'"';
else {
$iUserId = $this->oDb->updateRow(self::USER_TABLE, $iUserId, array('clearance'=>$iClearance));
if(!$iUserId) $sDesc = 'lang:error_commit_db';
if(!$iUserId) $sDesc = 'lang:error.commit_db';
else $bSuccess = true;
}
}

View File

@@ -2,30 +2,30 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
<title>[#]lang:email_conf_subject[#]</title>
<title>[#]lang:email.confirmation.subject[#]</title>
</head>
<body>
<span style="color: transparent; display: none !important; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">[#]lang:conf_preheader[#]</span>
<span style="color: transparent; display: none !important; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">[#]lang:email.confirmation.preheader[#]</span>
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;max-width:600px;">
<tr>
<td width="20%"><img src="[#]local_server[#]images/icons/mstile-144x144.png" width="90%" border="0" alt="logo" /></td>
<td><h1>[#]lang:conf_thanks_sub[#]</h1></td>
<td><h1>[#]lang:email.confirmation.thanks_subject[#]</h1></td>
</tr>
<tr>
<td colspan="2">
<p align="justify">[#]lang:conf_body_para_1[#]</p>
<p align="justify">[#]lang:conf_body_para_2[#]</p>
<p align="justify">[#]lang:conf_body_para_3[#]</p>
<p align="justify">[#]lang:email.confirmation.body_1[#]</p>
<p align="justify">[#]lang:email.confirmation.body_2[#]</p>
<p align="justify">[#]lang:email.confirmation.body_3[#]</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>[#]lang:conf_body_conclusion[#]<br />[#]lang:conf_signature[#]</p>
<p>[#]lang:email.confirmation.conclusion[#]<br />[#]lang:email.confirmation.signature[#]</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>[#]lang:email_unsubscribe[#] <a href="[#]unsubscribe_link[#]" target="_blank" rel="noopener">[#]lang:email_unsub_btn[#]</a></p>
<p>[#]lang:email.unsubscribe[#] <a href="[#]unsubscribe_link[#]" target="_blank" rel="noopener">[#]lang:email.unsubscribe_button[#]</a></p>
</td>
</tr>
</table>

View File

@@ -2,14 +2,14 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
<title>[#]lang:email_update_subject[#]</title>
<title>[#]lang:email.update.subject[#]</title>
</head>
<body>
<span style="color: transparent; display: none !important; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">[#]lang:update_preheader[#]</span>
<span style="color: transparent; display: none !important; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">[#]lang:email.update.preheader[#]</span>
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;max-width:600px;">
<tr>
<td width="20%"><img src="[#]local_server[#]images/icons/mstile-144x144.png" width="90%" border="0" alt="logo" /></td>
<td><h1>[#]lang:update_title[#] [#]type[#] #[#]displayed_id[#]</h1></td>
<td><h1>[#]lang:email.update.title[#] [#]type[#] #[#]displayed_id[#]</h1></td>
</tr>
<tr>
<td colspan="2">
@@ -22,7 +22,7 @@
</tr>
<tr>
<td colspan="2">
<h2>[#]lang:update_latest_news[#]</h2>
<h2>[#]lang:email.update.latest_news[#]</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- [PART] news [START] -->
<tr>
@@ -39,7 +39,7 @@
</tr>
<tr>
<td colspan="2">
<p>[#]lang:email_unsubscribe[#] <a href="[#]unsubscribe_link[#]" target="_blank" rel="noopener">[#]lang:email_unsub_btn[#]</a></p>
<p>[#]lang:email.unsubscribe[#] <a href="[#]unsubscribe_link[#]" target="_blank" rel="noopener">[#]lang:email.unsubscribe_button[#]</a></p>
</td>
</tr>
</table>