set xml:lang attribute on opening XML stream. fixes #2772

This commit is contained in:
Yann Leboulanger 2007-07-27 20:00:44 +00:00
parent 7dd8a27b39
commit c71eed99b8
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,7 @@ Contains one tunable attribute: DefaultTimeout (25 seconds by default). It defin
Dispatcher.SendAndWaitForResponce method will wait for reply stanza before giving up.
'''
import simplexml, sys
import simplexml, sys, locale
from xml.parsers.expat import ExpatError
from protocol import *
from client import PlugIn
@ -111,6 +111,9 @@ class Dispatcher(PlugIn):
self._metastream.setAttr('version', '1.0')
self._metastream.setAttr('xmlns:stream', NS_STREAMS)
self._metastream.setAttr('to', self._owner.Server)
if locale.getdefaultlocale()[0]:
self._metastream.setAttr('xml:lang',
locale.getdefaultlocale()[0].split('_')[0])
self._owner.send("<?xml version='1.0'?>%s>" % str(self._metastream)[:-2])
def _check_stream_start(self, ns, tag, attrs):