Path

ez projects / ezjscore / forum / general / multi language problem


multi language problem

You need to be logged in to post messages in the forums. New users may register here.

Sascha Frinken

Member since:
09 January 2008

Posts: 3

Monday 19 April 2010 2:57:12 pm

Hi,

I am having some small problems getting the right language of an object from the ajax server.
I have two siteaccesses, de (german) and en (english),

I am using the ezjsctemplate::<mytemplate> function. If I call the script via it's uri:

http://example.com/en/ezjscore/call/ezjsctemplate::<mytemplate>

I get the english version of the node I fetched inside the template.
If I call

http://example.com/en/ezjscore/call/ezjsctemplate::<mytemplate>

I get the german version. But if I am using the yui3 function:



    YUI( YUI3_config ).use('io-ez', function( Y ) {


 

       Y.io.ez( 'ezjsctemplate::productFamily', {


           on: {success: function(id,r){ alert(r.responseJSON.error_text || r.responseJSON.content) }}


       });


   });




Language changes do not change the content of node in the template. I need to clear the cache and reload the page to get the correct language.
I found out that in the included js (http://example.com/var/plain_site...a215fda99ec4681a30b98678f55f54ac.js), where the io-ez function is defined, there is a variable rootUrl which starts with either '/de/' or '/en/' representing the current siteaccess (language). This only changes when the cache has been cleared.

Am I doing something wrong?


Up

André R.

Member since:
14 January 2008

Posts: 170

Tuesday 20 April 2010 12:20:35 am

Hi!

No, this should have been mentioned in doc and examples.
How to deal with this is basically to do like in ezoe, append the current language to the call, in ezoe case:
'ezoe::i18n::'|concat( $language ) *

But in your case:
{ezscript_require(array( 'ezjsc::yui3', 'ezjsc::yui3io::'|concat( $language ) ) )}

yui3io does not take any arguments, so will ignore the $language, but it will be part of the cache hash making the cache unique pr language




* http://svn.projects.ez.no/ezoe/tr...ent/datatype/edit/ezxmltext_ezoe.tpl

Lead Engineer eZ Publish
@: http://twitter.com/andrerom

Up

Sascha Frinken

Member since:
09 January 2008

Posts: 3

Tuesday 20 April 2010 5:20:05 pm

Hi André,

first of all thank You very much - works like a charm.

rgds.

Sascha
Up

You need to be logged in to post messages in the forums. New users may register here.