| ----- |
| i18n |
| ----- |
| Olivier Lamy |
| ----- |
| 2012-01-19 |
| ----- |
| |
| ~~ 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. |
| |
| ~~ NOTE: For help with the syntax of this file, see: |
| ~~ http://maven.apache.org/guides/mini/guide-apt-format.html |
| |
| i18n management |
| |
| The js library {{{http://code.google.com/p/jquery-i18n-properties}jquery-i18n-properties}} is used for i18n. |
| |
| On application loading, i18n properties are loaded by calling a REST services with the browser lang |
| or with the requested language specified by the request parameter : ?request_lang=en. |
| |
| This service will load properties in this order: |
| |
| * redback properties in en then in specified language |
| |
| * archiva properties (from org/apache/archiva/i18n/default.properties) in en then in specified language |
| |
| * Javascript method |
| |
| Simple i18n value without any value |
| |
| +----------------------- |
| Javascript code : |
| $.i18n.prop("save") will return the value for key save |
| +----------------------- |
| |
| |
| You can pass some values too (sample for property managedrepository.deleted=Managed Repository " \{0} " deleted. ) |
| |
| +----------------------- |
| Javascript code : |
| $.i18n.prop("managedrepository.deleted",managedRepository.name()) |
| if managedRepository.name() is "foo" |
| response will be Managed Repository " foo " deleted. |
| +----------------------- |
| |
| * Missing properties |
| |
| In case of missing property, the key is returned. |