We have a requirement to create a force.com site in 2 languages english and spanish. We plan to use custom labels to display content on spanish but our content exceeds more than 5000 custom labels which is a governor limit. What is the other options to display content in spanish other than custom labels? Could you guys share some experiences please? Thanks Buyan
|
Never heard of such limit. Are you saying there's limit on how many custom labels there can be? Or how many characters can be in the body of a label? If it's about too many characters - can't you simply cut your content by paragraph or something? Sounds like a huge "wall of text"... My next question would be "is this text really, really static?" Custom labels are fine when you have something that's not changing too often. If your users will start complaining "we want to be able to edit it without involving IT, raising a change request ticket, blah blah blah" - it's a good time to check if you wouldn't be better creating some small custom object with 1 field per language (textarea? rich text field?). Or maybe 1 field but several records - the object will have a "language" field too - with just 1 field you'll be able to go all the way to 32K characters. Normal (authenticated) users can set their own lang in setup. But it is your job to set the language for your Site users (guests who are just browsing the page). http://wiki.developerforce.com/page/An_Introduction_to_Force.com_Sites is a good start (search for "Multi Language Support"). Once you have it as a parameter available in Apex (for example
and later in visualforce you'd refer to these as This is of course a very crude example but should give you some ideas ;) For example it might be better to build a map of labelname => actual text and later in VF have SUBSTITUTE etc. How to populate your text dynamically injecting "Dear John Doe, thank you for your payment..." using Example scenario: I need to send a simple translated email to a Contact. If Contact is attached to the record and I can use it - awesome. If there's no Contact (my user just typed the email address by hand instead of making a new COntact and linking it) - it should fall back to "Dear Sir or Madam" instead of "Dear John Doe". I have 2 custom labels:
And in Spanish (European) they're translated to:
And here's my email template:
Looks a bit scary but I simply replace the [contact] placeholder and attach current user's data at the end. I don't know if you'll have Contacts available on your site, it's for guests after all... but you need some way of capturing their data anyway so just adjust the merge fields to point to your controller variables or something. |
|||||||||||||
|