User tests: Successful: Unsuccessful:
Pull Request for Issue #23794
Loading com_workflow language file
Enabling Translation of the Asset Title (when available)
Adding basic state asset title strings in com_users.ini
Set Debug lang on
Load permissions page for your superuser
administrator/index.php?option=com_users&view=debuguser&user_id=531
(here my user id is 531)
Before patch, the assets title for components (com_content, com_contact, com_admin, etc. are not translated). The workflow default title same. The states (Unpublished, Published, etc.) same.
They show with ??com_content??
for example
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_users Language & Strings |
Labels |
Added:
?
?
|
Follow-up after looking further:
It is quite interesting to note that the assets titles that can be translated are done via the components sys.ini files which are all loaded by default.
It is also the case for com_workflow but that specific string COM_WORKFLOW_DEFAULT_WORKFLOW
is not present in the sys.ini file.
I have now added it in this PR and therefore no need anymore to force load the com_workflow.ini.
If 3rd party extensions do follow core (and they should...), then the name of the component will be present in their sys.ini and automatically translated.
The only occurrence I have found which is not translated is com_massmail
.
But I am not aware of the presence of such a component in core. It is just installed as asset by our sql. (What does it do here is a mystery to me as it is also present in 3.x sqls).
The reason why we need to add somewhere the following strings (I chose com_users.ini but they could go in the main ini file) :
ARCHIVE="Archive"
ARCHIVED="Archived"
PUBLISH="Publish"
PUBLISHED="Published"
TRASH="Trash"
TRASHED="Trashed"
UNPUBLISH="Unpublish"
UNPUBLISHED="Unpublished"
is because these constants do not exist in any file but are introduced in the assets by our sql
(56, 8, 20, 37, 2, 'com_content.workflow.1', 'COM_WORKFLOW_DEFAULT_WORKFLOW', '{}'),
(57, 56, 21, 22, 3, 'com_content.state.1', 'Unpublished', '{}'),
(58, 56, 23, 24, 3, 'com_content.state.2', 'Published', '{}'),
(59, 56, 25, 26, 3, 'com_content.state.3', 'Trashed', '{}'),
(60, 56, 27, 28, 3, 'com_content.state.4', 'Archived', '{}'),
(61, 56, 29, 30, 3, 'com_content.transition.1', 'Publish', '{}'),
(62, 56, 31, 32, 3, 'com_content.transition.2', 'Unpublish', '{}'),
(63, 56, 33, 34, 3, 'com_content.transition.3', 'Archive', '{}'),
(64, 56, 35, 36, 3, 'com_content.transition.4', 'Trash', '{}');
for sure, if new ones are created by admins, they may not be translated if not present in an override.
Now, it could be decided that NOTHING should be translated, including COM_WORKFLOW_DEFAULT_WORKFLOW
and therefore that we should display as title of the assets the raw title as present in the Assets table.
@wilsonge @mbabker
If that is decided, I will close this PR.
is because these constants do not exist in any file but are introduced in the assets by our sql
Those are not constants (except COM_WORKFLOW_DEFAULT_WORKFLOW
). These are already translated.
Which SQL file is this? It's outdated. com_content.state
need to be changed to com_content.stage
and stages title need to be changed to constants (JUNPUBLISHED
, JPUBLISHED
...).
Also, do you know why transition titles for new workflows do not use constants? @bembelimen?
To test all this we need to create a new workflow.
I already get an error as WorkflowModel uses \JForm
instead of Form
and declaring use Joomla\CMS\Form\Form;
[24-Feb-2019 08:30:03 Europe/Berlin] PHP Warning: Declaration of Joomla\Component\Workflow\Administrator\Model\WorkflowModel::preprocessForm(JForm $form, $data, $group = 'content') should be compatible with Joomla\CMS\MVC\Model\FormModel::preprocessForm(Joomla\CMS\Form\Form $form, $data, $group = 'content') in ROOT/administrator/components/com_workflow/Model/WorkflowModel.php on line 430
and other errors
[24-Feb-2019 08:30:03 Europe/Berlin] PHP Notice: Undefined property: stdClass::$workflow_id in /Applications/MAMP/htdocs/installmulti/joomla40/administrator/components/com_workflow/Model/StageModel.php on line 163
[24-Feb-2019 08:34:08 Europe/Berlin] PHP Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/installmulti/joomla40/administrator/components/com_workflow/Model/TransitionModel.php on line 89
Here is the assets db for the default as created after install:
Here is the assets part for a new workflow:
I agree with you that it is extremely confusing...
I have to say it seems weird that we're going to have half the resources untranslated and half not. Isn't this going to cause more confusion than it solves?
As I wrote above, this PR can be ignored if decided such.
We still have some errors though when creating workflows, including the default sql.
Talk to Mig and any relevent TT's and give me a verdict. I'm happy to go with what TTs recommend here
Category | Administration com_users Language & Strings | ⇒ | Administration com_users |
What is the verdict?
Category | Administration com_users | ⇒ | Administration com_users Language & Strings |
I have tested this item
I have tested this item
Labels |
Added:
Information Required
?
|
@infograf768 This is waiting for a decision from Mig. We can't just leave it open forever
Labels |
Added:
Conflicting Files
?
Removed: ? |
Labels |
Added:
?
Removed: ? |
@imanickam
Please test and give advice.
Labels |
Added:
?
Removed: Conflicting Files ? |
Thanks for bearing with the delay. I was away for two weeks.
Today, JM and I had discussed about this PR. As workflow tables use language strings in the column title in the tables workflow and workflow_stages, moving forward with this PR would pave the way for improvements in the future.
Using the suggested language constants (that may have to be refined) in the file com_users.ini may restrict the use of these language constants only to the component com_users.
Probably what would be more logical is to move some of the constants (especially the ones that describe the transitions and stages) are moved to the file(s) en-GB.ini and workflow.ini/workflow.sys.ini as the case may be.
Just like in the table workflow_stages, whether it is possible to use the language strings such as JPUBLISH in the place of "Publish" in table workflow_transitions? This would standardize things in the workflow component.
Labels |
Removed:
?
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-02-16 15:08:36 |
Closed_By | ⇒ | wilsonge |
OK So if the plan is to use this as a starting point and is TT approved - happy to merge. Thanks guys
Probably what would be more logical is to move some of the constants (especially the ones that describe the transitions and stages) are moved to the file(s) en-GB.ini and workflow.ini/workflow.sys.ini as the case may be.
Remains to move the ones in com_users. Will do in another PR.
Cool. Thanks
Is there a reason why Workflow and Stage titles are translatable but Transitions aren't?