-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #725 from openSUSE/ui_locale_dbus
UI locale dbus
- Loading branch information
Showing
11 changed files
with
176 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
------------------------------------------------------------------- | ||
Wed Aug 30 12:57:59 UTC 2023 - Josef Reidinger <[email protected]> | ||
|
||
- Locale service: add value for UI locale (gh#openSUSE/agama#725) | ||
|
||
------------------------------------------------------------------- | ||
Thu Aug 3 08:34:14 UTC 2023 - Imobach Gonzalez Sosa <[email protected]> | ||
|
||
|
@@ -8,7 +13,7 @@ Thu Aug 3 08:34:14 UTC 2023 - Imobach Gonzalez Sosa <[email protected]> | |
InstallSettings and NetworkSettings. | ||
- Improve error reporting when working with the "config" | ||
subcommand. | ||
|
||
------------------------------------------------------------------- | ||
Wed Aug 2 10:03:18 UTC 2023 - Imobach Gonzalez Sosa <[email protected]> | ||
|
||
|
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) [2022] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
|
||
Yast.import "WFM" | ||
|
||
module Agama | ||
# Object responsible for managing changes of localization produced by D-Bus backend. | ||
class UILocale | ||
include Yast::I18n | ||
include Yast::Logger | ||
# creates new UILocale object that will handle change of UI locale. | ||
# | ||
# @param [Agama::DBus::Clients::Locale] locale_client to communicate with dbus service | ||
# @yield block is callback that is called when ui locale is changed | ||
# to allow user to call methods that needs retranslation | ||
def initialize(locale_client, &block) | ||
@client = locale_client | ||
change_locale(@client.ui_locale) | ||
@client.on_ui_locale_change do |locale| | ||
change_locale(locale) | ||
block.call(locale) if block_given? | ||
end | ||
end | ||
|
||
private | ||
|
||
def change_locale(locale) | ||
# TODO: check if we can use UTF-8 everywhere including strange arch consoles | ||
Yast::WFM.SetLanguage(locale, "UTF-8") | ||
# explicitelly set ENV to get localization also from libraries like libstorage | ||
ENV["LANG"] = locale + ".UTF-8" | ||
log.info "set yast language to #{locale}" | ||
# explicit call to textdomain to force fast gettext change of language ASAP | ||
textdomain "installation" | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
------------------------------------------------------------------- | ||
Wed Aug 30 12:39:18 UTC 2023 - Josef Reidinger <[email protected]> | ||
|
||
- Respect UI locale in dbus services (gh#openSUSE/agama#725) | ||
|
||
------------------------------------------------------------------- | ||
Mon Aug 28 07:59:26 UTC 2023 - Knut Anderssen <[email protected]> | ||
|
||
|
Oops, something went wrong.