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

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Thu Nov 15 23:27:21 UTC 2012


On Fri, Nov 16, 2012 at 12:34 AM, Fabiano Fidêncio <fabiano at fidencio.org> wrote:
> On Thu, Nov 15, 2012 at 6:22 PM, Zeeshan Ali (Khattak)
> <zeeshanak at gnome.org> wrote:
>> On Thu, Nov 15, 2012 at 7:18 PM, Fabiano Fidêncio <fabiano at fidencio.org> wrote:
>>> Add this translation in the windows template file because the script
>>> must have the language set using non-linux standard format.
>>> Windows will use, for instance, en-US instead of en_US or en_US.utf8.
>>
>> This log and the doc comment below could be improved:
>>
>> * There is no 'unix standard' or 'non-linux standard'.
>> * You want to point to what you are calling the standard:
>> https://www.ietf.org/rfc/rfc4646.txt
>> * The above log still makes it sound like windows is the one thats not
>> following the standard. You want to point out that although Linux is
>> not following the standard, why we are expected the string in Linux
>> format.
>> * We should probably specify more explitictly that '.utf8' part is
>> accepted but optional.
>>
>
> Ok.
>>> ---
>>>  data/install-scripts/windows-unattend.xml | 56 ++++++++++++++++++++++++++-----
>>>  osinfo/osinfo_install_config.c            | 10 +++++-
>>>  2 files changed, 57 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/data/install-scripts/windows-unattend.xml b/data/install-scripts/windows-unattend.xml
>>> index d3b2df5..56672b9 100644
>>> --- a/data/install-scripts/windows-unattend.xml
>>> +++ b/data/install-scripts/windows-unattend.xml
>>> @@ -32,6 +32,26 @@
>>>            </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="new-l10n-language">
>>> +            <xsl:value-of select="translate($l10n-language,'_','-')"/>
>>> +          </xsl:variable>
>>> +          <xsl:choose>
>>> +            <xsl:when test="contains($new-l10n-language,'.')">
>>
>> What does 'substring-before' return if there is not '.' ? Just
>> wondering if its worth it to have this check here.
>
> Returns an empty string.
> So, the if is really necessary.

Good! Just wanted to make sure.

>>
>>> +              <xsl:variable name="windows-language">
>>> +                <xsl:value-of select="substring-before($new-l10n-language,'.')"/>
>>> +              </xsl:variable>
>>> +              <xsl:value-of select="$windows-language"/>
>>> +            </xsl:when>
>>> +            <xsl:otherwise>
>>> +              <xsl:value-of select="$new-l10n-language"/>
>>
>> Are you sure "$" is needed here?
>
> I'll test.

Just to be clear, I meant that is the use of variables here really needed?

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the virt-tools-list mailing list