Skip to content

Commit 3ab6503

Browse files
authored
[4.0] Make transitions translateable (#35457)
1 parent 6615552 commit 3ab6503

File tree

8 files changed

+51
-16
lines changed

8 files changed

+51
-16
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
UPDATE `#__workflow_transitions` SET `title` = 'PUBLISH' WHERE `title`= 'Publish';
2+
UPDATE `#__workflow_transitions` SET `title` = 'UNPUBLISH' WHERE `title`= 'Unpublish';
3+
UPDATE `#__workflow_transitions` SET `title` = 'TRASH' WHERE `title`= 'Trash';
4+
UPDATE `#__workflow_transitions` SET `title` = 'ARCHIVE' WHERE `title`= 'Archive';
5+
UPDATE `#__workflow_transitions` SET `title` = 'FEATURE' WHERE `title`= 'Feature';
6+
UPDATE `#__workflow_transitions` SET `title` = 'UNFEATURE' WHERE `title`= 'Unfeature';
7+
UPDATE `#__workflow_transitions` SET `title` = 'PUBLISH_AND_FEATURE' WHERE `title`= 'Publish & Feature';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
UPDATE "#__workflow_transitions" SET "title" = 'PUBLISH' WHERE "title"= 'Publish';
2+
UPDATE "#__workflow_transitions" SET "title" = 'UNPUBLISH' WHERE "title"= 'Unpublish';
3+
UPDATE "#__workflow_transitions" SET "title" = 'TRASH' WHERE "title"= 'Trash';
4+
UPDATE "#__workflow_transitions" SET "title" = 'ARCHIVE' WHERE "title"= 'Archive';
5+
UPDATE "#__workflow_transitions" SET "title" = 'FEATURE' WHERE "title"= 'Feature';
6+
UPDATE "#__workflow_transitions" SET "title" = 'UNFEATURE' WHERE "title"= 'Unfeature';
7+
UPDATE "#__workflow_transitions" SET "title" = 'PUBLISH_AND_FEATURE' WHERE "title"= 'Publish & Feature';

administrator/components/com_content/src/Model/ArticlesModel.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Joomla\CMS\Component\ComponentHelper;
1515
use Joomla\CMS\Factory;
1616
use Joomla\CMS\Language\Associations;
17+
use Joomla\CMS\Language\Text;
1718
use Joomla\CMS\MVC\Model\ListModel;
1819
use Joomla\CMS\Plugin\PluginHelper;
1920
use Joomla\CMS\Table\Table;
@@ -664,6 +665,8 @@ public function getTransitions()
664665
{
665666
unset($transitions[$key]);
666667
}
668+
669+
$transitions[$key]['text'] = Text::_($transition['text']);
667670
}
668671

669672
$this->cache[$store] = $transitions;

administrator/language/en-GB/joomla.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,11 @@ JTABLE_OPTIONS_ORDERING="Order by:"
11391139
; States assets translations
11401140
ARCHIVE="Archive"
11411141
ARCHIVED="Archived"
1142+
FEATURE="Feature"
1143+
UNFEATURE="Unfeature"
11421144
PUBLISH="Publish"
11431145
PUBLISHED="Published"
1146+
PUBLISH_AND_FEATURE="Publish & Feature"
11441147
TRASH="Trash"
11451148
TRASHED="Trashed"
11461149
UNPUBLISH="Unpublish"

