-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Translate stages via language files #21506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] Translate stages via language files #21506
Conversation
…-states-via-language-files # Conflicts: # administrator/components/com_workflow/tmpl/states/default.php # administrator/components/com_workflow/tmpl/transitions/default.php
| defined('_JEXEC') or die; | ||
|
|
||
| use Joomla\CMS\Language\Text; | ||
| use Joomla\CMS\Factory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factory already exists a few lines down. Adding it twice will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, I thought I solved it with the conflict, thanks for the pointer!
| <th scope="row"> | ||
| <?php if ($canEdit) : ?> | ||
| <?php $editIcon = '<span class="fa fa-pencil-square mr-2" aria-hidden="true"></span>'; ?> | ||
| <a href="<?php echo $edit; ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape(addslashes($item->title)); ?>"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need also a Text:: for the title
escape(addslashes($item->title)) to escape(addslashes(Text::_($item->title)))|
Also: To obtain (here for French. just modified for unpublished) In both cases |
|
@infograf768 I'll create a new PR for this, but thanks for the suggestion! |
|
Can conflicts be solved? |
|
Sure, I waited for #21566 |
|
I think that also |
…-states-via-language-files # Conflicts: # administrator/components/com_content/tmpl/articles/default.php # administrator/components/com_workflow/forms/transition.xml # administrator/components/com_workflow/tmpl/transitions/default.php # installation/sql/mysql/joomla.sql # libraries/src/Form/Field/TransitionField.php # libraries/src/Form/Field/WorkflowStageField.php
| } | ||
|
|
||
| $workflowStages[$workflowStageKey][] = HTMLHelper::_('select.option', $stage->workflow_stage_id, $stage->workflow_stage_title); | ||
| $workflowStates[$workflowStateKey][] = HTMLHelper::_('select.option', $state->workflow_stage_id, Text::_($state->workflow_stage_title)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$state or $stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be $stage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
Also conflict with new file name. |
|
And I foresee issues with #21520 as the sql does not use string constants. |
| use Joomla\CMS\Factory; | ||
| use Joomla\CMS\Form\FormHelper; | ||
| use Joomla\CMS\Workflow\Workflow; | ||
| use Joomla\CMS\Form\Field\ListField; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to import this as it's in the same namespace
| $user = Factory::getUser(); | ||
| $userId = $user->id; | ||
|
|
||
| $lang = Factory::getLanguage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You aren't using this property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also requires conflicts fixing as well as comments
Deleted useless hashtag here... (JM)
…-states-via-language-files # Conflicts: # installation/sql/mysql/joomla.sql
|
Missing Text:: line 118 of tmpl/transitions/default.php to get Otherwise good first step for me |
| <?php endif; ?> | ||
| </div> | ||
| <div class="mr-auto"><?php echo $this->escape($item->stage_title); ?></div> | ||
| <div class="mr-auto"><?php echo Text::_($this->escape($item->stage_title)); ?></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think correct would be do escape() after translation, not before 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, thx
|
I have tested this item ✅ successfully on 9d0ba73 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21506. |
|
Ready to Commit after two successful tests. |
|
https://github.com/joomla/joomla-cms/pull/21506/files#diff-135c6f58583408312a709459b19594c7 done in bembelimen#22 |
|
question: |
|
Status back on "Pending". |
|
@alikon We also need to translate the transitions. I.e. enter in db some string for the actions so basically we would have something like And add the new lang strings. |
|
Or do it in this PR? |
|
Yes we can do in a next PR,
Il ven 24 ago 2018, 07:28 infograf768 <[email protected]> ha scritto:
… Or do it in this PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21506 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALFsUncU2NFikLUdWpf3BuGOLrdUC2Gks5uT47fgaJpZM4V2Qbn>
.
|
|
@bembelimen |
|
Thanks @alikon for the PR I would do the translation in a new PR, so we have small code changes. |
|
Drone error is unrelated to this PR. @wilsonge Please merge. |
|
rtc This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21506. |
|
Whoever merges can you directly fix the drone error |
|
Thanks guys! |

Pull Request for Issue #21476 (comment).
Summary of Changes
Now one can use languages constants to have multilingual states
Testing Instructions
Create a state called "JPUBLISHED" and check it everywhere in the system (state list, article edit form, article list, transition edit form, ...)
Expected result
The language constant will be translated
Actual result
No translation at all