3

I want to make site localization for guests.

How can I do it?

I am wondering how to set guest's language for all pages.

4

You can easily do it in the code, I don't think there's a way in the config of the Site itself.

Modify all your Site pages to include language param, for example

<apex:page
    standardStylesheets="false"
    showHeader="false"
    language="{!$CurrentPage.parameters.l}">

And then you'll need somehow (picklist on the site? cookie?) set the parameter in the URL to for example l=en_US, l=fr, l=nl etc.

  • Thanks. I've read this but it's not acceptable. Beacause I want to store language after user picked it. I would be awesome if I could retrieve coockie inside expression {!..} or even call some static method which will retrieve cockie. – Hlib Apr 11 '13 at 11:02
  • In the PageReference class you have getCookies() method. On lang selection you could set the cookie. If your sites share one controller / controller extension - add a variable there and reference this variable in expression on the page? If you don't want them to share 1 extension - simply copy over cookie-checking code into each class. – eyescream Apr 11 '13 at 11:18
  • Any way of hooking that up for standard pages, or only Visualforce? – Mike Chale Apr 11 '13 at 11:28
  • @MikeChale - you mean "en_US" user views standard page or a report and you'd want to show it in "fr" without Visualforce? No idea, never seen such thing and never needed one really. Maybe some sidebar hacks that'd sniff which page you're at, temporarily update User record, refresh the page... Messy. – eyescream Apr 11 '13 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.