~~ $Id$ ~~ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ ----------- Tiles Localization ----------- Localization support Customizing pages for different locales in a common practice: in real-world websites you can see different sites for different languages and countries. It can be a matter of changing the layout (for example, in Arab countries the menu should stay on the right, instead of the left), or providing alternate content. * Creating localized definitions Localization is immediately available. To use the benefits of localization you have to create different Tiles definition files for each locale you want to support: it's simply a matter of appending the locale code at the end of the file name (just like <<<.properties>>> files in resource bundles). For example, if you have the <<>> file and you want to support French and Italian locale, you have to create at least three files: -------------------------------- tiles.xml tiles_fr.xml tiles_it.xml -------------------------------- You can also distinguish between different languages in different country. So if you want to distinguish between British English and American English, you can create these files: -------------------------------- tiles_en_GB.xml tiles_en_US.xml -------------------------------- and so on. * Inheritance between localizations If you want to support different locales, you don't have to rewrite all the definitions, but only those that differ from the main definitions file. In other words, locale-specific definition files contains the "overrides" to the default definitions. For example, suppose that the following definition is declared in <<>>: ------------------------------------ ------------------------------------ In <<>> there is a new declaration of <<>> definition: ------------------------------------ ------------------------------------ Using "it" locale, the title will be different from the default, while the rest remains the same. Notice that the <<>> definition is the one defined in the default definitions file: you still can reference to the default definitions, both when composing and when extending. You can also override a <>. In this case, when resolving inheritance, the overridden definition will be taken as a basis. For example, if in <<>> there are the following definitions: ------------------------------------ ------------------------------------ If in <<>> you define the following definition: ------------------------------------ ------------------------------------ The <<>> will extend the latter definition, and not the default! This is useful if you want to change an abstract definition for a locale, without redefining all the definitions.