Smarty template updates for testing, edit templates updates, translation strings update

This commit is contained in:
Clemens Schwaighofer
2022-04-06 14:51:21 +09:00
parent e5309b5dbc
commit 4b0e9b44c3
13 changed files with 1629 additions and 1567 deletions

View File

@@ -33,3 +33,6 @@ msgstr "I should be translated: I WAS TRANSLATED"
msgid "Are we translated?" msgid "Are we translated?"
msgstr "Are we translated? Yes, we are!" msgstr "Are we translated? Yes, we are!"
msgid "Original with string: %1"
msgstr "Translated with: %1"

View File

@@ -75,3 +75,5 @@ msgstr "「スマーティー」これは正しいです"
msgid "Are we translated?" msgid "Are we translated?"
msgstr "「クラス」これは翻訳です?" msgstr "「クラス」これは翻訳です?"
msgid "Original with string: %1"
msgstr "%1と翻訳した"

View File

@@ -65,16 +65,26 @@ if ($smarty->USE_PROTOTYPE) {
$smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js'; $smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js';
} }
$smarty->PAGE_WIDTH = '100%'; $smarty->PAGE_WIDTH = '100%';
// require BASE.INCLUDES.'admin_set_paths.php';
$smarty->setSmartyPaths(); $smarty->setSmartyPaths();
// smarty test // smarty test
$smarty->DATA['SMARTY_TEST'] = 'Test Data'; $smarty->DATA['SMARTY_TEST'] = 'Test Data';
$smarty->DATA['TRANSLATE_TEST'] = $l->__('Are we translated?'); $smarty->DATA['TRANSLATE_TEST'] = $l->__('Are we translated?');
$smarty->DATA['TRANSLATE_TEST_SMARTY'] = $smarty->l10n->__('Are we translated?'); $smarty->DATA['TRANSLATE_TEST_SMARTY'] = $smarty->l10n->__('Are we translated?');
$smarty->DATA['replace'] = 'Replaced';
// variable variables
$smarty->DATA['test'] = 'foo';
$smarty->DATA['foo'] = 'bar';
// loop
$smarty->DATA['loop_start'] = 5;
// drop down test with optgroups // drop down test with optgroups
$options = [ $smarty->DATA['drop_down_test'] = [
'foo' => 'Foo',
'bar' => 'Bar',
'foobar' => 'Foo Bar',
];
$smarty->DATA['drop_down_test_selected'] = 'bar';
$smarty->DATA['drop_down_test_nested'] = [
'' => '選択してください', '' => '選択してください',
'4/25(木)' => [ '4/25(木)' => [
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50', '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
@@ -89,11 +99,26 @@ $options = [
'4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00' '4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00'
], ],
]; ];
$smarty->DATA['drop_down_test_nested_selected'] = '';
$smarty->DATA['radio_test'] = [
'0' => 'On',
'1' => 'Off',
'-1' => 'Undefined'
];
$smarty->DATA['radio_test_selected'] = -1;
$smarty->DATA['checkbox_test'] = [
'0' => 'On',
'1' => 'Off',
'-1' => 'Undefined'
];
$smarty->DATA['checkbox_test_pos'] = [
'0' => 'A',
'1' => 'B'
];
$smarty->DATA['checkbox_test_selected'] = ['1', '-1'];
$smarty->DATA['checkbox_test_pos_selected'] = ['0', '-1'];
$smarty->DATA['drop_down_test'] = $options;
$smarty->DATA['drop_down_test_selected'] = '';
$smarty->DATA['loop_start'] = 2;
// require BASE.INCLUDES.'admin_smarty.php';
$smarty->setSmartyVarsAdmin(); $smarty->setSmartyVarsAdmin();
// error message // error message

Binary file not shown.

Binary file not shown.

View File

@@ -33,26 +33,26 @@ function pop(theURL, winName, features) {
<!-- ERROR MSG END //--> <!-- ERROR MSG END //-->
<!-- TOP MENU START //--> <!-- TOP MENU START //-->
<tr> <tr>
<td width="{$table_width}" class="menu_bgcolor" valign="top"> <td width="{$table_width}" class="menu_bgcolor" valign="top">
<table width="100%" border="0" cellpadding="2" cellspacing="1"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
<form method="post"> <form method="post">
<tr> <tr>
<td bgcolor="{$HEADER_COLOR}" class="normal"> <td bgcolor="{$HEADER_COLOR}" class="normal">
Hello <b>{$USER_NAME|upper}</b> [{$EUID}] from the group <b>{$GROUP_NAME}</b> with Access Level <b>{$GROUP_LEVEL}</b> Hello <b>{$USER_NAME|upper}</b> [{$EUID}] from the group <b>{$GROUP_NAME}</b> with Access Level <b>{$GROUP_LEVEL}</b>
</td> </td>
<td bgcolor="{$HEADER_COLOR}" class="normal" align="right"> <td bgcolor="{$HEADER_COLOR}" class="normal" align="right">
<input type="submit" name="login_logout" value="Logout"> <input type="submit" name="login_logout" value="Logout">
</td> </td>
</tr> </tr>
</form> </form>
</table> </table>
<table width="100%" border="0" cellpadding="2" cellspacing="1"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
<tr> <tr>
{* foreach menu *} {* foreach menu *}
{foreach from=$menu_data item=menu_element} {foreach from=$menu_data item=menu_element}
{* if split factor is reached *} {* if split factor is reached *}
{if $menu_element.splitfactor_in} {if $menu_element.splitfactor_in}
<td class="menu_fgcolor" class="small" valign="top"> <td class="menu_fgcolor" class="small" valign="top">
{/if} {/if}
{if $menu_element.position} {if $menu_element.position}
<b><a href="{$menu_element.filename}">{$menu_element.pagename}</a></b><br> <b><a href="{$menu_element.filename}">{$menu_element.pagename}</a></b><br>
@@ -67,22 +67,22 @@ function pop(theURL, winName, features) {
</td> </td>
{/if} {/if}
{/foreach} {/foreach}
</tr> </tr>
</table> </table>
<table width="100%" border="0" cellpadding="10" cellspacing="1"> <table width="100%" border="0" cellpadding="10" cellspacing="1">
<tr> <tr>
<td class="edit_fgcolor_alt" class="headline" align="center"> <td class="edit_fgcolor_alt" class="headline" align="center">
{$page_name} {$page_name}
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<!-- TOP MENU END //--> <!-- TOP MENU END //-->
<tr> <tr>
<td width="{$table_width}" class="edit_bgcolor"> <td width="{$table_width}" class="edit_bgcolor">
<form method="post" name="edit_form" style="margin-block-end: 0em;"> <form method="post" name="edit_form" style="margin-block-end: 0em;">
<table width="100%" border="0" cellpadding="2" cellspacing="1"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
<!-- LOAD START //--> <!-- LOAD START //-->
{include file="edit_load.tpl"} {include file="edit_load.tpl"}
<!-- LOAD END //--> <!-- LOAD END //-->
@@ -93,23 +93,23 @@ function pop(theURL, winName, features) {
{if $form_yes} {if $form_yes}
{include file="edit_save_delete.tpl"} {include file="edit_save_delete.tpl"}
{if $form_my_page_name == "edit_pages" && $filename_exist} {if $form_my_page_name == "edit_pages" && $filename_exist}
<tr> <tr>
<td class="edit_fgcolor" class="normal"> <td class="edit_fgcolor" class="normal">
Filename: Filename:
</td> </td>
<td class="edit_fgcolor" class="normal"> <td class="edit_fgcolor" class="normal">
{$filename} {$filename}
<input type="hidden" name="filename" value="{$filename}"> <input type="hidden" name="filename" value="{$filename}">
</td> </td>
</tr> </tr>
{/if} {/if}
{include file="edit_elements.tpl"} {include file="edit_elements.tpl"}
{include file="edit_hidden.tpl"} {include file="edit_hidden.tpl"}
{include file="edit_save_delete.tpl"} {include file="edit_save_delete.tpl"}
{/if} {/if}
</table> </table>
</form> </form>
</td> </td>
</tr> </tr>
</table> </table>
</body> </body>

View File

@@ -8,16 +8,16 @@
******************************************************************** ********************************************************************
*} *}
<tr> <tr>
<td class="edit_fgcolor_alt" class="normal"> <td class="edit_fgcolor_alt" class="normal">
{t}Create new media:{/t} {t}Create new media:{/t}
</td> </td>
<td class="edit_fgcolor_alt" class="normal"> <td class="edit_fgcolor_alt" class="normal">
{if $new.show_checkbox} {if $new.show_checkbox}
<input type="checkbox" name="really_new" value="yes">&nbsp;{t}really{/t}&nbsp; <input type="checkbox" name="really_new" value="yes">&nbsp;{t}really{/t}&nbsp;
{else} {else}
<input type="hidden" name="really_new" value="yes"> <input type="hidden" name="really_new" value="yes">
{/if} {/if}
<input type="submit" name="new" value="{$new.new_name}"> <input type="submit" name="new" value="{$new.new_name}">
</td> </td>
</tr> </tr>

View File

@@ -25,7 +25,7 @@
<!-- ERROR MSG END //--> <!-- ERROR MSG END //-->
<!-- BODY START //--> <!-- BODY START //-->
<tr> <tr>
<td class="edit_bgcolor"> <td class="edit_bgcolor">
<table width="100%" border="0" cellpadding="2" cellspacing="1"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
<!-- ANFANG Neu //--> <!-- ANFANG Neu //-->
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
@@ -68,7 +68,7 @@
</form> </form>
<!-- ENDE FOOTER //--> <!-- ENDE FOOTER //-->
</table> </table>
</td> </td>
</tr> </tr>
<!-- BODY END //--> <!-- BODY END //-->
</table> </table>

View File

@@ -26,7 +26,7 @@
<input type="submit" name="delete" value="{t}Delete{/t}"> <input type="submit" name="delete" value="{t}Delete{/t}">
{else} {else}
<td class="edit_fgcolor_alt" class="normal"> <td class="edit_fgcolor_alt" class="normal">
&nbsp; &nbsp;
{/if} {/if}
</td> </td>
</tr> </tr>

View File

@@ -1,16 +1,27 @@
<div> <div>
{$SMARTY_TEST} SMARTY_TEST: {$SMARTY_TEST}
</div> </div>
<div> <div {popup width="250" caption="Info" text="Text block<br>Control"} style="border: 1px solid black; margin: 5px 0 5px 0; padding: 5px;">
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST} POPUP HERE (hover mouse)
</div> </div>
<div> <div>
<b>Outside translation test</b><br>
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}<br>
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY} TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
</div> </div>
<div> <div>
<select id="drop_down_test" name="drop_down_test"> <b>Translate Test with replace:</b><br>
{html_options options=$drop_down_test selected=$drop_down_test_selected} ORIGINAL: Original with string: %1 ({$replace})<br>
</select> TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}
</div>
<div>
<b>Variable variables:</b><br>
Test: {$test}<br>
Foo: {$foo}<br>
{assign var="bar" value="test"}
vFoo ($test = $foo = bar): {$test|getvar}<br>
vFoo ($bar = $test = foo): {$bar|getvar}
</div> </div>
<div class="jq-container"> <div class="jq-container">
<div id="jq-test" class="jp-test"> <div id="jq-test" class="jp-test">
@@ -23,11 +34,30 @@
</div> </div>
</div> </div>
<div class="loop-test"> <div class="loop-test">
<div>LOOP TEST</div> <div><b>LOOP TEST</b></div>
{section name=page_list start=1 loop=$loop_start+1} {section name=page_list start=1 loop=$loop_start+1}
<div>LOOP OUTPUT: {$smarty.section.page_list.index}</div> <div>LOOP OUTPUT: {$smarty.section.page_list.index}</div>
{/section} {/section}
</div> </div>
<div>
<select id="drop_down_test" name="drop_down_test">
{html_options options=$drop_down_test selected=$drop_down_test_selected}
</select>
</div>
<div>
<select id="drop_down_test_nested" name="drop_down_test_nested">
{html_options options=$drop_down_test_nested selected=$drop_down_test_nested_selected}
</select>
</div>
<div>
{html_radios name="radio_test" options=$radio_test selected=$radio_test_selected}
</div>
<div>
{html_checkboxes name="checkbox_test" options=$checkbox_test selected=$checkbox_test_selected}
</div>
<div>
{html_checkboxes name="checkbox_test_pos" options=$checkbox_test selected=$checkbox_test_pos_selected pos=$checkbox_test_pos}
</div>
{* progresss indicator *} {* progresss indicator *}
<div id="indicator"></div> <div id="indicator"></div>
{* the action confirm box *} {* the action confirm box *}

