Setting the accept-language header from zpt fails
Hi, I'm trying to set the accept-language from zpt in order to force PlacelessTranslationService to use other language than the one set on my browser. I have an index_html template with I call like this: http://myurl/index_html?lang=de Theorically the template should check if lang exist, then set the accept-language header, but it doesn't work. It seems like either PlacelessTranslationService takes always the 'accept-language' from the browser, or I'm doing something else wrong. Here is the code: <div tal:define="global lang python:request.get('lang',0)" tal:omit-tag=""></div> <div tal:condition="lang" tal:omit-tag="" tal:define="dummy python:request.RESPONSE.setHeader('Accept-Language',lang)"></div> <html> <body> <h4 i18n:translate="" i18n:domain="JMColorPicker">Please choose a color</h4> Language: <div tal:replace="lang"></div> </body> </html> When calling the template with the "lang" parameter, the language will be printed correctly (ie: it will print de), but the message "Please choose a color" will be translated to the language of my browser (ie: es) and not to the language specified by "lang" (ie: de). I even added: <head> <meta tal:condition="lang" http-equiv="Accept-Language" content="en" tal:attributes="content lang"> </head> But it didn't work either. Am I doing something wrong? Or is this not possible with PlacelessTranslationService? Thanks in advanced, Josef
participants (1)
-
Josef Meile