Author: jcouteau Date: 2010-04-13 17:34:33 +0200 (Tue, 13 Apr 2010) New Revision: 1746 Log: Translate site in english (default language french) Make some modificatiosn on french doc Added: trunk/src/site/en/ trunk/src/site/en/apt/ trunk/src/site/en/apt/application.apt trunk/src/site/en/apt/bestPractices.apt trunk/src/site/en/apt/extendInitializer.apt trunk/src/site/en/apt/helloWorld.apt trunk/src/site/en/apt/index.apt trunk/src/site/en/apt/library.apt trunk/src/site/en/apt/presentation.apt trunk/src/site/site_en.xml Modified: trunk/pom.xml trunk/src/site/apt/application.apt trunk/src/site/apt/bestPractices.apt trunk/src/site/apt/extendInitializer.apt trunk/src/site/apt/helloWorld.apt trunk/src/site/apt/index.apt trunk/src/site/apt/library.apt trunk/src/site/apt/presentation.apt trunk/src/site/site_fr.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/pom.xml 2010-04-13 15:34:33 UTC (rev 1746) @@ -220,11 +220,16 @@ <packaging>pom</packaging> <properties> + <!-- pour un muli module on doit fixer le projectId --> <projectId>i18n</projectId> <processor.version>1.0.3</processor.version> <helper.version>1.2.3</helper.version> + + <!--Multilanguage maven-site --> + <siteLocales>fr,en</siteLocales> + </properties> <!-- ************************************************************* --> Modified: trunk/src/site/apt/application.apt =================================================================== --- trunk/src/site/apt/application.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/application.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,10 +26,6 @@ ~~ #L% ~~~ ----- -Tutoriel Application ----- - Tutoriel d'application utilisant Nuiton I18n et une librairie utilisant Nuiton I18n (utilisation de Maven) Modified: trunk/src/site/apt/bestPractices.apt =================================================================== --- trunk/src/site/apt/bestPractices.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/bestPractices.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,22 +26,19 @@ ~~ #L% ~~~ ----- -I18n Best pratices ----- +Bonnes pratiques Nuiton I18n -Nuiton I18n Best Practices +* Choisissez un pattern et suivez le. -* Choose a pattern and follow it + Dans une application ou une librairie, vous devriez choisir un pattern pour + les clés i18n. Vous pouvez choisir d'utiliser des clés comme + myapplication.key1 ou des phrases comme 'My application string'. Une fois que + vous avez fait votre choix, suivez-le afin de conserver de la consistance + dans votre application. Nottez que dans une application, vous pouvez utiliser + un pattern différent de celui utilisé dans ses dépendances. - In an application or a library, you should choose a pattern for the i18n keys. - You can either choose to use keys like myapplication.key1 or sentences like - 'My application string'. Once you made your choice, stick to it to keep a - consistency in your application. Note that in an application, you can choose a - different pattern than the one used in the dependencies. +* Toujours utiliser DefaultI18nInitializer dans une application finale. -* Always use DefaultI18nInitializer in final applications - - This is not an obligation, but as it makes you gain time at your application - initialisation, it is really advised to use DefaultI18nInitializer for all - your final applications. + Ce n'est pas une obligation, mais comme cela vous fait gagner un temps + considérable à l'initialisation, il est fortement conseillé d'utiliser + DefaultI18nInitializer pour toutes vos applications finales. Modified: trunk/src/site/apt/extendInitializer.apt =================================================================== --- trunk/src/site/apt/extendInitializer.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/extendInitializer.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,10 +26,6 @@ ~~ #L% ~~~ ----- -Extends Initializer ----- +Etendre Initializer pour répondre exactement à votre besoin -Extend Initializer to suit exactly your needs - TODO Modified: trunk/src/site/apt/helloWorld.apt =================================================================== --- trunk/src/site/apt/helloWorld.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/helloWorld.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,10 +26,6 @@ ~~ #L% ~~~ ----- -Tutoriel Hello World ----- - Nuiton I18n Hello World Ce premier tutorial a pour objectif de vous montrer comment se servir de la @@ -116,11 +112,9 @@ Félicitation, vous venez de traduire votre première application avec Nuiton I18n +Sources du tutoriel + Les sources de ce tutoriel sont téléchargeables {{{./helloworld.zip}ici}}. Elles sont packagées avec les librairies nécessaires à la compilation et l'exécution de cet exemple. - -Sources du tutoriel - - {{{./helloworld.zip}Sources du tutoriel}} Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/index.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,15 +26,8 @@ ~~ #L% ~~~ ----- Nuiton I18n ----- ----- -2010-04-02 ----- -Nuiton I18n - Le projet Nuiton I18n fournit des classes Java pour l'internationalisation (i18n) des applications. Modified: trunk/src/site/apt/library.apt =================================================================== --- trunk/src/site/apt/library.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/library.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,10 +26,6 @@ ~~ #L% ~~~ ----- -Tutoriel Librarie ----- - Tutoriel de librairie utilisant Nuiton I18n (utilisation de Maven) * Pourquoi un tutoriel différent pour une librairie et pour une application @@ -45,7 +41,7 @@ * Le tutoriel Dans ce tutoriel nous allons créer une librairie avec une classe unique qui va - juste afficher un message dans les logs. C'est ce message qui sera traduit. + juste afficher un message. C'est ce message qui sera traduit. * Créons le projet Maven et configurons le plugin Nuiton I18n Modified: trunk/src/site/apt/presentation.apt =================================================================== --- trunk/src/site/apt/presentation.apt 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/apt/presentation.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -26,10 +26,6 @@ ~~ #L% ~~~ ----- -Présentation I18n ----- - Présentation La librairie Nuiton I18n a un fonctionnement relativement simple. Les chaînes Added: trunk/src/site/en/apt/application.apt =================================================================== --- trunk/src/site/en/apt/application.apt (rev 0) +++ trunk/src/site/en/apt/application.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,87 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + +Tutorial of an application using Nuiton I18n and a library using Nuiton I18n +itself (use Maven) + + In this tutorial, we will create an application that will display a message + to the user and will call the unique method of the library we created in the + previous tutorial. We suppose in this tutorial, that you followed the two + previous tutorials in order not to start all over again. + +* I18n plugin configuration + + In the I18n plugin configuration, we will add the bundle goal. This goal + gathers all the application and its library i18n strings in order to create a + unique bundle. + +------------------- +<goal>bundle</goal> +------------------- + +* The application code + + In the previous examples, we used Nuiton I18n default values, but in order to + optimise loading, in a final application, it is necessary to change the + initializer before. The default initializer, ClassPathI18nInitializer, looks + for all the I18n bundles in the classpath in order to load them, but as our + plugin creates a unique bundle gathering all I18n strings, we can use + DefaultI18nInitializer, that takes into parameter the bundle name created by + the plugin, it will then load only the said bundle. This can make you gain up + to 10 secondes at load time, following the classpath size. + +------------------------------------------------------------------------------- +package org.myOrganisation.myApplication; + +import org.myOrganisation.myLibrary.myLibrary; +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.init; +import static org.nuiton.i18n.I18n.setInitializer; +import org.nuiton.i18n.init.DefaultI18nInitializer; + +public class myApplication { + + public static void main(String[] args){ + + setInitializer(new DefaultI18nInitializer("myApplication-i18n")); + init("fr","FR"); + + System.out.println(_("String to translate in my application")); + myLibrary.myMethod(); + } +} +------------------------------------------------------------------------------- + +* Configuration + + Do not forget to precise the classpath and main class in maven jar plugin. + +* Tutorial sources + + {{{../application-i18n.zip}Tutorial sources}} + Added: trunk/src/site/en/apt/bestPractices.apt =================================================================== --- trunk/src/site/en/apt/bestPractices.apt (rev 0) +++ trunk/src/site/en/apt/bestPractices.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,43 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + +Nuiton I18n Best Practices + +* Choose a pattern and follow it + + In an application or a library, you should choose a pattern for the i18n keys. + You can either choose to use keys like myapplication.key1 or sentences like + 'My application string'. Once you made your choice, stick to it to keep a + consistency in your application. Note that in an application, you can choose a + different pattern than the one used in the dependencies. + +* Always use DefaultI18nInitializer in final applications + + This is not an obligation, but as it makes you gain time at your application + initialisation, it is really advised to use DefaultI18nInitializer for all + your final applications. Added: trunk/src/site/en/apt/extendInitializer.apt =================================================================== --- trunk/src/site/en/apt/extendInitializer.apt (rev 0) +++ trunk/src/site/en/apt/extendInitializer.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,31 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + +Extend Initializer to suit exactly your needs + + TODO Added: trunk/src/site/en/apt/helloWorld.apt =================================================================== --- trunk/src/site/en/apt/helloWorld.apt (rev 0) +++ trunk/src/site/en/apt/helloWorld.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,114 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + +Nuiton I18n Hello World + + This first tutorial is aimed to show you how to use Nuiton I18n library the + easiest way. We will create a main method that will display th 'Hello World' + text, then we will translate this text in other languages. + + The corresponding java class looks like this : + +---------------------------------------------------------------------------- +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +class HelloWorld { + + public static void main (String[] args){ + System.out.println(_("Hello World")); + System.out.println(n_("Goodbye World")); + } +} +---------------------------------------------------------------------------- + + If you compile and launch this class (take care to put nuiton-i18n, + commons-logging and commons-beanutils jar files in classpath or it will not + work), you will get the following result : + +------------- +Hello World +Goodbye World +------------- + + Now we want to translate those strings. We will then create a resource file + named hellWorld_fr_FR.properties (we will translate the application in + french) that we will put in a i18n file and that will contain the translated + strings (Take care, in the key, all the special characters and spaces have to + be escaped by \ ). + +---------- +Hello\ World = Bonjour le monde +Goodbye\ World = Au revoir le monde +---------- + + We compile again and test the class (put the directory that contains i18n in + the classpath or Nuiton I18n will not find the properties file). Nothing has + changed, but this is normal, the system has not been initialised so it does + not know whiwh language to load. We will then modify our class adding the line + +---- +org.nuiton.i18n.I18n.init("fr","FR"); + +---- + + before the first call to Nuiton I18n library. This will tell Nuiton I18n which + language to use (in this case french). Nuiton I18n looks in the classpath + for all the files i18n/?????fr_FR and loads them. + + To test, you just need to compile and launch the application again, you should + obtain : + +---- +2 avr. 2010 16:13:29 org.nuiton.i18n.init.I18nInitializer resolvBundles +INFO: 1 bundle(s) found, in 1 file(s). +2 avr. 2010 16:13:29 org.nuiton.i18n.I18nStore init +INFO: 1 bundle(s) found, [1 file(s)]. +2 avr. 2010 16:13:29 org.nuiton.i18n.I18nStore addLanguage +INFO: I18nLanguage <locale: fr_FR, nbStences:2>, nbEntries: 1, nbSentences: 2. +Bonjour le monde +Goodbye World +---- + + This output can appear strange, but this is perfectly normal. The first lines + inform you how initialisation is happening. Those are logs comming from + Nuiton I18n. We can see the number of bundles found, in our case 1, and on the + language setting, the number of strings found, in our case 2. Then comes our + translated application. Yes, but the last line is not translated you can say. + But if you take the class we wrote, the string "Goodbye World" is put in + parameter of the n_() method (and not _()). The n_() method indicates a string + that is translated elsewhere on the application, but must not be translated + here. So it is replaced by the string not translated. + +Congratulations, you translated your first application with Nuiton I18n + +Tutorial sources + + This tutorial sources can be downloaded {{{../helloworld.zip}here}}. They are + packaged with the libraries needed for the compilation and execution of this + example. Added: trunk/src/site/en/apt/index.apt =================================================================== --- trunk/src/site/en/apt/index.apt (rev 0) +++ trunk/src/site/en/apt/index.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,59 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + + +Nuiton I18n + + Nuiton I18n project features Java classes for applications + internationalisation (i18n). + + This light library combine Java ResourceBundles, a powerful and easy to use + API and a really useful extension process. Lots of avantages comes with Nuiton + I18n use : + + - translation keys extraction + + - build process integration through Maven or Ant + + Here is a small example that shows Nuiton I18n usage simplicity : + +----------------------------------------------------------------------------- +I18n.init(Locale.FR); +System.out.println(I18n._("This text will be translated")); +----------------------------------------------------------------------------- + + Have a look to the tutorials to see how to enrich your application with Nuiton + I18n. + + The three Nuiton I18n project modules : + + - {{{./nuiton-i18n/index.html}I18n Api}} + + - {{{./maven-i18n-plugin/index.html}I18n Maven Plugin}} + + - {{{./ant-i18n-task/index.html}I18n Ant task}} Added: trunk/src/site/en/apt/library.apt =================================================================== --- trunk/src/site/en/apt/library.apt (rev 0) +++ trunk/src/site/en/apt/library.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,208 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + +Library using Nuiton I18n tutorial (using Maven) + +* Why a different tutorial for a library and a final application ? + + When you create a final application, at build time, we create a bundle + gathering all the strings of the application and its dependencies in order to + optimise the application loading (we can save several seconds this way). When + we create a library, no bundle is created, so the use and configuration of the + library is easier. + +* The tutorial + + In this tutorial, we will create a library with a unique class that will just + display a message. That is this message that will be translated. + +* Create the Maven project and configure the Nuiton I18n plugin + + We create a standard Maven project. In the pom.xml file, we will configure the + Maven Nuiton I18n plugin. + +------------------------------------------------------------------------------- +<plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>maven-i18n-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>parserJava</goal> + <goal>gen</goal> + </goals> + </execution> + </executions> +</plugin> +------------------------------------------------------------------------------- + + In the plugin configuration, we secify the goals to execute. The parserJava + goal extract all the strings to translate from the java code. The gen goal + get the resource file that contains the translated strings and add the + extracted strings that are not already present in it. You can then translate + the strings. + + In order to work, the plugin needs to have the Nuiton I18n liibrary in the + project dependencies. + +------------------------------------------------------------------------------- +<dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n-api</artifactId> + <version>1.2.1</version> + <scope>compile</scope> +</dependency> +------------------------------------------------------------------------------- + + We make static import in our code, so we need to configure the + maven-compiler-plugin + +------------------------------------------------------------------------------- +<plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.1</version> + <configuration> + <source>1.6</source> + <target>1.6</target> + <encoding>UTF-8</encoding> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + </configuration> +</plugin> +------------------------------------------------------------------------------- + + And in order to get the plugin and library Nuiton I18n, we have to add the + nuiton repositories. + +------------------------------------------------------------------------------- +<repositories> + + <!-- depot des releases nuiton --> + + <repository> + <id>nuiton.release</id> + <name>NuitonReleaseRepository</name> + <url>http://maven.nuiton.org/release</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + <releases> + <enabled>true</enabled> + <checksumPolicy>warn</checksumPolicy> + </releases> + </repository> + + <!-- depot des snapshots nuiton --> + + <repository> + <id>nuiton.snapshot</id> + <name>NuitonSnapshotRepository</name> + <url>http://maven.nuiton.org/snapshot</url> + <snapshots> + <enabled>true</enabled> + <checksumPolicy>fail</checksumPolicy> + </snapshots> + <releases> + <enabled>false</enabled> + </releases> + </repository> + +</repositories> + +<pluginRepositories> + + <!-- depot des releases nuiton --> + + <pluginRepository> + + <id>nuiton.release</id> + <name>NuitonReleaseRepository</name> + <url>http://maven.nuiton.org/release</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + <releases> + <enabled>true</enabled> + <checksumPolicy>warn</checksumPolicy> + </releases> + </pluginRepository> + + <!-- depot des snapshots nuiton --> + + <pluginRepository> + <id>nuiton.snapshot</id> + <name>NuitonSnapshotRepository</name> + <url>http://maven.nuiton.org/snapshot</url> + <snapshots> + <enabled>true</enabled> + <checksumPolicy>fail</checksumPolicy> + </snapshots> + <releases> + <enabled>false</enabled> + </releases> + </pluginRepository> + +</pluginRepositories> +------------------------------------------------------------------------------- + +* Crate our library + + Our library, to make it simple, will contain only one class and a static + method. + +------------------------------------------------------------------------------- +package org.myOrganisation.myLibrary; + +import static org.nuiton.i18n.I18n._; + +public class myLibrary { + + static public void myMethod(){ + System.out.println(_("My message to translate")); + } +} +------------------------------------------------------------------------------- + +* First build + + When you build your library for the first time with the command mvn compile, + you should see two new resource files containing each one a string to + translate without translation. + + You can now translate the string in both language, you will then have the + translation available for your next builds. + +* Second build + + If you build the library again, then integrate it in a final application using + I18n, the message will be displayed translated. + +* Tutorial sources + + {{{../library-i18n.zip}Tutorial sources}} Added: trunk/src/site/en/apt/presentation.apt =================================================================== --- trunk/src/site/en/apt/presentation.apt (rev 0) +++ trunk/src/site/en/apt/presentation.apt 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,56 @@ +~~~ +~~ #%L +~~ I18n +~~ ~~ +~~ $Author$ +~~ $LastChangedDate$ +~~ $LastChangedRevision$ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2008 - 2010 CodeLutin +~~ %% +~~ This program is free software: you can redistribute it and/or modify +~~ it under the terms of the GNU Lesser General Public License as +~~ published by the Free Software Foundation, either version 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +~~ GNU General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + +Presentation + + The Nuiton I18n library works quite simply. The string to translate are only + marked by the I18n._("String to translate") method. It is possible to mark + the strings that are not to be translated using the I18n.n_("String not to be + translated"). + + The library must be initialised on the application launch by a method + I18n.init() that can take into parameter a locale, a string describing the + language,... + + The string to translate have to be put in a properties file located in your + application's classpath, in a i18n file, and named as : xxx-fr_FR.properties + for example. + + On initialisation, the library looks in the classpath for all the translation + files corresponding to the defined language (in the i18n files of the + classpath to be clear) and loads all the translations corresponding to the + displayed language. Then, on display, each time a string is asked for, I18n + give back the string translated in the corresponding language. + + The Maven plugin allows to automatically look for non-translated strings in + the source code and create a bundle gathering all the strings and translations + of the applications and its dependencies. + + To understand how to well use the Nuiton I18n library, it is strongly advised + to follow the tutorials, and preferably following the order, as they are of + increasing complexity. Added: trunk/src/site/site_en.xml =================================================================== --- trunk/src/site/site_en.xml (rev 0) +++ trunk/src/site/site_en.xml 2010-04-13 15:34:33 UTC (rev 1746) @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="${project.url}/images/logos/maven-feather.png"/> + </poweredBy> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <links> + <item name="Libre-Entreprise" href="http://www.libre-entreprise.org/" /> + <item name="[fr" href="../index.html" /> + <item name="en]" href="index.html" /> + </links> + + <menu name="User"> + <item name="Home" href="index.html"/> + <item name="Presentation" href="presentation.html"/> + <item name="Best Practices" href="bestPractices.html"/> + </menu> + + <menu name="Tutorials"> + <item name="Hello World" href="helloWorld.html"/> + <item name="Library" href="library.html"/> + <item name="Final application" href="application.html"/> + </menu> + + <menu name="Developer"> + <item name="Extend Initializer" href="extendInitializer.html"/> + </menu> + + <menu ref="modules"/> + + <menu ref="reports"/> + </body> +</project> Modified: trunk/src/site/site_fr.xml =================================================================== --- trunk/src/site/site_fr.xml 2010-04-12 15:12:06 UTC (rev 1745) +++ trunk/src/site/site_fr.xml 2010-04-13 15:34:33 UTC (rev 1746) @@ -1,68 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - I18n - - $Author$ - $LastChangedDate$ - $LastChangedRevision$ - $Id$ - $HeadURL$ - %% - Copyright (C) 2008 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - <project name="${project.name}"> - <bannerLeft> - <name>${project.name}</name> - <href>index.html</href> - </bannerLeft> + <bannerLeft> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> - <poweredBy> - <logo href="http://maven.apache.org" name="Maven" - img="${project.url}/images/logos/maven-feather.png"/> - </poweredBy> + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="${project.url}/images/logos/maven-feather.png"/> + </poweredBy> - <body> + <body> - <breadcrumbs> - <item name="${project.name}" href="index.html"/> - </breadcrumbs> + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> - <menu name="Utilisateur"> - <item name="Accueil" href="index.html"/> - <item name="Présentation" href="presentation.html"/> - <item name="Best Practices" href="bestPractices.html"/> - </menu> + <links> + <item name="Libre-Entreprise" href="http://www.libre-entreprise.org/" /> + <item name="[fr" href="index.html" /> + <item name="en]" href="en/index.html" /> + </links> - <menu name="Tutoriaux"> - <item name="Hello World" href="helloWorld.html"/> - <item name="Librairie" href="library.html"/> - <item name="Application finale" href="application.html"/> - </menu> + <menu name="Utilisateur"> + <item name="Accueil" href="index.html"/> + <item name="Présentation" href="presentation.html"/> + <item name="Best Practices" href="bestPractices.html"/> + </menu> - <menu name="Développeur"> - <item name="Etendre Initializer" href="extendInitializer.html"/> - </menu> + <menu name="Tutoriaux"> + <item name="Hello World" href="helloWorld.html"/> + <item name="Librairie" href="library.html"/> + <item name="Application finale" href="application.html"/> + </menu> - <menu ref="modules"/> + <menu name="Développeur"> + <item name="Etendre Initializer" href="extendInitializer.html"/> + </menu> - <menu ref="reports"/> - </body> + <menu ref="modules"/> + + <menu ref="reports"/> + </body> </project>