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

Translate pattern descriptions #991

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions service/lib/agama/dbus/software_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,8 @@ def start
# registering the language change callback to work properly
export
@ui_locale = UILocale.new(Clients::Locale.instance) do |locale|
# set the locale in the Language module, when changing the repository
# (product) it calls Pkg.SetTextLocale(Language.language) internally
Yast::Language.Set(locale)
# set libzypp locale (for communication only, Pkg.SetPackageLocale
# call can be used for installing the language packages)
Yast::Pkg.SetTextLocale(locale)
# TODO: libzypp shows the pattern names and descriptions using the
# locale set at the repository refresh time, here we should refresh
# the repositories with the new locale
# call the language change handler
locale_handler(locale)
end
end

Expand Down Expand Up @@ -101,6 +94,39 @@ def dbus_objects
Agama::DBus::Software::Proposal.new(logger)
]
end

# Language change callback handler, activate new locale in the libzypp backend
# @param locale [String] the new locale
def locale_handler(locale)
# set the locale in the Language module, when changing the repository
# (product) it calls Pkg.SetTextLocale(Language.language) internally
Yast::Language.Set(locale)

# set libzypp locale (for communication only, Pkg.SetPackageLocale
# call can be used for *installing* the language packages)
Yast::Pkg.SetTextLocale(locale)

# refresh all enabled repositories to download the missing translation files
Yast::Pkg.SourceGetCurrent(true).each do |src|
Yast::Pkg.SourceForceRefreshNow(src)
end

# remember the currently selected packages and patterns by YaST
# (ignore the automatic selections done by the solver)
#
# NOTE: we will need to handle also the tabooed and soft-locked objects
# when we allow to set them via UI or CLI
selected = Y2Packager::Resolvable.find(status: :selected, transact_by: :appl_high)

# save and reload all repositories to activate the new translations
Yast::Pkg.SourceSaveAll
Yast::Pkg.SourceFinishAll
Yast::Pkg.SourceRestore
Yast::Pkg.SourceLoad

# restore back the selected objects
selected.each { |s| Yast::Pkg.ResolvableInstall(s.name, s.kind) }
end
end
end
end
5 changes: 5 additions & 0 deletions service/package/rubygem-agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jan 11 12:08:29 UTC 2024 - Ladislav Slezák <lslezak@suse.com>

- Translate the pattern descriptions (gh#openSUSE/agama#859)

-------------------------------------------------------------------
Thu Dec 21 14:23:48 UTC 2023 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down