Forum
Internationalization
Hi,
What's the best way to go about having multiple translations of a page? I'm toying with the idea of using two editable content fields, one for english and another for spanish - for example.
Anyone done this already? Any input or ideas highly appreciated. I'm thinking to just pass the language variable via get, like so:
https://mywebpage.com/?lang=en
Sorry if this is already covered in this forum, I tried to search but nothing came up :-)
Thanks!
There are some methods outlined in the docs: https://solutions.grabaperch.com/architecture/how-do-i-create-a-multilingual-site
Jarl, I have just started building a multilingual site and setting the language in a session seemed appealing initially. However it soon got messy and now I think that a branched site is a better overall strategy.
The second option of passing in the language variable was appealing as you only have to create one page and Perch automatically creates two editable regions, Heading - en Heading - es Body - en Body - es This also means that you only need to create one page with dual language sections, so far so good. However, if you start to think about structured content and including nested templates and layouts then option 2 starts getting a bit messy.
For simplicity and flexibility I have found that option 1 works really well. Keeping page templates lean and pulling in shared templates for the content:
From an end users point of view it is also a lot less confusing in the admin section as both branches are quite clearly separated, whereas $Lang mixes the en and es sections together, so more chance of confusion and errors.
For me it seemed easier to let perch handle the navigation as you go further down a branch.
It also allows you to localise a branch for one language that may not be required on the other branch e.g., For a restaurant an explanation of Spanish menu items might be useful in English, but not required in Spanish. This is easy to address in a branched site.
You can also use both methods where it suits.
Note: I am just building my first multilingual site with Perch, so I'm no expert.
Hope this helps
We've also created a site that's currently one language but will be five. We also opted for 'strategy one'. The main reason is that its very clear what pages are what language in the admin area. We decided to keep the languages completely separate. Even though the layout of the pages will be very similar in each language, we could see requirements for selective images changes and there will also be some minor styling changes due to the amount of room some languages need.Large parts of the site design are in the style sheet(s) anyway so we hope we're also catering for future design changes. Can't yet tell if we made the right decision as the site is still only one language at the moment.
Thanks for all the great input, and especially thanks to Andy for sharing the code.
I have decided to scrap my original plan and go with a branched site, as per your recommendations.
Good points there Graham with different content.
And thanks for fetching the link to this in documentation Rachel, should have dug a little further ;-)