W3C home > Mailing lists > Public > www-svg@w3.org > September 2003

Re: SWITCH is an imprecise tool for offering alternatives.

From: Matthew Good <mag5v@virginia.edu>
Date: Mon, 01 Sep 2003 16:46:27 -0400
Message-ID: <3F53B023.1090800@virginia.edu>
To: www-svg@w3.org

> I'm not sure that the switch evaluation in SVG is done in the same way as it
> is done in SMIL, if yes: in your example
> 
> you can specify as default alternative the one that corresponds to
> systemLanguage="en" and so you can write:
> 
>  <switch>
>    <text systemLanguage="en">Yes</text>
>    <text systemLanguage="de">Ja</text>
>    <text >Yes</text>
>  </switch>
> 
> So, here we are sure that the user will receive something in all the
> situations (the text "Yes" or "Ja")

This doesn't really address the issue here.  Yes, you can specify a default to
fall back on if the user's language is not present, but the problems arise when
users accept multiple languages.  With this example it's actually not a good
idea to duplicate one of the existing languages as the default since for long
passages this would lead to a lot of duplicate text.  You could rewrite this as:

<switch>
  <text systemLanguage="de">Ja</text>
  <text>Yes</text>
</switch>

This will actually do the same thing as the previous example in many cases.
However, if the user's accepted languages included both English and German
the first example would display in English and the second would display in
German.  

I believe that using the switch block to choose between different language
translations is an inadequate syntax.  Switch blocks work in situations
where the author knows the order in which the conditions should be tested,
but when choosing between language translations it is the viewer's preferences
that are important.  The switch syntax provides the author no way of taking
the viewer's order of preference into account when rendering the text.  

Now, theoretically an SVG viewer could go against the specification when
rendering a switch block with multiple systemLanguages and rank them in the
order of the user's preferences to find the text which the user would prefer
to view.  There are still a few problems with this approach.  The default has
no associated language.  So, in my example above a user who preferred English
over German would receive the German since the viewer would have no way to
determine that the default text at the end was English.

The author is also not constrained to only use systemLanguage as a condition
within a switch block.  If the author mixed systemLanguage conditions with
other conditions in the same switch block the viewer would no longer be
able to rank them based on the user's language preference and would have to
process them in sequential order.  

Since switch is meant to be used in a variety of situations I don't believe it
makes sense to customize it in order to remedy the problems that exist when
choosing language alternatives, so I think it may be necessary to add a new
construct for offering multiple translations within an SVG document.  I haven't
quite figured out what I think this should look like yet, but I would like to
see some discussion on this topic.

-Matthew Good
Received on Monday, 1 September 2003 16:56:44 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:25 GMT