Pass the changed language to the Software service and to libzypp#875
Merged
Pass the changed language to the Software service and to libzypp#875
Conversation
jreidinger
reviewed
Nov 16, 2023
| locale_client = Clients::Locale.new | ||
| # TODO: test if we need to pass block with additional actions | ||
| @ui_locale = UILocale.new(locale_client) | ||
| export |
Contributor
There was a problem hiding this comment.
interesting that it helps. I actually would expect issues in other way. When you export service and then localize it, so I see small window when you can get unlocalized texts.
imobachgs
approved these changes
Nov 16, 2023
Co-authored-by: Imobach González Sosa <igonzalezsosa@suse.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When changing the display language in the web frontend the change is not propagated to the Software service. From the
y2log:So the change_locale callback was called only twice. According to the PID numbers only for the Manager and Storage service, not for the
Softwareservice.Solution
Just calling the
exportfunction before adding the language change callback in the Software service helped.But actually I'm not sure whether this is the right fix. The same order is used in the Manager and Storage services where it works fine. Maybe there is some race condition and moving the code earlier/later just accidentally removed that collision and the problem is still there. 🤔
(I updated the order also in the Storage and Manager service so it is consistent.)
With the "fix" the language change callback is correctly called triple times with all services (including the Software service).
Additional Fix
In the language change callback I added code which forwards the change also to libzypp. With this fix we can also display localized pattern names and descriptions. See the screenshot below.
But it still needs some improvement, libzypp uses the locale set at the repository refresh time, if the language is changed later then it is not reflected. It only works after manually changing the product to install which reloads the repository again.
But that's a different problem reported in #859. This fix at least proves that we can display also translated patterns, it's rather just a proof of concept.
Testing
Screenshots
I tested the pattern selector with the Spanish language.
Note: Some texts are not translated, but that is not Agama fault, the translations come from the package repository.