[virt-tools-list] [libosinfo 1/2] win7, installer: Translate l10n-language configuration

Fabiano Fidêncio fabiano at fidencio.org
Tue Nov 27 16:38:04 UTC 2012


On Nov 27, 2012 1:06 PM, "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
wrote:
>
> From: Fabiano Fidêncio <fabiano at fidencio.org>
>
> The expected format of l10n_language string is the gettext locale names
> standard:
>
>
https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Locale-Names.html
,
>
> While Windows expect this to be in *the* standard format:
>
> http://www.ietf.org/rfc/rfc4646.txt
>
> So we need to translate the language code for windows.
>
> Co-author & reviewer: Zeeshan Ali (Khattak) <zeeshanak at gnome.org>
> ---
>  data/install-scripts/windows-unattend.xml | 50
++++++++++++++++++++++++++-----
>  1 file changed, 42 insertions(+), 8 deletions(-)
>
> diff --git a/data/install-scripts/windows-unattend.xml
b/data/install-scripts/windows-unattend.xml
> index d3b2df5..0901e5b 100644
> --- a/data/install-scripts/windows-unattend.xml
> +++ b/data/install-scripts/windows-unattend.xml
> @@ -32,6 +32,23 @@
>            </xsl:choose>
>          </xsl:template>
>
> +        <xsl:template name="language">
> +          <xsl:variable name="language">
> +            <xsl:value-of select="config/l10n-language"/>
> +          </xsl:variable>
> +          <xsl:variable name="formatted-language">
> +            <xsl:value-of select="translate($language,'_','-')"/>
> +          </xsl:variable>
> +          <xsl:choose>
> +            <xsl:when test="contains($formatted-language,'.')">
> +              <xsl:value-of
select="substring-before($formatted-language,'.')"/>
> +            </xsl:when>
> +            <xsl:otherwise>
> +              <xsl:value-of select="$formatted-language"/>
> +            </xsl:otherwise>
> +          </xsl:choose>
> +        </xsl:template>
> +
>         <xsl:template name="arch">
>           <xsl:choose>
>             <xsl:when test="count(config/hardware-arch) > 0">
> @@ -99,11 +116,11 @@
>                   <xsl:call-template name="arch"/>
>                 </xsl:attribute>
>                 <SetupUILanguage>
> -                 <UILanguage><xsl:value-of
select="config/l10n-language"/></UILanguage>
> +                 <UILanguage><xsl:call-template
name="language"/></UILanguage>
>                 </SetupUILanguage>
> -               <SystemLocale><xsl:value-of
select="config/l10n-language"/></SystemLocale>
> -               <UILanguage><xsl:value-of
select="config/l10n-language"/></UILanguage>
> -               <UserLocale><xsl:value-of
select="config/l10n-language"/></UserLocale>
> +               <SystemLocale><xsl:call-template
name="language"/></SystemLocale>
> +               <UILanguage><xsl:call-template
name="language"/></UILanguage>
> +               <UserLocale><xsl:call-template
name="language"/></UserLocale>
>               </component>
>             </settings>
>             <settings pass="oobeSystem">
> @@ -213,6 +230,23 @@
>          </xsl:choose>
>        </xsl:template>
>
> +      <xsl:template name="language">
> +        <xsl:variable name="language">
> +          <xsl:value-of select="config/l10n-language"/>
> +        </xsl:variable>
> +        <xsl:variable name="formatted-language">
> +          <xsl:value-of select="translate($language,'_','-')"/>
> +        </xsl:variable>
> +        <xsl:choose>
> +          <xsl:when test="contains($formatted-language,'.')">
> +            <xsl:value-of
select="substring-before($formatted-language,'.')"/>
> +          </xsl:when>
> +          <xsl:otherwise>
> +            <xsl:value-of select="$formatted-language"/>
> +          </xsl:otherwise>
> +        </xsl:choose>
> +      </xsl:template>
> +
>        <xsl:template name="arch">
>         <xsl:choose>
>          <xsl:when test="config/hardware-arch = 'x86_64'">
> @@ -283,11 +317,11 @@
>            <xsl:call-template name="arch"/>
>           </xsl:attribute>
>           <SetupUILanguage>
> -          <UILanguage><xsl:value-of
select="config/l10n-language"/></UILanguage>
> +          <UILanguage><xsl:call-template name="language"/></UILanguage>
>           </SetupUILanguage>
> -         <SystemLocale><xsl:value-of
select="config/l10n-language"/></SystemLocale>
> -         <UILanguage><xsl:value-of
select="config/l10n-language"/></UILanguage>
> -         <UserLocale><xsl:value-of
select="config/l10n-language"/></UserLocale>
> +         <SystemLocale><xsl:call-template
name="language"/></SystemLocale>
> +         <UILanguage><xsl:call-template name="language"/></UILanguage>
> +         <UserLocale><xsl:call-template name="language"/></UserLocale>
>          </component>
>         </settings>
>         <xsl:if test="os/version > 6.0">
> --
> 1.8.0
>
>

ACK for both patches! _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20121127/7cee451c/attachment.htm>


More information about the virt-tools-list mailing list