No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0026.xml 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM "xep.ent">
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Internationalization (I18N)</title>
  10. <abstract>NOTE WELL: this document was retracted on 2003-11-05 since the topic is addressed definitively in XMPP Core. Please refer to XMPP Core for further information.</abstract>
  11. &LEGALNOTICE;
  12. <number>0026</number>
  13. <status>Retracted</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies/>
  17. <supersedes/>
  18. <supersededby><spec>XMPP Core</spec></supersededby>
  19. <shortname>N/A</shortname>
  20. <author>
  21. <firstname>Max</firstname>
  22. <surname>Horn</surname>
  23. <email>max@quendi.de</email>
  24. <jid>black_fingolfin@jabber.org</jid>
  25. </author>
  26. <revision>
  27. <version>0.2</version>
  28. <date>2003-11-05</date>
  29. <initials>psa</initials>
  30. <remark>The status of this document has been changed to Retracted since it has been superseded by XMPP Core.</remark>
  31. </revision>
  32. <revision>
  33. <version>0.1</version>
  34. <date>2002-03-14</date>
  35. <initials>mh</initials>
  36. <remark>Initial version.</remark>
  37. </revision>
  38. </header>
  39. <section1 topic='Introduction'>
  40. <p>
  41. Jabber is meant to allow people everywhere in the world to communicate
  42. with each other. However, people converse in many different languages, not just
  43. English. Many humans in fact don't even understand English. Hence,
  44. Jabber should not be tied to a particular language, but rather allow
  45. usage of any language, be it English, Chinese, Inuit, or anything else.
  46. </p>
  47. <p>
  48. One important step towards this goal is that Jabber is based upon
  49. Unicode, allowing for many different languages. But that alone is not
  50. enough. Jabber promotes a server-based system for many of its
  51. components and services, like the JUD, or transports. Many of these have
  52. to interact with users in some way. Currently, they do so in only one
  53. fixed language (usually English). Even if the server admin is willing
  54. to translate the messages, forms, etc. involved, there can only be one
  55. localization active for a given server/component.
  56. </p>
  57. <p>
  58. Hence, Jabber must support a way for clients to inform the server about
  59. their preferred language. In addition, the server and other components
  60. have to understand and honor this information. Only this way can we
  61. ensure that Jabber is able to work in a multi-national, multi-lingual
  62. environment.
  63. </p>
  64. <p>
  65. Some examples on how this information could and should be used, include
  66. </p>
  67. <ul>
  68. <li>Forms (e.g. for registration or searching, refer also to &xep0004;) can be localized, so that instructions and field labels are in the native language of the person who has to fill them out</li>
  69. <li>Even if the form can't be sent in the proper language (e.g. simply because it hasn't yet been translated), the component still should tag its reply with the language being used</li>
  70. <li>Incoming messages in a different language could be automatically translated (server-side or client-side)</li>
  71. <li>Redirection of messages based on their language (think of a help desk which services world wide requests)</li>
  72. <li>Transports to services which are not unicode based could use the language information as a hint at the best encoding (least lossage) for converted messages</li>
  73. </ul>
  74. </section1>
  75. <section1 topic='Implementation'>
  76. <p>
  77. The basic idea behind this proposal was to use existing standards where possible, and to make it fully backward compatible. Furthermore it was a goal to allow clients to support it now, even without any server support, while at the same time permitting improved functionality once servers start to implement this spec.
  78. </p>
  79. <section2 topic='Encoding the locale'>
  80. <p>To encode the locale on any given XML packet, we use the xml:lang attribute, as defined in the <link url="http://www.w3.org/TR/REC-xml#sec-lang-tag">XML specification</link>. This in turn uses values as specified in <link url="http://www.ietf.org/rfc/rfc1766.txt">RFC 1766</link> to encode languages and regions. This way, you can even distinguish between British and Australian English.
  81. </p>
  82. <example caption='Example message with locale set to German'>
  83. &lt;message to='friedrich@jabber.org' xml:lang='de-DE'&gt;
  84. &lt;body&gt;Ich bin ein Berliner!&lt;/body&gt;
  85. &lt;/message&gt; </example>
  86. <p>
  87. An xml:lang tag can be put onto any XML element; for the purposes of this document, however, we will limit its usage to the four central Jabber elements: &lt;stream/&gt;, &lt;message/&gt;, &lt;iq/&gt; and &lt;presence/&gt;.
  88. </p>
  89. </section2>
  90. <section2 topic='Client support'>
  91. <p>
  92. A client claiming to support this document has to initiate server connection slightly differently by putting an xml:lang attribute in the initial &lt;stream:stream&gt; element.
  93. </p>
  94. <example caption='Jabber session initiated with Canadian French as default'>
  95. &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  96. &lt;stream:stream to='jabber.org' xmlns='jabber:client'
  97. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='fr-CA'&gt; </example>
  98. <p>
  99. Servers not supporting this document will just ignore the additional attribute. Compliant server can be distinguished by the fact that their reply &lt;stream:stream&gt; element also contains an xml:lang attribute, indicating the main language of the server. A compliant client has to detect whether the server is compliant or not, and base its future behavior on this information.
  100. </p>
  101. <example caption='Reply by an English-language Jabber server'>
  102. &lt;stream:stream from='jabber.org' id='12345' xmlns='jabber:client'
  103. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'&gt; </example>
  104. <p>
  105. If the client thus determines that the server is compliant, then it doesn't have to do anything beyond this point. All its outgoing messages will automatically be flagged by the server with an xml:lang attribute if necessary. Thus writing a minimal compliant client is trivial.
  106. </p>
  107. <p>
  108. If it is determined that the server does not support this document, and the client still wants to offer locale support, it may start flagging all its outgoing message/iq/presence elements with the xml:lang attribute, to ensure that other components/clients which do conform to this document can handle the localization despite the local server not doing so.
  109. </p>
  110. <p>
  111. Finally, if for whatever reasons the client wants to flag particular messages with a different locale (e.g. if the user is bilingual), it can do so at any time by putting an appropriate xml:lang element in the outgoing data. This will override the previously set default locale for this message only.
  112. </p>
  113. </section2>
  114. <section2 topic='Server support'>
  115. <p>
  116. A compliant server must detect the xml:lang attribute in incoming &lt;stream:stream&gt; elements. The server then has to store this information for later use, i.e. it has to remember the default language for each active session.
  117. </p>
  118. <p>
  119. Additionally, a compliant server must attach an xml:lang attribute to the reply &lt;stream:stream&gt; element sent in response to a newly initiated connection. This attribute should reflect the default language of that server, and is used to indicate to clients that the server implements this document.
  120. </p>
  121. <p>
  122. The server should not only allow user clients to specify a default language this way, but also server-side components, like the JUD should be allowed to do this.
  123. </p>
  124. <p>
  125. Whenever a message leave the server, it has to tag the message automatically with the xml:lang attribute of the corresponding seesion, if any was specified, unless the message is already tagged this way. In that case, the already existing xml:lang attribute takes precedence, thus allowing for greater flexibility.
  126. </p>
  127. <p>
  128. If a client send a message to another local client which uses the same xml:lang value, then no change is applied. But if the recipient uses a different xml:lang, and if the message has no xml:lang attribute attached yet, the xml:lang of the server has to be attached before delievey of the message.
  129. </p>
  130. </section2>
  131. <section2 topic='Service support'>
  132. <p>
  133. Jabber based services that wish to comply to this document have to make sure that all information they send to clients is tagged with an xml:lang attribute corresponding to the language used in the outgoing data, if appropriate, even if the component supports no other localizations. An example for this is a search form based on <cite>XEP-0004</cite>.
  134. </p>
  135. <example caption='Search form in English'>
  136. &lt;iq from='users.jabber.org' type='result' id='4' xml:lang='en'&gt;
  137. &lt;query xmlns='jabber:iq:search'&gt;
  138. &lt;instructions&gt;
  139. Fill in a field to search for any matching Jabber users.
  140. &lt;/instructions&gt;
  141. &lt;nick/&gt;
  142. &lt;first/&gt;
  143. &lt;last/&gt;
  144. &lt;email/&gt;
  145. &lt;x xmlns='jabber:x:data'&gt;
  146. &lt;instructions&gt;
  147. To search for a user fill out at least one
  148. of the fields below and submit the form.
  149. &lt;/instructions&gt;
  150. &lt;field type='text-single' label='First (Given)' var='first'/&gt;
  151. &lt;field type='text-single' label='Last (Family)' var='last'/&gt;
  152. &lt;field type='text-single' label='Nick (Alias)' var='nick'/&gt;
  153. &lt;field type='text-single' label='Email' var='email'/&gt;
  154. &lt;/x&gt;
  155. &lt;/query&gt;
  156. &lt;/iq&gt; </example>
  157. <p>
  158. This way, a client could for example offer to translate the form since it now knows the language the form was written in. Previously it could just guess the language was English, which never was guaranteed.
  159. </p>
  160. <p>
  161. To be able to tailor replies to the user's preferred language, the component has to know this information. This is simply inferred from any xml:lang attribute on incoming requests. If none is present, the default locale is assumed. If the client's default locale diverges from that of the component, it is the server's responsibility to tag the query with an appropriate xml:lang attribute (refer to the "Server support" section). If on the other hand the server is not compliant, then any interested client will manually tag its queries with an xml:lang attribute. Thus it is sufficient to check for this attribute.
  162. </p>
  163. <example caption='Request for a German-language search form'>
  164. &lt;iq to='users.jabber.org' type='get' id='5' xml:lang='de'&gt;
  165. &lt;query xmlns='jabber:iq:search'/&gt;
  166. &lt;/iq&gt; </example>
  167. <p>
  168. A more sophisticated component supporting multiple localizations of its forms/messages could now honor the requested language and send this search form instead of the English one shown previously:
  169. </p>
  170. <example caption='Search form in German'>
  171. &lt;iq from='users.jabber.org' type='result' id='5' xml:lang='de'&gt;
  172. &lt;query xmlns='jabber:iq:search'&gt;
  173. &lt;instructions&gt;
  174. F&#252;llen Sie ein Feld aus um nach einem beliebigen
  175. passenden Jabber-Benutzer zu suchen.
  176. &lt;/instructions&gt;
  177. &lt;nick/&gt;
  178. &lt;first/&gt;
  179. &lt;last/&gt;
  180. &lt;email/&gt;
  181. &lt;x xmlns='jabber:x:data'&gt;
  182. &lt;instructions&gt;
  183. Um nach einem Benutzer zu suchen, f&#252;llen Sie mindestens eines
  184. der folgenden Felder aus und schicken dann das Formular ab.
  185. &lt;/instructions&gt;
  186. &lt;field type='text-single' label='Vorname' var='first'/&gt;
  187. &lt;field type='text-single' label='Nachname' var='last'/&gt;
  188. &lt;field type='text-single' label='Spitzname' var='nick'/&gt;
  189. &lt;field type='text-single' label='Email' var='email'/&gt;
  190. &lt;/x&gt;
  191. &lt;/query&gt;
  192. &lt;/iq&gt; </example>
  193. <p>
  194. If the component doesn't have the requested localization available, it replies with the default localization (but of course with the matching xml:lang attribute tagged to it, and not the one of the request).
  195. </p>
  196. </section2>
  197. </section1>
  198. </xep>