Commit 51143051 authored by alain_desilets's avatar alain_desilets

- Usability improvement to Translate dialog. People tend to click on the...

- Usability improvement to Translate dialog. People tend to click on the Translate button when they want to translate updates. But before, this dialog only allowed users to translate the whole page to a new language (you had to use the translation side module for updates). So now, if you click on Translate button, you get to see a redundant instance of the Translate module inside the dialog itself. Also, rephrased some of the captions for the translation module, and dialog, in an attempt to make them clearer.
parent 613db4be
......@@ -8,7 +8,7 @@ if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
function module_translation_info() {
return array(
'name' => tra('Page translation'),
'name' => tra('Translate Updates'),
'description' => tra('Links to versions of the wiki page being viewed in other languages, distinguishing between better, equivalent or worse translations. Optionally displays the up-to-dateness of the translation being viewed.'),
'prefs' => array("feature_translation"),
'params' => array(
......@@ -31,9 +31,13 @@ function filter_languages_from_pivot( $langInfo ) {
}
function module_translation( $mod_reference, $module_params ) {
global $pivotLanguage, $tikilib, $smarty, $prefs, $page;
global $pivotLanguage, $tikilib, $smarty, $prefs, $page, $_REQUEST;
if ((!$page or $page == '') and isset($_REQUEST['page'])) {
$page = $_REQUEST['page'];
}
$smarty->assign( 'show_translation_module', false);
if( ! empty( $page ) && is_string($page) ) {
global $multilinguallib;
......@@ -67,7 +71,7 @@ function module_translation( $mod_reference, $module_params ) {
}
unset( $completeList[$transinfo['page_id']] );
$smarty->assign( 'show_translation_module', ! empty( $completeList ) );
if (empty( $completeList )) {
return;
......
......@@ -14,7 +14,7 @@
{/if}
{if $mod_translation_better_known or $mod_translation_better_other}
<div>
{tr}Better translations:{/tr}
{tr}Import from these:{/tr}
{if $mod_translation_better_known}
<ul>
{foreach item=better from=$mod_translation_better_known}
......@@ -78,7 +78,7 @@
{/if}
{if $mod_translation_worst_known or $mod_translation_worst_other}
<div>
{tr}Translations that need improvement:{/tr}
{tr}Export to these:{/tr}
{if $mod_translation_worst_known}
<ul>
{foreach item=worst from=$mod_translation_worst_known}
......
......@@ -27,6 +27,33 @@
{/if}
{if $langpage}
<ul>
<li><a href="#translate_updates">{tr}Translate updates made on this page or one of its translations{/tr}</a></li>
<li><a href="#new_translation">{tr}Translate this page to a new language{/tr}</a></li>
<li><a href="#attach_detach_translations">{tr}Attach or detach existing translations of this page{/tr}</a></li>
<li><a href="#change_language">{tr}Change language of this page{/tr}</a></li>
</ul>
<hr>
<a name="translate_updates"></a>
<h3>{tr}Translate updates to this page or its translations{/tr}</h3>
<div style="width:50%">
{include file='modules/mod-translation.tpl'}
</div>
<br>
<hr>
<br>
<a name="#new_translation"></a>
<h3>{tr}Translate this page to a new language{/tr}</h3>
<form method="post" action="tiki-editpage.php" onsubmit="return validate_translation_request(this)">
<p>{tr}Select language to translate to:{/tr}
<select name="lang" id="language_list" size="1">
......@@ -39,8 +66,12 @@
</select>
<br />{tr}Enter the page title:{/tr} <input type="text" size="40" name="page" id="translation_name"/><input type="hidden" name="translationOf" value="{$name|escape}"/>
{if $prefs.feature_categories eq 'y'}
<P>
{tr}Below, assign categories to this new translation (Note: they should probably be the same as the categories of the page being translate){/tr}
<br>
{include file="categorize.tpl" notable=y}
{/if}
<p>
<input type="submit" value="{tr}Create translation{/tr}"/></p>
<textarea name="edit" style="display:none">{$translate_message}{$pagedata|escape:'htmlall':'UTF-8'}</textarea>
</form>
......@@ -80,51 +111,57 @@ function validate_translation_request() {
}
// -->
{/literal}
</script>
{if !isset($allowed_for_staging_only)}
{if ($articles and ($articles|@count ge '1')) or ($pages|@count ge '1')}
{* only show if there are articles or pages to select *}
<p>{tr}Or{/tr}</p>
<form action="tiki-edit_translation.php" method="post">
<input type="hidden" name="id" value="{$id}" />
<input type="hidden" name="type" value="{$type|escape}" />
<input type="hidden" name="page" value="{$name|escape}" />
<p>{tr}Add existing page as a translation of this page:{/tr}<br />
{if $articles}
<select name="srcId">{section name=ix loop=$articles}{if !empty($articles[ix].lang) and $langpage ne $articles[ix].lang}<option value="{$articles[ix].articleId|escape}" {if $articles[ix].articleId == $srcId}checked="checked"{/if}>{$articles[ix].title|truncate:80:"(...)":true|escape}</option>{/if}{/section}</select>
{else}
<select name="srcName" id="existing-page-src">{section name=ix loop=$pages}<option value="{$pages[ix].pageName|escape}" {if $pages[ix].pageName == $srcId}checked="checked"{/if}>{$pages[ix].pageName|truncate:80:"(...)":true|escape} ({$pages[ix].lang|escape})</option>{/section}</select>
{/if}
&nbsp;
<input type="submit" class="wikiaction" name="set" value="{tr}Go{/tr}"/>
</script>
</form>
</p>{/if}
{/if}
{if $trads|@count > 1}
{if !empty($langpage)}
<hr />
<br />
<h3>{tr}Manage existing translations of this page{/tr}</h3>
<table class="normal">
<tr><th>{tr}Language{/tr}</th><th>{tr}Page{/tr}</th><th>{tr}Actions{/tr}</th></tr>
{cycle values="odd,even" print=false}
{section name=i loop=$trads}
<tr class="{cycle}">
<td>{$trads[i].langName}</td>
<td>{if $type == 'wiki page'}<a href="tiki-index.php?page={$trads[i].objName|escape:url}&bl=n">{else}<a href="tiki-read_article.php?articleId={$trads[i].objId|escape:url}">{/if}{$trads[i].objName|escape}</a></td>
<td>
{if $tiki_p_detach_translation eq 'y' }
<a rel="nofollow" class="link" href="tiki-edit_translation.php?detach&amp;page={$name|escape}&amp;id={$id|escape:url}&amp;srcId={$trads[i].objId|escape:url}&amp;type={$type|escape:url}">{icon _id='cross' alt='{tr}detach{/tr}'}</a>
{/if}
</td></tr>
{/section}
</table>
<br />
<hr />
<br />
<a name="attach_detach_translations"></a>
<h3>{tr}Attach or detach existing translations of this page{/tr}</h3>
<table class="normal">
<tr><th>{tr}Language{/tr}</th><th>{tr}Page{/tr}</th><th>{tr}Actions{/tr}</th></tr>
{cycle values="odd,even" print=false}
{section name=i loop=$trads}
<tr class="{cycle}">
<td>{$trads[i].langName}</td>
<td>{if $type == 'wiki page'}<a href="tiki-index.php?page={$trads[i].objName|escape:url}&bl=n">{else}<a href="tiki-read_article.php?articleId={$trads[i].objId|escape:url}">{/if}{$trads[i].objName|escape}</a></td>
<td>
{if $tiki_p_detach_translation eq 'y' }
<a rel="nofollow" class="link" href="tiki-edit_translation.php?detach&amp;page={$name|escape}&amp;id={$id|escape:url}&amp;srcId={$trads[i].objId|escape:url}&amp;type={$type|escape:url}">{icon _id='cross' alt='{tr}detach{/tr}'}</a>
{/if}
</td></tr>
{/section}
</table>
{/if}
{if !isset($allowed_for_staging_only)}
{if ($articles and ($articles|@count ge '1')) or ($pages|@count ge '1')}
{* only show if there are articles or pages to select *}
<form action="tiki-edit_translation.php" method="post">
<input type="hidden" name="id" value="{$id}" />
<input type="hidden" name="type" value="{$type|escape}" />
<input type="hidden" name="page" value="{$name|escape}" />
<p>{tr}Add existing page as a translation of this page:{/tr}<br />
{if $articles}
<select name="srcId">{section name=ix loop=$articles}{if !empty($articles[ix].lang) and $langpage ne $articles[ix].lang}<option value="{$articles[ix].articleId|escape}" {if $articles[ix].articleId == $srcId}checked="checked"{/if}>{$articles[ix].title|truncate:80:"(...)":true|escape}</option>{/if}{/section}</select>
{else}
<select name="srcName" id="existing-page-src">{section name=ix loop=$pages}<option value="{$pages[ix].pageName|escape}" {if $pages[ix].pageName == $srcId}checked="checked"{/if}>{$pages[ix].pageName|truncate:80:"(...)":true|escape} ({$pages[ix].lang|escape})</option>{/section}</select>
{/if}
&nbsp;
<input type="submit" class="wikiaction" name="set" value="{tr}Go{/tr}"/>
</form>
</p>
{/if}
{/if}
<br>
<hr>
<a name="change_language"></a>
<h3>{tr}Change language for this page{/tr}</h3>
<form method="post" action="tiki-edit_translation.php">
<div>
......
......@@ -15,6 +15,9 @@
require_once('tiki-setup.php');
include_once('lib/multilingual/multilinguallib.php');
include_once('modules/mod-func-translation.php');
execute_module_translation();
if ($prefs['feature_multilingual'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_multilingual");
......@@ -22,6 +25,10 @@ if ($prefs['feature_multilingual'] != 'y') {
die;
}
if (isset($_REQUEST['page'])) {
$smarty->assign('page', $_REQUEST['page']);
}
if (!(isset($_REQUEST['page']) && $_REQUEST['page']) && !(isset($_REQUEST['id']) && $_REQUEST['id'])) {
$smarty->assign('msg',tra("No object indicated"));
$smarty->display("error.tpl");
......@@ -289,3 +296,17 @@ $smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
// Display the template
$smarty->assign('mid', 'tiki-edit_translation.tpl');
$smarty->display("tiki.tpl");
function execute_module_translation() {
$module_reference = array(
'moduleId' => null,
'name' => 'translation',
'params' => array(),
'position' => null,
'ord' => null,
);
global $modlib; require_once 'lib/modules/modlib.php';
$out = $modlib->execute_module( $module_reference );
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment