[virt-tools-list] [libosinfo v2] install-scripts: Translate lang format when needed

Fabiano Fidêncio fabiano at fidencio.org
Thu Nov 15 04:12:58 UTC 2012


Add this translation in the fedora template file because kickstarter
script must set the language using the glib-way (eg: en_US) meanwhile
the application must set the language using l10n standard (eg: en-US)
---
 data/install-scripts/fedora.xml | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/data/install-scripts/fedora.xml b/data/install-scripts/fedora.xml
index dc767d5..f1befbd 100644
--- a/data/install-scripts/fedora.xml
+++ b/data/install-scripts/fedora.xml
@@ -37,6 +37,16 @@
           </xsl:choose>
         </xsl:template>
 
+        <xsl:template name="language">
+          <xsl:variable name="l10n-language">
+            <xsl:value-of select="config/l10n-language"/>
+          </xsl:variable>
+          <xsl:variable name="ks-language">
+            <xsl:value-of select="translate($l10n-language,'-','_')"/>
+          </xsl:variable>
+          <xsl:value-of select="$ks-language"/>
+        </xsl:template>
+
 	<xsl:template name="rootfs">
 	  <xsl:choose>
 	    <xsl:when test="os/version > 10">
@@ -64,9 +74,9 @@
 install
 text
 keyboard <xsl:value-of select="config/l10n-keyboard"/>
-lang <xsl:value-of select="config/l10n-language"/>
+lang <xsl:call-template name="language"/>
 <xsl:if test="os/version < 7">
-langsupport --default <xsl:value-of select="config/l10n-language"/> <xsl:value-of select="config/l10n-language"/>
+langsupport --default <xsl:call-template name="language"/> <xsl:call-template name="language"/>
 mouse generic3ps/2 --device psaux
 </xsl:if>
 skipx
@@ -149,6 +159,16 @@ reboot
           </xsl:choose>
         </xsl:template>
 
+        <xsl:template name="language">
+          <xsl:variable name="l10n-language">
+            <xsl:value-of select="config/l10n-language"/>
+          </xsl:variable>
+          <xsl:variable name="ks-language">
+            <xsl:value-of select="translate($l10n-language,'-','_')"/>
+          </xsl:variable>
+          <xsl:value-of select="$ks-language"/>
+        </xsl:template>
+
 	<xsl:template name="rootfs">
 	  <xsl:choose>
 	    <xsl:when test="os/version > 10">
@@ -175,7 +195,7 @@ reboot
 # Install script for <xsl:value-of select="os/short-id"/> profile <xsl:value-of select="script/profile"/>
 install
 keyboard <xsl:value-of select="config/l10n-keyboard"/>
-lang <xsl:value-of select="config/l10n-language"/>
+lang <xsl:call-template name="language"/>
 network --onboot yes --device eth0 --bootproto dhcp --noipv6 --hostname=<xsl:value-of select="config/hostname"/> --activate
 rootpw dummyPa55w0rd # Actual password set (or unset) in %post below
 firewall --disabled
-- 
1.8.0




More information about the virt-tools-list mailing list