Skip to content

Commit

Permalink
Merge pull request #310 from infograf768/complete
Browse files Browse the repository at this point in the history
New parameter to display an alert or not when saving translation
  • Loading branch information
infograf768 committed May 2, 2016
2 parents 451b7b2 + 9ce0632 commit 208a1bc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions component/admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="complete"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="COM_LOCALISE_LABEL_COMPLETE"
description="COM_LOCALISE_LABEL_COMPLETE_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="clientID"
type="text"
Expand Down
2 changes: 2 additions & 0 deletions component/admin/language/en-GB/en-GB.com_localise.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ INSTALLATION="Installation"
COM_LOCALISE_CONFIG_GLOBAL_DESC="The reference language displays the value of the original string. Default is en-GB."
COM_LOCALISE_CONFIG_GLOBAL_LABEL="Global configuration"
COM_LOCALISE_CONFIGURATION="Localise configuration"
COM_LOCALISE_LABEL_COMPLETE="Translation Complete"
COM_LOCALISE_LABEL_COMPLETE_DESC="Display or not an alert when saving a translation to remind to set the translation as <strong>Complete</strong>. Default is 'Yes'"
COM_LOCALISE_LABEL_REFERENCE_LANGUAGE="Reference language"
COM_LOCALISE_LABEL_REFERENCE_LANGUAGE_DESC="Please choose a Reference language."
COM_LOCALISE_LABEL_INSTALLATION_FOLDER="Installation folder"
Expand Down
11 changes: 10 additions & 1 deletion component/admin/views/translation/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,18 @@ function translateAll()

Joomla.submitbutton = function(task)
{
var complete = <?php echo (int) JComponentHelper::getParams('com_localise')->get('complete', 0); ?>;

if ((task == 'translation.apply' || task == 'translation.save') && document.formvalidator.isValid(document.id('localise-translation-form')))
{
if (confirm(Joomla.JText._('COM_LOCALISE_CONFIRM_TRANSLATION_SAVE')))
if (complete)
{
if (confirm(Joomla.JText._('COM_LOCALISE_CONFIRM_TRANSLATION_SAVE')))
{
Joomla.submitform(task, document.getElementById('localise-translation-form'));
}
}
else
{
Joomla.submitform(task, document.getElementById('localise-translation-form'));
}
Expand Down

0 comments on commit 208a1bc

Please sign in to comment.