Skip to content

Commit 064ecf0

Browse files
committed
Use language strings in messages.
1 parent 6dba7c2 commit 064ecf0

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/administrator/components/com_ccm/language/en-GB/com_ccm.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ COM_CCM_CONFIG_URL_LABEL="CMS URL"
1919
COM_CCM_CONFIGURATION="CCM Migration Configuration"
2020
COM_CCM_DESCRIPTION="CMS Content Migration . Migrating content via the web services API from a source CMS to a target CMS."
2121
COM_CCM_FILTER_SEARCH="Search"
22+
COM_CCM_MESSAGE_MIGRATION_COMPLETED_PARTIALLY="Partial migration completed. "
23+
COM_CCM_MESSAGE_MIGRATION_COMPLETED_SUCCESSFULLY="All migrations completed successfully: "
24+
COM_CCM_MESSAGE_MIGRATION_FAILED="Failed: "
25+
COM_CCM_MESSAGE_MIGRATION_FAILED_ALL="All migrations failed: "
26+
COM_CCM_MESSAGE_MIGRATION_FAILED_THIS="Migration failed: "
27+
COM_CCM_MESSAGE_MIGRATION_NO_DATA_PROVIDED="No data provided for migration."
28+
COM_CCM_MESSAGE_MIGRATION_SUCCESSFUL="Successful: "
2229
COM_CCM_MIGRATION_FIELDSET_LABEL="Migration Settings"
2330
COM_CCM_MIGRATION_SOURCE_CMS="Source CMS"
2431
COM_CCM_MIGRATION_TARGET_CMS="Target CMS"

src/administrator/components/com_ccm/src/Controller/MigrationController.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
\defined('_JEXEC') or die;
1414
// phpcs:enable PSR1.Files.SideEffects
1515

16+
use Joomla\CMS\Language\Text;
1617
use Joomla\CMS\MVC\Controller\BaseController;
1718

1819
class MigrationController extends BaseController
@@ -21,7 +22,7 @@ public function apply()
2122
{
2223
$data = $this->input->post->get('jform', [], 'array');
2324
if (empty($data)) {
24-
$this->setMessage('No data provided for migration.', 'error');
25+
$this->setMessage(Text::_('COM_CCM_MESSAGE_MIGRATION_NO_DATA_PROVIDED'), 'error');
2526
$this->setRedirect('index.php?option=com_ccm&view=migration');
2627
return;
2728
}
@@ -68,18 +69,18 @@ public function apply()
6869

6970
// Prepare summary message
7071
if (!empty($successfulMigrations) && empty($failedMigrations)) {
71-
$this->setMessage('All migrations completed successfully: ' . implode(', ', $successfulMigrations));
72+
$this->setMessage(Text::_('COM_CCM_MESSAGE_MIGRATION_COMPLETED_SUCCESSFULLY') . implode(', ', $successfulMigrations));
7273
} elseif (!empty($successfulMigrations) && !empty($failedMigrations)) {
73-
$message = 'Partial migration completed. ';
74-
$message .= 'Successful: ' . implode(', ', $successfulMigrations) . '. ';
75-
$message .= 'Failed: ' . implode(', ', $failedMigrations);
74+
$message = Text::_('COM_CCM_MESSAGE_MIGRATION_COMPLETED_PARTIALLY');
75+
$message .= Text::_('Successful: ') . implode(', ', $successfulMigrations) . '. ';
76+
$message .= Text::_('Failed: ') . implode(', ', $failedMigrations);
7677
$this->setMessage($message, 'warning');
7778
} else {
78-
$this->setMessage('All migrations failed: ' . implode(', ', $failedMigrations), 'error');
79+
$this->setMessage(Text::_('All migrations failed: ') . implode(', ', $failedMigrations), 'error');
7980
}
8081

8182
} catch (\Exception $e) {
82-
$this->setMessage('Migration failed: ' . $e->getMessage(), 'error');
83+
$this->setMessage(Text::_('Migration failed: ') . $e->getMessage(), 'error');
8384
}
8485
$this->setRedirect('index.php?option=com_ccm&view=migration');
8586
}

0 commit comments

Comments
 (0)