From 9af51c09897770ae1cf6d14e7e78b138d0555a29 Mon Sep 17 00:00:00 2001 From: Jean-Marie Simonet Date: Mon, 21 Mar 2016 11:48:26 +0100 Subject: [PATCH 1/2] Adding confirm alert and notice when saving translation --- .../admin/language/en-GB/en-GB.com_localise.ini | 3 +++ .../language/en-GB/en-GB.com_localise.sys.ini | 2 +- component/admin/models/forms/translation.xml | 11 ++++++++--- component/admin/models/translation.php | 14 ++++++++++++++ component/admin/views/translation/tmpl/edit.php | 10 +++++++++- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/component/admin/language/en-GB/en-GB.com_localise.ini b/component/admin/language/en-GB/en-GB.com_localise.ini index 5395665d..146b8416 100644 --- a/component/admin/language/en-GB/en-GB.com_localise.ini +++ b/component/admin/language/en-GB/en-GB.com_localise.ini @@ -161,6 +161,7 @@ COM_LOCALISE_CANNOT_REMOVE_DEFAULT_LANGUAGE="Localise cannot remove default lang COM_LOCALISE_ACCESS_TRANSLATION_EDIT="Translate" COM_LOCALISE_ACCESS_TRANSLATION_EDIT_DESC="Translate description" +COM_LOCALISE_CONFIRM_TRANSLATION_SAVE="Before saving, make sure you have set the translation as 'Complete' or not in the 'Details' tab." COM_LOCALISE_ERROR_TRANSLATION_FILESAVE="Error saving translation file %s" COM_LOCALISE_FIELDSET_TRANSLATION_DETAIL="Details" COM_LOCALISE_FIELDSET_TRANSLATION_DETAIL_DESC="Values ​​of inactive fields are set in general settings of Localise component." @@ -195,6 +196,8 @@ COM_LOCALISE_LABEL_TRANSLATION_SOURCE="File Source" COM_LOCALISE_LABEL_TRANSLATION_SOURCE_DESC="Press Ctrl-Q to toggle Full Screen editing." COM_LOCALISE_LABEL_TRANSLATION_VERSION="Version" COM_LOCALISE_LABEL_TRANSLATION_VERSION_DESC="" +COM_LOCALISE_NOTICE_TRANSLATION_COMPLETE="The transation file has been saved as 'Complete'." +COM_LOCALISE_NOTICE_TRANSLATION_NOT_COMPLETE="The transation file has not been saved as 'Complete'." COM_LOCALISE_TEXT_TRANSLATION_EDITOR="%1$s (%2$s)" COM_LOCALISE_TEXT_TRANSLATION_NOTINREFERENCE="Not in reference" COM_LOCALISE_TEXT_TRANSLATION_TRANSLATED="Translated" diff --git a/component/admin/language/en-GB/en-GB.com_localise.sys.ini b/component/admin/language/en-GB/en-GB.com_localise.sys.ini index 94b01b70..a3f21d06 100644 --- a/component/admin/language/en-GB/en-GB.com_localise.sys.ini +++ b/component/admin/language/en-GB/en-GB.com_localise.sys.ini @@ -13,6 +13,6 @@ COM_LOCALISE_ERROR_INSTALL_JVERSION="The Localise component requires version %s COM_LOCALISE_LANGUAGES="Languages" COM_LOCALISE_TRANSLATIONS="Translations" COM_LOCALISE_PACKAGES="Packages" -COM_LOCALISE_XML_DESCRIPTION="

Successfully installed Localise component

Nice and easy management of languages and translation files.

This component works on the language translation files of your Joomla installation - it will not work without reading, writing and renaming rights on the language directories and files.

YOU SHOULD MAKE A BACKUP OF YOUR LANGUAGE FILES

" +COM_LOCALISE_XML_DESCRIPTION="

Successfully installed Localise component

Nice and easy management of languages and translation files.

This component works on the language translation files of your Joomla installation - it will not work without reading, writing and renaming rights on the language directories and files.

YOU SHOULD MAKE A BACKUP OF YOUR LANGUAGE FILES

" COM_LOCALISE_LABEL_LANGUAGE_EMAIL="Author Email" COM_LOCALISE_LABEL_LANGUAGE_URL="Author URL" diff --git a/component/admin/models/forms/translation.xml b/component/admin/models/forms/translation.xml index 9bd1bc41..3ce01e72 100644 --- a/component/admin/models/forms/translation.xml +++ b/component/admin/models/forms/translation.xml @@ -58,11 +58,16 @@ description="COM_LOCALISE_LABEL_TRANSLATION_LICENSE_DESC" /> + description="COM_LOCALISE_LABEL_TRANSLATION_COMPLETE_DESC"> + + + setState('translation.complete', 1); $contents2 .= "; @note Complete\n"; } + else + { + $this->setState('translation.complete', 0); + } $contents2 .= "; @note Client " . ucfirst($client) . "\n"; $contents2 .= "; @note All ini files need to be saved as UTF-8\n\n"; @@ -1541,6 +1546,15 @@ public function save($data) return false; } + if ($this->getState('translation.complete') == 1) + { + JFactory::getApplication()->enqueueMessage(JText::_('COM_LOCALISE_NOTICE_TRANSLATION_COMPLETE'), 'notice'); + } + else + { + JFactory::getApplication()->enqueueMessage(JText::_('COM_LOCALISE_NOTICE_TRANSLATION_NOT_COMPLETE'), 'notice'); + } + return true; } } diff --git a/component/admin/views/translation/tmpl/edit.php b/component/admin/views/translation/tmpl/edit.php index 09b7ec3e..e1bb8b53 100644 --- a/component/admin/views/translation/tmpl/edit.php +++ b/component/admin/views/translation/tmpl/edit.php @@ -93,6 +93,7 @@ // Prepare Bing translation JText::script('COM_LOCALISE_BINGTRANSLATING_NOW'); +JText::script('COM_LOCALISE_CONFIRM_TRANSLATION_SAVE'); ?>