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

Updated language aliases handling #12368

Open
nijel opened this issue Aug 30, 2024 · 3 comments · May be fixed by #13534
Open

Updated language aliases handling #12368

nijel opened this issue Aug 30, 2024 · 3 comments · May be fixed by #13534
Assignees
Labels
enhancement Adding or requesting a new feature.
Milestone

Comments

@nijel
Copy link
Member

nijel commented Aug 30, 2024

Describe the problem

Changes in weblate-language-data can turn existing languages into aliases (for example, in WeblateOrg/language-data#1427). This will have an immediate effect on new installations, but will do nothing on existing installations.

Describe the solution you would like

The existing installation language definitions should be updated if UPDATE_LANGUAGES is turned on.

  1. Factor out logic from the move_language management command to a module.
  2. Better handle integrity errors in that code (when both languages exist in a component), most likely by emitting a warning.
  3. Migrate content for any existing aliased language to the alias target in Language.objects.setup using factored out code.
  4. Remove blank aliased languages.
  5. The legacy codes in the URLs will be automatically redirected by the existing middleware, so no change is needed for that.

Describe alternatives you have considered

No response

Screenshots

No response

Additional context

No response

@nijel nijel added the enhancement Adding or requesting a new feature. label Aug 30, 2024
@nijel
Copy link
Member Author

nijel commented Oct 15, 2024

Related issue is addressed in #12784

@nijel nijel added this to the 5.9 milestone Oct 15, 2024
@nijel nijel modified the milestones: 5.9, 5.10 Dec 7, 2024
@gersona
Copy link
Contributor

gersona commented Jan 13, 2025

How do we emit a warning when move_language is executed on Language.objects.setup()? It makes sense to log warning to console when executing an admin command, but what's the common way if it's triggered after migrations. Shall I just use the Alert model ?

@nijel
Copy link
Member Author

nijel commented Jan 13, 2025

Using Alert sounds like a good idea, but not in the setup path. I think the logic should be the same as with existing setup. When invoked manually, it will print, when not, it will just do nothing (current implementation), or use weblate.logger (that would have to be implemented).

As for the Alert, there already is DuplicateLanguage which pretty much covers this situation (you would get it after applying the changes), so it probably could be extended to cover this as well.

@gersona gersona linked a pull request Jan 16, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants