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

[Bug]: addons-server JavaScript strings are no longer shown in the user's language #15048

Open
1 task done
diox opened this issue Sep 25, 2024 · 5 comments
Open
1 task done
Assignees

Comments

@diox
Copy link
Member

diox commented Sep 25, 2024

What happened?

  • Log in as a developer
  • Visit /fr/developers/addon/submit/upload-listed (use any language other than English with 100% translation completion rate in pontoon. I chose French)
  • Observe the file input button and text below

What did you expect to happen?

  • Text should be in French.

Instead we can see:
[Select a file...]
Your add-on should end with .zip, .xpi or .crx
Screenshot 2024-09-25 at 13-02-35 Envoyer votre module Pôle développeurs Modules pour Firefox

Likely a regression from 2a64618e9d1eebaed15639fb4f824f2844c92778

Is there an existing issue for this?

  • I have searched the existing issues

┆Issue is synchronized with this Jira Task

@diox
Copy link
Member Author

diox commented Sep 25, 2024

We can see that we're correctly requesting the JS file with the translations - on dev, currently that's https://addons-dev.allizom.org/static-server/js/i18n/fr.f4d6614c81ff.js - but that file doesn't contain our strings (only the base ones from Django), despite the fact that they are translated in djangojs.po: https://github.com/mozilla/addons-server/blob/master/locale/fr/LC_MESSAGES/djangojs.po

@diox
Copy link
Member Author

diox commented Sep 25, 2024

In the image, the fr.js files in static-build/ and site-static/ are present but incorrect (missing our translations).

Locally manually calling generate_jsi18n_files (and then collectstatic for DEBUG=False) fixes it.

@KevinMind
Copy link
Contributor

I think we are putting the files created by generate_jsi18n_files in ./static that is likely the problem as we no longer copy static into the final image. We should put those files in static-build as built assets.

@diox
Copy link
Member Author

diox commented Sep 25, 2024

We aren't. There is nothing i18n related in static/, and the command does use root = os.path.join(settings.STATIC_BUILD_PATH, 'js', 'i18n').

Note that as I said above, the file is generated. It's just generated incorrectly, without our translations (likely a dependency/ordering/mount problem in the Dockerfile ?)

@diox
Copy link
Member Author

diox commented Sep 27, 2024

This is caused by the fact that locales and assets are now built in parallel. The problem is, when we run generate_jsi18n_files in the assets stage, it's completely ignoring the locales stage, so our own translations are absent. Django's are present because they are already compiled.

Technically we could move things around, make generate_jsi18n_files part of locales stage, since it doesn't depend on anything assets related besides the output directory, and then move the collecstatic call to be after both assets and locales stages are done, towards the end of the build. I'm not sure we want to do this now, I'd rather remove some parallelism to fix the issue and worry about doing the full refactor later.

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

No branches or pull requests

2 participants