installation/sql/mysql/base.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,10 +1161,10 @@ CREATE TABLE IF NOT EXISTS `#__workflow_transitions` (
11611161
--
11621162

11631163
INSERT INTO `#__workflow_transitions` (`id`, `asset_id`, `published`, `ordering`, `workflow_id`, `title`, `description`, `from_stage_id`, `to_stage_id`, `options`) VALUES
1164-
(1, 58, 1, 1, 1, 'Unpublish', '', -1, 1, '{"publishing":"0"}'),
1165-
(2, 59, 1, 2, 1, 'Publish', '', -1, 1, '{"publishing":"1"}'),
1166-
(3, 60, 1, 3, 1, 'Trash', '', -1, 1, '{"publishing":"-2"}'),
1167-
(4, 61, 1, 4, 1, 'Archive', '', -1, 1, '{"publishing":"2"}'),
1168-
(5, 62, 1, 5, 1, 'Feature', '', -1, 1, '{"featuring":"1"}'),
1169-
(6, 63, 1, 6, 1, 'Unfeature', '', -1, 1, '{"featuring":"0"}'),
1170-
(7, 64, 1, 7, 1, 'Publish & Feature', '', -1, 1, '{"publishing":"1","featuring":"1"}');
1164+
(1, 58, 1, 1, 1, 'UNPUBLISH', '', -1, 1, '{"publishing":"0"}'),
1165+
(2, 59, 1, 2, 1, 'PUBLISH', '', -1, 1, '{"publishing":"1"}'),
1166+
(3, 60, 1, 3, 1, 'TRASH', '', -1, 1, '{"publishing":"-2"}'),
1167+
(4, 61, 1, 4, 1, 'ARCHIVE', '', -1, 1, '{"publishing":"2"}'),
1168+
(5, 62, 1, 5, 1, 'FEATURE', '', -1, 1, '{"featuring":"1"}'),
1169+
(6, 63, 1, 6, 1, 'UNFEATURE', '', -1, 1, '{"featuring":"0"}'),
1170+
(7, 64, 1, 7, 1, 'PUBLISH_AND_FEATURE', '', -1, 1, '{"publishing":"1","featuring":"1"}');

installation/sql/postgresql/base.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,12 +1180,12 @@ CREATE INDEX "#__workflow_transitions_idx_workflow_id" ON "#__workflow_transitio
11801180
CREATE INDEX "#__workflow_transitions_idx_checked_out" ON "#__workflow_transitions" ("checked_out");
11811181

11821182
INSERT INTO "#__workflow_transitions" ("id", "asset_id", "published", "ordering", "workflow_id", "title", "description", "from_stage_id", "to_stage_id", "options") VALUES
1183-
(1, 58, 1, 1, 1, 'Unpublish', '', -1, 1, '{"publishing":"0"}'),
1184-
(2, 59, 1, 2, 1, 'Publish', '', -1, 1, '{"publishing":"1"}'),
1185-
(3, 60, 1, 3, 1, 'Trash', '', -1, 1, '{"publishing":"-2"}'),
1186-
(4, 61, 1, 4, 1, 'Archive', '', -1, 1, '{"publishing":"2"}'),
1187-
(5, 62, 1, 5, 1, 'Feature', '', -1, 1, '{"featuring":"1"}'),
1188-
(6, 63, 1, 6, 1, 'Unfeature', '', -1, 1, '{"featuring":"0"}'),
1189-
(7, 64, 1, 7, 1, 'Publish & Feature', '', -1, 1, '{"publishing":"1","featuring":"1"}');
1183+
(1, 58, 1, 1, 1, 'UNPUBLISH', '', -1, 1, '{"publishing":"0"}'),
1184+
(2, 59, 1, 2, 1, 'PUBLISH', '', -1, 1, '{"publishing":"1"}'),
1185+
(3, 60, 1, 3, 1, 'TRASH', '', -1, 1, '{"publishing":"-2"}'),
1186+
(4, 61, 1, 4, 1, 'ARCHIVE', '', -1, 1, '{"publishing":"2"}'),
1187+
(5, 62, 1, 5, 1, 'FEATURE', '', -1, 1, '{"featuring":"1"}'),
1188+
(6, 63, 1, 6, 1, 'UNFEATURE', '', -1, 1, '{"featuring":"0"}'),
1189+
(7, 64, 1, 7, 1, 'PUBLISH_AND_FEATURE', '', -1, 1, '{"publishing":"1","featuring":"1"}');
11901190

11911191
SELECT setval('#__workflow_transitions_id_seq', 8, false);

language/en-GB/joomla.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,16 @@ JTABLE_OPTIONS_ORDERING="Order by:"
507507
JGLOBAL_READ_MORE="Read more ..."
508508
JGLOBAL_READ_MORE_TITLE="Read more: %s"
509509
JGLOBAL_REGISTER_TO_READ_MORE="Register to read more ..."
510+
511+
; States assets translations
512+
ARCHIVE="Archive"
513+
ARCHIVED="Archived"
514+
FEATURE="Feature"
515+
UNFEATURE="Unfeature"
516+
PUBLISH="Publish"
517+
PUBLISHED="Published"
518+
PUBLISH_AND_FEATURE="Publish & Feature"
519+
TRASH="Trash"
520+
TRASHED="Trashed"
521+
UNPUBLISH="Unpublish"
522+
UNPUBLISHED="Unpublished"

libraries/src/Form/Field/TransitionField.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ function ($item) use ($user, $component)
154154
}
155155
);
156156

157-
// Sort by transition name
158-
$items = ArrayHelper::sortObjects($items, 'value', 1, true, true);
157+
foreach ($items as $item)
158+
{
159+
$item->text = Text::_($item->text);
160+
}
159161
}
160162

161163
// Get workflow stage title

0 commit comments

Comments
 (0)