? ? Success

User tests: Successful: Unsuccessful:

avatar bahl24
bahl24
10 Feb 2019

Signed-off-by: Nitish Bahl nitishbahl24@gmail.com

Pull Request for Issue #23850 .

Summary of Changes

Added style for class=red in templates/cassiopeia/scss/blocks/_alerts.scss
Required for administrator/language/en-GB/en-GB.com_languages.ini.

avatar bahl24 bahl24 - open - 10 Feb 2019
avatar bahl24 bahl24 - change - 10 Feb 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Feb 2019
Category Front End Templates (site)
avatar bahl24
bahl24 - comment - 10 Feb 2019

Not sure if we need a red background as in joomla-alert type=danger, as in an error alert

avatar infograf768
infograf768 - comment - 10 Feb 2019

I suggest to rather modify the string instead of adding a red colour as the class red in the string is a remnant of 2.5
I.e. Change
COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page.<br><strong class=\"red\">Warning!</strong> When using the multilingual functionality (ie when the plugin System - Language Filter is enabled) the Site Default Language also has to be a published Content language."
to
COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page.<br><strong>Warning!</strong> When using the multilingual functionality (ie when the plugin System - Language Filter is enabled) the Site Default Language also has to be a published Content language."

avatar kofaysi
kofaysi - comment - 10 Feb 2019

Shouldn't it be two messages (two strings) in fact? One us about successful action "save". The other is the "multilingual" warning or notice. I think a warning with a green (as in valid, succesfull, OK) is just obscure.

Can multiple support be detected programmatically?

avatar infograf768
infograf768 - comment - 10 Feb 2019

Can multiple support be detected programmatically?

yes.
We can modify /administrator/components/com_languages/Controller/InstalledController.php
From line 53-54

			$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
			$type = 'message';

to

			if (Multilanguage::isEnabled())
			{
				$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_MULTILANG_SAVED');
				$type = 'message';
			}
			else
			{
				$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
				$type = 'message';
			}

Then modify the string
COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page."

And add a new one with a modified former text value.

"COM_LANGUAGES_MSG_DEFAULT_MULTILANG_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page.<br><strong>Warning!</strong> The Site Default Language also has to be a published Content language."

Imho, the Warning in bold is sufficient.

avatar bahl24
bahl24 - comment - 10 Feb 2019

Ok @infograf768 @kofaysi let me work on this and make the changes you suggested

avatar kofaysi
kofaysi - comment - 10 Feb 2019

I would go for (inspired by the code by @infograf768 )

			$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
			$type = 'message';

			if (Multilanguage::isEnabled())
			{
				$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_MULTILANG_WARNING');
				$type = 'notice'; //or warning?
			}

Then modify the string
COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page."

And add a new one with a modified former text value.

"COM_LANGUAGES_MSG_DEFAULT_MULTILANG_WARNING="The Site Default Language also has to be a published Content language."

  1. Separating the two messages makes it easier to manipulate any of them in the future.
  2. It clearly distinguishes a message and a warning from each other.

mic drop :) I'll let you work, dear @bahl24

avatar infograf768
infograf768 - comment - 11 Feb 2019

@kofaysi
Your proposal will not work. Only one message will be displayed and it will be the second one when site is multilang.

EDIT: the way to do it would rather be

			if (Multilanguage::isEnabled())
			{
				$this->app->enqueueMessage(Text::_('COM_LANGUAGES_MSG_DEFAULT_MULTILANG_WARNING'), 'warning');
			}

Possible not nice UI: 2 messages are displayed and have to be closed.

avatar bahl24 bahl24 - change - 11 Feb 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2019
Category Front End Templates (site) Administration com_languages Language & Strings Front End Templates (site)
avatar bahl24 bahl24 - change - 11 Feb 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2019
Category Front End Templates (site) Administration com_languages Language & Strings Administration com_languages Language & Strings
avatar bahl24
bahl24 - comment - 11 Feb 2019

@Quy removed extra spaces, kindly review.

avatar bahl24
bahl24 - comment - 12 Feb 2019

@infograf768 @Quy Kindly test this

avatar infograf768
infograf768 - comment - 13 Feb 2019

@bahl24

  1. You need to add:
    use Joomla\CMS\Language\Multilanguage;
    after
    use Joomla\CMS\Language\Language; line 16

  2. Also, I suggest to differentiate admin default language change and site language default change by using this code as the warning concerning content language is not necessary for admin

			if (Multilanguage::isEnabled())
			{
				if ($model->getState('client_id') == 0)
				{
					$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_MULTILANG_SAVED');
					$type = 'message';
				}
				else
				{
					$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
					$type = 'message';
				}
			}
			else
			{
				$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
				$type = 'message';
			}
avatar Quy
Quy - comment - 14 Feb 2019

This can be simplified as follows:

			if (Multilanguage::isEnabled() && $model->getState('client_id') == 0)
			{
				$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_MULTILANG_SAVED');
				$type = 'message';
			}
			else
			{
				$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
				$type = 'message';
			}
avatar bahl24
bahl24 - comment - 14 Feb 2019

@Quy @infograf768 @kofaysi I think the changes are finalized, kindly test them.

avatar infograf768
infograf768 - comment - 19 Feb 2019

I have tested this item successfully on fb7f377


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23851.

avatar infograf768 infograf768 - test_item - 19 Feb 2019 - Tested successfully
avatar infograf768 infograf768 - change - 19 Feb 2019
Title
[4.0]red class not defined
[4.0] adapting saved language message to different settings
avatar infograf768 infograf768 - edited - 19 Feb 2019
avatar bahl24
bahl24 - comment - 22 Feb 2019

@Quy Kindly test

avatar infograf768
infograf768 - comment - 22 Feb 2019

restarted drone

avatar bahl24
bahl24 - comment - 2 Mar 2019

@infograf768 I think all modifications are now done, restarted drone for CI tests

avatar bahl24
bahl24 - comment - 3 Mar 2019

@Quy Kindly test

avatar infograf768
infograf768 - comment - 4 Mar 2019

@wilsonge
Please merge.

avatar wilsonge wilsonge - change - 18 Mar 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-03-18 12:36:49
Closed_By wilsonge
avatar wilsonge wilsonge - close - 18 Mar 2019
avatar wilsonge wilsonge - merge - 18 Mar 2019
avatar wilsonge
wilsonge - comment - 18 Mar 2019

LGTM! Thanks!

Add a Comment

Login with GitHub to post a comment