Skip to content
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

Translation not available during installation #6717

Open
olafgrabienski opened this issue Sep 18, 2024 · 15 comments · May be fixed by backdrop/backdrop#4873
Open

Translation not available during installation #6717

olafgrabienski opened this issue Sep 18, 2024 · 15 comments · May be fixed by backdrop/backdrop#4873

Comments

@olafgrabienski
Copy link

olafgrabienski commented Sep 18, 2024

Description of the bug

When I try to install Backdrop in another language, I get a requirements problem: "The German translation is not available." The same happens with other languages (other than English).

Steps To Reproduce

Note: This seems to be an issue which happens only in certain hosting environments. See the "Additional information" section below.

To reproduce the behavior:

  1. Prepare a Backdrop 1.29.0 installation: database, code directory, etc.
  2. Go to the (sub)domain of your environment, and run the installer.
  3. Choose a language other than English, e.g. Spanish or German. The URL should contain a langcode, like in https://test.example.com/core/install.php?langcode=de
  4. Hit "Save and continue".

Actual behavior

You see a page with title "Requirements problem" and the following message:

Translation. The German translation is not available. The German translation file is not available at the translation server. Choose a different language or select English and translate your website later.

Screenshot:

Expected behavior

Backdrop is installed in the chosen language. (This is a new feature introduced with Backdrop 1.29.)

Additional information

(a) In a related Zulip thread we were discussing if this is a hosting environment issue. I was however able to reproduce the issue with two different shared hosting services.

(b) When I continue the installation in English, everything works as usual, and after the installation I'm able to download and install modules via the user interface.

Technical info:

  • Backdrop CMS version: 1.29.0
  • Web server: Apache
  • PHP version: tried both PHP 8.1 and 8.2
@indigoxela
Copy link
Member

Our current trouble is reliable reproduction.

On some environments this problem occurs, but not on others. Ideally we'd figure out the culprit on some hosting. Otherwise it's tricky to fix.

I'm one of those who can't reproduce it at all.
Guessing... something goes wrong in install_check_localization_server() - unclear, what and why.

@olafgrabienski do you have a playground webspace with failure? One that really doesn't matter to you?
Can you edit one core file to sneak in some debug() code?

@olafgrabienski
Copy link
Author

Can you edit one core file to sneak in some debug() code?

Yes, I have a testing site. Which code?

@indigoxela
Copy link
Member

Which code?

Oops, this is trickier, that I thought. At this early stage both, debug() and var_dump() output gets silently swallowed. 😬

die() seems to work.

So, let's be rude:

In file core/includes/install.core.inc around line 1570:

  $response = backdrop_http_request($uri, $options);
  if ($response->code != 200) {
    die("This fails with $uri and response code is {$response->code}");
    $online = FALSE;
    return $online;
  }

Add the line with die() - that means, PHP will completely stop there and output just a single line...

This also means, the site won't install at all, but that shouldn't be a problem.

@olafgrabienski
Copy link
Author

Thanks for the debug code. The result (this time I tried to install in Italian):

This fails with https://localize.backdropcms.org/files/l10n_packager/all/backdropcms/backdropcms-1.29.0.it.po and response code is 404

@indigoxela
Copy link
Member

indigoxela commented Sep 18, 2024

Ohhhh.... 💡

Now I get it. It's the version string, that makes this fail. Silly me, I tested with a dev (1.x) - unaware that dev works as opposed to regular stable installs. 😬

@indigoxela
Copy link
Member

Here's in incomplete PR for early testing: backdrop/backdrop#4873

@olafgrabienski this should fix the problem with installing - as long as this particular translation file already exists (that's why this still needs work).

This also means: it's not at all related to hosting environments. It just worked for people testing with dev versions. This never worked for stable releases, because of the faulty (unstripped) version pattern.

@indigoxela
Copy link
Member

Updated to a more complete approach: backdrop/backdrop#4873

This now also works, if the translation file hasn't been generated, yet - be it because major.minor version's still dev (or preview release) or whatever. It falls back to the generic download, if that exists.

@olafgrabienski
Copy link
Author

@indigoxela - I guess I have just tested the PR before you made the update. I was however able to install Backdrop in German. Does it make sense to test the updated PR, or not (may be not possible at the moment, as the translation files are available)?

@indigoxela
Copy link
Member

indigoxela commented Sep 18, 2024

I guess I have just tested the PR before you made the update.

Oops, can happen. 🤷 Many thanks for verifying, though. 😉

Does it make sense to test the updated PR...

Absolutely. I had to switch the logic quite a bit, to better account for version specific translation files (existing or not existing yet, fallback...).

That the fallback works, can now be tested with a recent dev (it's now 1.30.x-dev and that should fall back to a translation file like backdropcms-1.x.de.po).

@olafgrabienski
Copy link
Author

Okay, I'll test again later ... if nobody beats me to it.

@argiepiano
Copy link

Thanks, @indigoxela . I've tested locally and WFM:

  1. Downloaded the codebase for Backdrop 1.29.0
  2. Selected Español. As expected, I got the language unavailable error
  3. Patch Backdrop 1.29.0 with the patch provided here
  4. Attempted installing with Español. It worked 👍🏽

@indigoxela
Copy link
Member

For testers - if you get the chance, you can also verify the file name of the downloaded file. It's in /files/translations.

Just to make sure, you got the right version/variant. 😉 It's not essential, just nice to know.

@argiepiano
Copy link

For testers - if you get the chance, you can also verify the file name of the downloaded file. It's in /files/translations.

Checked on the file name: backdropcms-1.29.es.po

Seems correct.

@olafgrabienski
Copy link
Author

Tested the PR with 1.30.x-dev, works like a charm!

Name of the downloaded language file: backdropcms-1.x.de.po

@quicksketch
Copy link
Member

This is utmost priority for us. Having a headline new feature not work is bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants