Skip to content

Commit 94cee6b

Browse files
authored
[6.0] Point to J6 translations list (joomla#45847)
* [6.0] Point to J6 translations list * rename * return empty array instead of null otherwise foreach loop in api endpoint fails * test should pass if no languages found eg if not yet set up
1 parent ff77dee commit 94cee6b

File tree

8 files changed

+29
-11
lines changed

8 files changed

+29
-11
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
UPDATE `#__update_sites`
2+
SET `location` = 'https://update.joomla.org/language/translationlist_6.xml'
3+
WHERE `location` = 'https://update.joomla.org/language/translationlist_5.xml';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
UPDATE "#__update_sites"
2+
SET "location" = 'https://update.joomla.org/language/translationlist_6.xml'
3+
WHERE "location" = 'https://update.joomla.org/language/translationlist_5.xml';

administrator/components/com_installer/src/Model/LanguagesModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected function getLanguages()
131131
if (empty($updateSite)) {
132132
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_WARNING_NO_LANGUAGES_UPDATESERVER'), 'warning');
133133

134-
return;
134+
return [];
135135
}
136136

137137
try {
@@ -143,15 +143,15 @@ protected function getLanguages()
143143
if ($response === null || $response->getStatusCode() !== 200) {
144144
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_INSTALLER_MSG_ERROR_CANT_CONNECT_TO_UPDATESERVER', $updateSite), 'error');
145145

146-
return;
146+
return [];
147147
}
148148

149149
$updateSiteXML = simplexml_load_string((string) $response->getBody());
150150

151151
if (!$updateSiteXML) {
152152
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_INSTALLER_MSG_ERROR_CANT_RETRIEVE_XML', $updateSite), 'error');
153153

154-
return;
154+
return [];
155155
}
156156

157157
$languages = [];

administrator/manifests/packages/pkg_en-GB.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</files>
2222
<updateservers>
2323
<server type="collection" priority="1" name="Accredited Joomla! Translations">
24-
https://update.joomla.org/language/translationlist_5.xml
24+
https://update.joomla.org/language/translationlist_6.xml
2525
</server>
2626
</updateservers>
2727
</extension>

installation/sql/mysql/base.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ CREATE TABLE IF NOT EXISTS `#__update_sites` (
925925

926926
INSERT INTO `#__update_sites` (`update_site_id`, `name`, `type`, `location`, `enabled`, `last_check_timestamp`) VALUES
927927
(1, 'Joomla! Core', 'tuf', 'https://update.joomla.org/cms/', 1, 0),
928-
(2, 'Accredited Joomla! Translations', 'collection', 'https://update.joomla.org/language/translationlist_5.xml', 1, 0),
928+
(2, 'Accredited Joomla! Translations', 'collection', 'https://update.joomla.org/language/translationlist_6.xml', 1, 0),
929929
(3, 'Joomla! Update Component', 'extension', 'https://update.joomla.org/core/extensions/com_joomlaupdate.xml', 1, 0);
930930

931931
-- --------------------------------------------------------

installation/sql/postgresql/base.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ COMMENT ON TABLE "#__update_sites" IS 'Update Sites';
943943

944944
INSERT INTO "#__update_sites" ("update_site_id", "name", "type", "location", "enabled", "last_check_timestamp") VALUES
945945
(1, 'Joomla! Core', 'tuf', 'https://update.joomla.org/cms/', 1, 0),
946-
(2, 'Accredited Joomla! Translations', 'collection', 'https://update.joomla.org/language/translationlist_5.xml', 1, 0),
946+
(2, 'Accredited Joomla! Translations', 'collection', 'https://update.joomla.org/language/translationlist_6.xml', 1, 0),
947947
(3, 'Joomla! Update Component', 'extension', 'https://update.joomla.org/core/extensions/com_joomlaupdate.xml', 1, 0);
948948

949949
SELECT setval('#__update_sites_update_site_id_seq', 4, false);

tests/System/integration/administrator/components/com_installer/Languages.cy.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ describe('Test in backend that the Installer', () => {
99
});
1010

1111
it('has Afrikaans Language installable', () => {
12-
cy.get('tr.row0').should('contain.text', 'Afrikaans').then(() => {
13-
cy.get('input.btn.btn-primary.btn-sm').should('exist');
12+
cy.get('body').then((body) => {
13+
if (body.find('#installer-languages table').length === 0) {
14+
cy.get('#installer-languages .alert.alert-info').should('contain.text', 'No Matching Results');
15+
cy.checkForSystemMessage(`Can't connect to https://update.joomla.org/language/translationlist`);
16+
} else {
17+
cy.get('tr.row0').should('contain.text', 'Afrikaans').then(() => {
18+
cy.get('input.btn.btn-primary.btn-sm').should('exist');
19+
});
20+
}
1421
});
1522
});
1623
});
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
describe('Test that languages API endpoint', () => {
22
it('can deliver a list of languages', () => {
3-
cy.api_get('/languages')
4-
.then((response) => cy.wrap(response).its('body').its('data.0').its('type')
5-
.should('include', 'languages'));
3+
cy.api_get('/languages').then((response) => {
4+
if (response?.body?.data.length === 0) {
5+
cy.wrap(response).its('body.data').should('have.length', 0);
6+
cy.wrap(response).its('body.links.self').should('include', '/api/index.php/v1/languages');
7+
} else {
8+
cy.wrap(response).its('body.data.0.type').should('include', 'languages');
9+
}
10+
});
611
});
712
});

0 commit comments

Comments
 (0)