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

Christophe Fergeau cfergeau at redhat.com
Mon Dec 10 08:19:58 UTC 2012


On Thu, Nov 15, 2012 at 02:12:58AM -0200, Fabiano Fidêncio wrote:
> 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)

We went for en_US rather than en-US on the reasoning that this way we
wouldn't need to do remapping of the value for fedora (and hopefully other
distros). If fedora needs to remap from _ to -, then I'd rather we expect
'en-US' in the public API, and remap to en_US where needed. This means
the changes from 7285d51f8 and 97492696d needs to be adjusted as well.

Christophe


> ---
>  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
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20121210/b00a2d07/attachment.sig>


More information about the virt-tools-list mailing list