User tests: Successful: Unsuccessful:
As title says. The tip displays in the articles Manager when an article is Unpublished.
It concerns the COM_CONTENT_CHANGE_STAGE
lang string
Create an article as Unpublished.
make sure publish up and down are empty
Hover the Status icon.
It is the simplest solution but we have another solution by passing through Text the string in both
articles/default.php
and featured/default.php
->addState(ContentComponent::CONDITION_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED'])
->addState(ContentComponent::CONDITION_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED'])
->addState(ContentComponent::CONDITION_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED'])
->addState(ContentComponent::CONDITION_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED'])
I can change the PR if judged necessary.
Status | New | ⇒ | Pending |
Category | ⇒ | Layout |
Afaik that part of PublishButton is not used for articles but may be for other managers and it is translated somewhere else. The articles manager loads a new PublishButton with specific states because of workflow. Then it is displayed by the transition-button where the textip (data content) depends of the state of the article obtained by Publish button when the article is published.
When it is unpublished, we need to use this pr or add Text:: in the default.php.
So we have to decide which solution to use OR refactor the whole stuff.
It's not translated as far as I can tell. After removing custom com_content
states, I get JLIB_HTML_PUBLISH_ITEM
in the tooltip which is what other components will get with default button.
It's not translated as far as I can tell.
Indeed. In fact it looks like it is never used in core... What is used elsewhere is JGrid.
Only occurence of new PublishedButton
are in both articles/default.php
and featured/default.php
Looks like it "could" be used by 3rd party in the future.
Therefore I think it is safer to add the Text::
both in the default.php files and PublishedButton itself. On it.
Labels |
Added:
?
|
Please test again.
Grrrr... Now it looks weird because title has to be translated but tip_title doesn't
@SharkyKZ
I found where the original issue comes from.
It was my patch #27078 ;)
I had modified the transition-button there to prevent double translation when we had "Start Date etc.)
Debug Lang was marking it this way:
I patched this way
- data-content="<?php echo HTMLHelper::_('tooltipText', Text::_($title), '', 0); ?>"
+ data-content="<?php echo HTMLHelper::_('tooltipText', $title, '', 0); ?>"
Therefore the $title is untranslated when the article is unpublished.
We have to take a decision. Do we reinstate the Text there (and get a wrong debug lang) or modify as done in this PR?
I just don't like that one string we pass has to be translated but the other doesn't. I see two options here:
Remove translation from button layout and pass only translated strings to PublishedButton::addState()
.
Remove translation from button layout and perform all translations in PublishedButton::render()
.
I'm afraid I can't do what you suggest.
You mean you don't know how to do it or you don't agree with proposed solutions?
Don’t know how.
Remove Text::_()
calls from layouts/joomla/button/transition-button.php
and add them to tip_title constants like you already did for title, e.g. here
This should also fix remaining double translations which aren't visible in core.
Category | Layout | ⇒ | Administration com_content Layout Libraries |
@SharkyKZ
Done and it does work indeed (changes were also needed in PublishedButton).
BUT, remains a case.
See transition-button $only_icon = empty($options['transitions']);
https://github.com/joomla/joomla-cms/blob/4.0-dev/layouts/joomla/button/transition-button.php#L31-L40
I did not touch for the moment at the Text::_()
stuff when $only_icon
is set as I don't know how to test that part. The logic is to also modify there but not sure at all.
If you don't know, maybe @bembelimen knows the uses of that part.
Yes, remove those Text::_()
calls too. It works the same way. For testing purposes you can just set $only_icon
to true
.
Done. Can be now tested. I fail to understand the use of $only_icon
. Why would anyone lose the ability to modify via the icon is a mystery to me...
Remove use Joomla\CMS\Language\Text;
from button layout please.
Done.
needs more work for featured.
On it
Remove Text::_()
here too please:
And with that use Joomla\CMS\Language\Text;
too.
LOL
Hope it was the last one...
I have tested this item
I have tested this item
RTC
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-12-04 10:45:51 |
Closed_By | ⇒ | wilsonge |
This looks better to me translating the tips this way (sorry for not looking before JM!). Thanks!
Thanks to all who helped on this. Was a long road... ;)
I still have no idea why we offer the variable $only_icon
though except for overrides of the admin templates.
That's better. But I wonder whether passed strings should be translated or not. Here they're not translated:
joomla-cms/libraries/src/Button/PublishedButton.php
Lines 32 to 35 in 551e356
So maybe translation should be performed in
Joomla\CMS\Button\PublishedButton::render()
instead.