Multilingual Support

Charles Moad edited this page Sep 20, 2012 · 2 revisions

All localizable parts of TourML optionally allow for specifying the language using the xml:lang attribute from http://www.w3.org/XML/1998/namespace. The elements using this attribute are all repeatable for allowing the inclusion of multiple language representations of the same content.

Here is a common example. Suppose you have multiple translations of a video file you would like to use in a Stop. Here is what the English-only TourML would look like for that Stop.

<?xml version="1.0" encoding="UTF-8"?>
<tourml:Tour xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:tourml="http://tapintomuseums.org/TourML"
  xmlns:xml="http://www.w3.org/XML/1998/namespace"
  tourml:id="org.tapintomuseums.example.Tour">
  
  <tourml:Asset tourml:id="vid-1">
    <tourml:Source tourml:format="video/quicktime" tourml:lastModified="2011-09-29T12:01:32" xml:lang="en" tourml:uri="file:///videos/zumaya.mov">
  </tourml:Asset>
	
  <tourml:Stop tourml:id="stop-1" tourml:view="video-stop">
    <tourml:Title xml:lang="en">The Music of Manuel de Zumaya</tourml:Title>
    <tourml:AssetRef tourml:id="vid-1" tourml:usage="primary" />
  </tourml:Stop>

</tourml:Tour>

Now here is the sample example with the Spanish translations added.

<?xml version="1.0" encoding="UTF-8"?>
<tourml:Tour xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:tourml="http://tapintomuseums.org/TourML"
  xmlns:xml="http://www.w3.org/XML/1998/namespace"
  tourml:id="org.tapintomuseums.example.Tour">
  
  <tourml:Asset tourml:id="vid-1">
    <tourml:Source tourml:format="video/quicktime" tourml:lastModified="2011-09-29T12:01:32" xml:lang="en" tourml:uri="file:///videos/zumaya.mov">
    <tourml:Source tourml:format="video/quicktime" tourml:lastModified="2011-09-30T15:04:09" xml:lang="es" tourml:uri="file:///videos/es/zumaya.mov">
  </tourml:Asset>
	
  <tourml:Stop tourml:id="stop-1" tourml:view="video-stop">
    <tourml:Title xml:lang="en">The Music of Manuel de Zumaya</tourml:Title>
    <tourml:Title xml:lang="es">La música de Manuel de Zumaya</tourml:Title>
    <tourml:AssetRef tourml:id="vid-1" tourml:usage="primary" />
  </tourml:Stop>

</tourml:Tour>

It is then up to application to track the active language and preference/display the correct localization based on user settings. Mature application platforms, like iOS, provide language priority. Those applications fall through languages and return the first source found based on the language priority. This alleviates applications from having content 100% translated.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.