So I’ve got my basic template (in the native language) pretty much set up. However I will also need to add English and French parts (with Spanish and German possibly following later).
The template should be the same if possible, but if necessary it’s not a problem to provide different templates for different languages. Website is medium-sized.
The English portion should come in /modx/en/ (later when in production just /en/ ) and the French in /modx/fr/ (later when in production just /fr/ ). The file names of the pages should not be the same, in fact they *should* be different. I suppose that’s not really a problem as I have friendly aliases enabled and it should take the page names I specified in the interface manager...
Anything in particular I should pay attention to, or can I just create the pages and start?
And how will/can the ’tree’ inside Modx Content Manager adapt to this situation? (if possible, I’d like the /fr/ and /en/ pages to show as a subfolder of the ’/modx/index.php’ file... under the motto ’one index page to rule them all’ :p )
-
☆ A M B ☆
- 24,524 Posts
Put your English documents under one top-level document, English. Put a FirstChildRedirect snippet call in its content. Duplicate the English (top-level) document. You’ll get a duplicate of the entire English section. Rename and edit the documents. Repeat the duplicate of that top-level document as many times as you want for as many languages as you want.
Use the top-level documents for your language choice menu. I use TVs with @INHERIT binding a lot, edit them for the top-level document to use snippet calls specific for each language (with parameters for the languages, or using language-specific chunk templates). The children (in this case, the entire language group) inherit that parent document’s values for the TV, so menus etc all get the same start values within their group.
There is an excellent article in the wiki for cross-linking pages if you want to do that.
-
☆ A M B ☆
- 24,524 Posts
http://wiki.modxcms.com/index.php/Make_Multi_Lingual_Site
Yes, that is what the method does. I’m using it on one multilingual site; the other doesn’t require that pages be cross-linked, so I just use a cookie to specify the ID of the parent language file (the top-level document ID), and use that value as the startId of the main menu Wayfinder call. But that site has four languages, and I have a custom module that lands the user on an outside common document, so I need to know where to send the user when he wants to go back, as well as where to start the main menu for that common page. Sessions tend to time-out on their server rather quickly; I did use a save_session_path function but that was more trouble than simply using a cookie to keep track of which language the user was in.
For cross-linking, each document has a TV "langlink", that’s a text input. When creating/editing a document, you use the form en:7 to specify the document’s alter ego in the English section. I don’t cross-link individual "news" documents, all news documents are set to point to the other langauge’s main News page; this avoids any problems where news or blog or whatever pages aren’t totally matching all the time.