User tests: Successful: Unsuccessful:
Signed-off-by: Nitish Bahl nitishbahl24@gmail.com
Pull Request for Issue #23850 .
Added style for class=red in templates/cassiopeia/scss/blocks/_alerts.scss
Required for administrator/language/en-GB/en-GB.com_languages.ini.
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Templates (site) |
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."
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?
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.
Ok @infograf768 @kofaysi let me work on this and make the changes you suggested
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."
mic drop :) I'll let you work, dear @bahl24
@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.
Labels |
Added:
?
|
Category | Front End Templates (site) | ⇒ | Administration com_languages Language & Strings Front End Templates (site) |
Labels |
Added:
?
|
Category | Front End Templates (site) Administration com_languages Language & Strings | ⇒ | Administration com_languages Language & Strings |
@infograf768 @Quy Kindly test this
You need to add:
use Joomla\CMS\Language\Multilanguage;
after
use Joomla\CMS\Language\Language;
line 16
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';
}
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';
}
@Quy @infograf768 @kofaysi I think the changes are finalized, kindly test them.
I have tested this item
Title |
|
restarted drone
@infograf768 I think all modifications are now done, restarted drone for CI tests
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-03-18 12:36:49 |
Closed_By | ⇒ | wilsonge |
LGTM! Thanks!
Not sure if we need a red background as in joomla-alert type=danger, as in an error alert