[gnome-boxes] Set language in case of express installation
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Set language in case of express installation
- Date: Thu, 8 Dec 2011 17:22:20 +0000 (UTC)
commit 469b875a463f192cbe1113e66a1d5da03a2ea6e8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Dec 8 15:21:43 2011 +0200
Set language in case of express installation
Currently it only works for Windows 7, Windows 2008 and Fedora.
https://bugzilla.gnome.org/show_bug.cgi?id=665803
data/fedora.ks | 2 +-
data/win7.xml | 8 ++++----
src/unattended-installer.vala | 7 +++++++
src/win7-installer.vala | 4 ++++
4 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/data/fedora.ks b/data/fedora.ks
index 8799eab..e54a5f5 100644
--- a/data/fedora.ks
+++ b/data/fedora.ks
@@ -1,6 +1,6 @@
install
keyboard BOXES_KBD
-lang en_US.UTF-8
+lang BOXES_LANG
network --device eth0 --bootproto dhcp
rootpw whatever
firewall --disabled
diff --git a/data/win7.xml b/data/win7.xml
index c691257..5c5e7e4 100644
--- a/data/win7.xml
+++ b/data/win7.xml
@@ -48,11 +48,11 @@
</component>
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
- <UILanguage>en-US</UILanguage>
+ <UILanguage>BOXES_LANG</UILanguage>
</SetupUILanguage>
- <SystemLocale>en-US</SystemLocale>
- <UILanguage>en-US</UILanguage>
- <UserLocale>en-US</UserLocale>
+ <SystemLocale>BOXES_LANG</SystemLocale>
+ <UILanguage>BOXES_LANG</UILanguage>
+ <UserLocale>BOXES_LANG</UserLocale>
</component>
</settings>
<settings pass="oobeSystem">
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 68e3ede..503c772 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -42,11 +42,13 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
protected string timezone;
protected string kbd;
+ protected string lang;
private static Regex username_regex;
private static Regex password_regex;
private static Regex timezone_regex;
private static Regex kbd_regex;
+ private static Regex lang_regex;
static construct {
try {
@@ -54,6 +56,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
password_regex = new Regex ("BOXES_PASSWORD");
timezone_regex = new Regex ("BOXES_TZ");
kbd_regex = new Regex ("BOXES_KBD");
+ lang_regex = new Regex ("BOXES_LANG");
} catch (RegexError error) {
// This just can't fail
assert_not_reached ();
@@ -82,6 +85,9 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
var layouts = settings.get_strv ("layouts");
kbd = layouts[0] ?? "us";
+ var langs = Intl.get_language_names ();
+ lang = langs[0];
+
setup_ui ();
}
@@ -275,6 +281,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
str = password_regex.replace (str, str.length, 0, password_entry.text);
str = timezone_regex.replace (str, str.length, 0, timezone);
str = kbd_regex.replace (str, str.length, 0, kbd);
+ str = lang_regex.replace (str, str.length, 0, lang);
yield output_stream.write_async (str.data, Priority.DEFAULT, cancellable);
}
diff --git a/src/win7-installer.vala b/src/win7-installer.vala
index 9db0c0b..2cdf904 100644
--- a/src/win7-installer.vala
+++ b/src/win7-installer.vala
@@ -5,5 +5,9 @@ private class Boxes.Win7Installer: UnattendedInstaller {
public Win7Installer.copy (InstallerMedia media) throws GLib.Error {
var unattended_source = get_unattended_dir (media.os.short_id + ".xml");
base.copy (media, unattended_source, "Autounattend.xml");
+
+ lang = lang.replace ("_", "-");
+ // Remove '.' and everything after it
+ lang = /\..*/i.replace (lang, -1, 0, "");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]