Skip to content

Commit

Permalink
feat[Vanilla-OS#104]: Rebuild the UI with the new language
Browse files Browse the repository at this point in the history
  • Loading branch information
muhdsalm committed Jul 31, 2024
1 parent ecf45a6 commit 1678d89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vanilla_installer/defaults/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import re
from gi.repository import Adw, Gtk
from vanilla_installer.core.languages import all_languages, current_language
Expand Down Expand Up @@ -41,7 +42,6 @@ def __on_check_button_toggled(self, widget):
self.__selected_language["language_title"] = self.__title
self.__selected_language["language_subtitle"] = self.__subtitle


@Gtk.Template(resource_path="/org/vanillaos/Installer/gtk/default-language.ui")
class VanillaDefaultLanguage(Adw.Bin):
__gtype_name__ = "VanillaDefaultLanguage"
Expand All @@ -66,7 +66,7 @@ def __init__(self, window, distro_info, key, step, **kwargs):
self.all_languages_group.append(widget)

# signals
self.btn_next.connect("clicked", self.__window.next)
self.btn_next.connect("clicked", self.__next)
self.all_languages_group.connect(
"selected-rows-changed", self.__language_verify
)
Expand Down Expand Up @@ -99,6 +99,11 @@ def __generate_language_list_widgets(self):
self.selected_language["language_title"] = language_title
self.selected_language["language_subtitle"] = language_code

def __next(self, _):
os.environ["LANG"] = self.selected_language["language_subtitle"]
self.__window.rebuild_all()
self.__window.next()

def get_finals(self):
return {"language": self.selected_language["language_subtitle"]}

Expand Down
4 changes: 4 additions & 0 deletions vanilla_installer/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def rebuild_ui(self, mode=1):
self.install_mode = mode
self.__build_ui(True, mode)

def rebuild_all(self):
self.__builder = Builder(self)
self.rebuild_ui(self.install_mode)

def __build_ui(self, rebuild=False, mode=0):
property_list = self.__builder.property_list

Expand Down

0 comments on commit 1678d89

Please sign in to comment.