Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
#1627006-84: Collect project information for translation update suggests possible reusing of code for version name parsing.
See: core/modules/locale/locale.compare.inc
Comments
Comment #1
YesCT CreditAttribution: YesCT commentedSutharsan points out: This code tries to do a version fallback, a thing that Update module does not provide.
Here are some code fragments to get an idea of the parsing:
+++ b/core/modules/locale/locale.compare.incundefined
@@ -107,6 +113,7 @@ function locale_translation_build_projects() {
foreach ($project_updates[$name]['releases'] as $project_release) {
// The first release with the same major release number which is not a
// dev release is the one. Releases are sorted the most recent first.
+ // @todo http://drupal.org/node/1774024 Make a helper function.
if ($project_release['version_major'] == $matches[1] &&
(!isset($project_release['version_extra']) || $project_release['version_extra'] != 'dev')) {
$release = $project_release;
@@ -114,6 +121,7 @@ function locale_translation_build_projects() {
}
}
}
+ // HEAD versions are for module maintainers and should not be used.
elseif ($name == "drupal" || preg_match("/HEAD/", $data['info']['version'], $matches)) {
// Pick latest available release.
$release = array_shift($project_updates[$name]['releases']);
@@ -132,7 +140,7 @@ function locale_translation_build_projects() {
// A project can provide the path and filename pattern to download the
// gettext file. Use the default if not.
'server_pattern' => isset($data['info']['interface translation server pattern']) ? $data['info']['interface translation server pattern'] : $default_server['pattern'],
- 'status' => $data['project_status'] ? 1 : 0,
+ 'status' => !empty($data['project_status']) ? 1 : 0,
);
Comment #2
Sutharsan CreditAttribution: Sutharsan as a volunteer commentedThis code will be removed in #1832946: Runtime translation download fallback works different from installer translation download fallback. If that lands, this issue is no longer relevant.
Comment #3
Gábor Hojtsy#1832946: Runtime translation download fallback works different from installer translation download fallback landed.