?
avatar brianteeman
brianteeman
11 Jun 2018

Steps to reproduce the issue

Spotted this testing a plugin. As can be seen in the screenshot the alert title is lowercase and it should be capitalised. I "suspect" that it is also not translatable

chrome_2018-06-11_16-41-26

avatar brianteeman brianteeman - open - 11 Jun 2018
avatar joomla-cms-bot joomla-cms-bot - change - 11 Jun 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Jun 2018
avatar dgrammatiko
dgrammatiko - comment - 11 Jun 2018

it's not the custom element: https://github.com/joomla/joomla-cms/blob/4.0-dev/media/vendor/joomla-custom-elements/js/joomla-alert.js
it's the core.js:

// Message class
if (['notice','message', 'error'].indexOf(type) > -1) {
alertClass = (type === 'notice') ? 'info' : type;
alertClass = (type === 'message') ? 'success' : alertClass;
alertClass = (type === 'error') ? 'danger' : alertClass;
} else {
alertClass = 'info';
}

(type is lowercase in J4)

But it is still translatable: https://github.com/joomla/joomla-cms/blob/4.0-dev/media/system/js/core.js#L434

avatar brianteeman brianteeman - change - 11 Jun 2018
Title
[4.0] Alerts - custom element
[4.0] Alerts -
avatar brianteeman brianteeman - edited - 11 Jun 2018
avatar brianteeman
brianteeman - comment - 11 Jun 2018

That explains why my tests on changing the element didnt work ;)

It is only translatable though if we give translators strings to translate which if I read the js code correctly we are not

avatar dgrammatiko
dgrammatiko - comment - 11 Jun 2018

If you want to do the change the hardcoded part is here:

$alert = [
CMSApplication::MSG_EMERGENCY => 'danger',
CMSApplication::MSG_ALERT => 'danger',
CMSApplication::MSG_CRITICAL => 'danger',
CMSApplication::MSG_ERROR => 'danger',
CMSApplication::MSG_WARNING => 'warning',
CMSApplication::MSG_NOTICE => 'info',
CMSApplication::MSG_INFO => 'info',
CMSApplication::MSG_DEBUG => 'info',
'message' => 'success'
];

But if, lets say, type info is πληροφορία in greek, then we need to make sure the custom element is checking also against that string. If you patch the php part I'll make sure the js (ce and core) are also patched.

avatar ggppdk
ggppdk - comment - 11 Jun 2018

So the translating method is already called inside the JS code

And also the language strings exist
in frontend and backend language files
https://github.com/joomla/joomla-cms/blob/4.0-dev/language/en-GB/en-GB.ini#L12-L18
https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/language/en-GB/en-GB.ini#L41-L47

JHtmlBehavior::core()
libraries/cms/html/behavior.php

needs to load them

avatar ggppdk
ggppdk - comment - 11 Jun 2018

I have made a PR #20721

avatar joomla-cms-bot joomla-cms-bot - change - 11 Jun 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-06-11 18:07:13
Closed_By joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 11 Jun 2018
avatar Quy Quy - change - 11 Jun 2018
Closed_Date 2018-06-11 18:07:13 2018-06-11 18:07:14
Closed_By joomla-cms-bot Quy
avatar joomla-cms-bot
joomla-cms-bot - comment - 11 Jun 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/20719

avatar brianteeman
brianteeman - comment - 11 Jun 2018

@ggppdk your code doesnt work

Add a Comment

Login with GitHub to post a comment