File diff suppressed because it is too large Load Diff

View File

@@ -198,20 +198,21 @@ class SmartyExtend extends SmartyBC
{ {
// just emergency fallback for language // just emergency fallback for language
// set encoding // set encoding
if (isset($_SESSION['DEFAULT_CHARSET'])) { if (!empty($_SESSION['DEFAULT_CHARSET'])) {
$this->encoding = $_SESSION['DEFAULT_CHARSET']; $this->encoding = $_SESSION['DEFAULT_CHARSET'];
} else { } else {
$this->encoding = DEFAULT_ENCODING; $this->encoding = DEFAULT_ENCODING;
} }
// gobal override // gobal override
if (isset($GLOBALS['OVERRIDE_LANG'])) { if (!empty($GLOBALS['OVERRIDE_LANG'])) {
$this->lang = $GLOBALS['OVERRIDE_LANG']; $this->lang = $GLOBALS['OVERRIDE_LANG'];
} elseif (isset($_SESSION['DEFAULT_LANG'])) { } elseif (!empty($_SESSION['DEFAULT_LANG'])) {
// session (login) // session (login)
$this->lang = $_SESSION['DEFAULT_LANG']; $this->lang = $_SESSION['DEFAULT_LANG'];
} else { } else {
// mostly default SITE LANG or DEFAULT LANG // mostly default SITE LANG or DEFAULT LANG
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG; $this->lang = defined('SITE_LANG') && !empty('SITE_LANG') ?
SITE_LANG : DEFAULT_LANG;
} }
// create the char lang encoding // create the char lang encoding
$this->lang_short = substr($this->lang, 0, 2); $this->lang_short = substr($this->lang, 0, 2);

View File

@@ -195,20 +195,21 @@ class SmartyExtend4 extends Smarty
{ {
// just emergency fallback for language // just emergency fallback for language
// set encoding // set encoding
if (isset($_SESSION['DEFAULT_CHARSET'])) { if (!empty($_SESSION['DEFAULT_CHARSET'])) {
$this->encoding = $_SESSION['DEFAULT_CHARSET']; $this->encoding = $_SESSION['DEFAULT_CHARSET'];
} else { } else {
$this->encoding = DEFAULT_ENCODING; $this->encoding = DEFAULT_ENCODING;
} }
// gobal override // gobal override
if (isset($GLOBALS['OVERRIDE_LANG'])) { if (!empty($GLOBALS['OVERRIDE_LANG'])) {
$this->lang = $GLOBALS['OVERRIDE_LANG']; $this->lang = $GLOBALS['OVERRIDE_LANG'];
} elseif (isset($_SESSION['DEFAULT_LANG'])) { } elseif (!empty($_SESSION['DEFAULT_LANG'])) {
// session (login) // session (login)
$this->lang = $_SESSION['DEFAULT_LANG']; $this->lang = $_SESSION['DEFAULT_LANG'];
} else { } else {
// mostly default SITE LANG or DEFAULT LANG // mostly default SITE LANG or DEFAULT LANG
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG; $this->lang = defined('SITE_LANG') && !empty('SITE_LANG') ?
SITE_LANG : DEFAULT_LANG;
} }
// create the char lang encoding // create the char lang encoding
$this->lang_short = substr($this->lang, 0, 2); $this->lang_short = substr($this->lang, 0, 2);