Skip to content

Commit 1e45da2

Browse files
committed
Added translation functions for the tabs of forms.
1 parent 095ac59 commit 1e45da2

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,9 @@ function showForm() {
821821

822822
// überprüfe, ob das Template existiert, wenn nicht
823823
// dann generiere das Template
824+
825+
// Translate the title of the tab
826+
$tab['title'] = $this->lng($tab['title']);
824827

825828
if(!is_file($tab["template"])) {
826829
$app->uses('tform_tpl_generator');
@@ -849,8 +852,8 @@ function showForm() {
849852
$app->tpl->setVar('form_active_tab',$active_tab);
850853

851854
// Set form title
852-
$form_hint = '<b>'.$this->formDef["title"].'</b>';
853-
if($this->formDef["description"] != '') $form_hint .= '<br><br>'.$this->formDef["description"];
855+
$form_hint = '<b>'.$this->lng($this->formDef["title"]).'</b>';
856+
if($this->formDef["description"] != '') $form_hint .= '<br><br>'.$this->lng($this->formDef["description"]);
854857
$app->tpl->setVar('form_hint',$form_hint);
855858

856859
// Set Wordbook for this form
@@ -1020,6 +1023,19 @@ function getNextTab() {
10201023
function getCurrentTab() {
10211024
return $_SESSION["s"]["form"]["tab"];
10221025
}
1026+
1027+
1028+
// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
1029+
function lng($msg) {
1030+
global $app;
1031+
1032+
if(isset($this->wordbook[$msg])) {
1033+
return $this->wordbook[$msg];
1034+
} else {
1035+
return $app->lng($msg);
1036+
}
1037+
1038+
}
10231039

10241040
}
10251041

interface/web/content.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
$page = $_REQUEST["s_pg"];
3636

3737
if(!preg_match("/^[a-z]{0,20}$/i", $module)) die('module name contains unallowed chars.');
38-
if(!preg_match("/^[a-z]{0,20}$/i", $page)) die('module name contains unallowed chars.');
38+
if(!preg_match("/^[a-z]{0,20}$/i", $page)) die('page name contains unallowed chars.');
3939

4040
if(is_file("$module/$page.php")) {
4141

@@ -52,7 +52,7 @@
5252
$module = $target_parts[0];
5353
$page = $target_parts[1];
5454
if(!preg_match("/^[a-z]{2,20}$/i", $module)) die('target module name contains unallowed chars.');
55-
if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('target module name contains unallowed chars.');
55+
if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('target page name contains unallowed chars.');
5656

5757
if(is_file("$module/$page.php")) {
5858
include_once("$module/$page.php");

0 commit comments

Comments
 (0)