Sjur Moshagen wrote:
Den 26. sep. 2006 kl. 10.34 skrev Ross Gardler:

Does this new i18n solution require a ?locale=xx in the URL in any situations? If so then this is not a good solution. It will break the static build of the site since "?" is not a valid character in filenames, Cocoon therefore encodes this which in turn breaks links.

You need to make the language selection part of the url, i.e.

http://foo.com/bar.en.html

or

http://foo.com/en/bar.xml

I can open http://localhost:8888/index.en.html and have my page in English. The problem with this solution is that it does not work nicely in a webapp environment (e.g. forrest run), because this locale encoding does not communicate with the locale modules in Cocoon (LocaleAction, LocaleMatcher, I18nTransformer). Thus, all menus and tabs are/will most likely be in a different language. In addition, it's location in the menu is lost.

This brings me back to the idea of using the locationmap for locale matching rather than Cocoons components, which have their problems in our use case. Something like (be warned, I've not fully thought this through and do not have any i18n sites, I'm not at all sure this will work in the real world):

<match pattern="**.xml">
    <location src="{project:xdocs}/{1}.{2}.xml/>
</location>

<match pattern="**.*.xml">
  <select>
    <location src="{project:xdocs}/{1}.{2}.xml/>
    <location src="{project:xdocs}/{1}.{project:locale.default}.xml/>
  </select>
</location>

The problem with static builds is a known one in that you can't build all locales in the same run.

Yes, but if we have an url with foo.html?locale=en then no static site build will work due to the way Cocoon encodes the url parameters in the filename. Unless you have found away this.

The global language default should be set in a config file.

Agree, I just don't know how to do it.

It depends if you want to make your work compatible with 0.7 version of Forrest. If you do then see [1], but for an easier way in 0.8 see [2]

Note both of these are issues to document this process, so ask questions if you don't understand.

Ross

[1] http://issues.apache.org/jira/browse/FOR-777
[2] http://issues.apache.org/jira/browse/FOR-588