Pass the changed language to the Software service and to libzypp #875
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
Software
service.Solution
Just calling the
export
function 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.