I18n-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
March 2011
- 3 participants
- 7 discussions
Author: jcouteau
Date: 2011-03-24 15:37:51 +0100 (Thu, 24 Mar 2011)
New Revision: 1894
Url: http://nuiton.org/repositories/revision/i18n/1894
Log:
Add doc for GWT
Added:
trunk/src/site/apt/gwt.apt
trunk/src/site/en/apt/gwt.apt
Modified:
trunk/src/site/site_en.xml
trunk/src/site/site_fr.xml
Added: trunk/src/site/apt/gwt.apt
===================================================================
--- trunk/src/site/apt/gwt.apt (rev 0)
+++ trunk/src/site/apt/gwt.apt 2011-03-24 14:37:51 UTC (rev 1894)
@@ -0,0 +1,177 @@
+GWT UiBinder et i18n, vous avez dit un cauchemard ?
+
+* GWT avec nuiton-i18n (et Maven) et ça coule de source
+
+** Le fonctionnement classique de l'i18n dans GWT
+
+ Si vous avez des écrans que vous avez créé avec UiBinder et que vous souhaitez
+ les internationaliser, vous aller vous tourner vers la page ad-hoc de la
+ documentation de GWT
+ (http://code.google.com/intl/fr/webtoolkit/doc/latest/DevGuideUiBinderI18n.h…)
+ Dans cette documentation, on vous apprend que vous devez utiliser, pour
+ l'internationalisation, la syntaxe suivante :
+
+--------------------------------------------------------------------------------
+ <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
+ ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
+ ui:generateLocales="default">
+ <div><ui:msg description="Greeting">Hello, world.</ui:msg></div>
+ </ui:UiBinder>
+--------------------------------------------------------------------------------
+
+ Cela vous donnera un magnifique fichier de propriété qui ressemble à ça :
+
+--------------------------------------------------------------------------------
+ # Generated from my.app.HelloWorldMyBinderImplGenMessages
+ # for locale default
+ # Description: Greeting
+ 022A824F26735ED0582324BE34F3CAE1=Hello, world.
+--------------------------------------------------------------------------------
+
+ Ok, cool, mais ce beau fichier de propriété, vous le donnez à un traducteur,
+ il vous regarde avec des gros yeux, il claque la porte et vous le revoyez
+ jamais. D'autant plus que vous allez avoir un fichier de propriété par fichier
+ UiBinder. Oui oui, vous avez bien lu.
+
+ Bon admettons, on va chercher à améliorer ce fichier de propriétés alors.
+ Déjà, en changeant le générateur on arrive à avoir de beaux fichiers. Bien.
+ Mais on a toujours pleins de fichiers de propriétés, qui en plus sont générés
+ dans pleins d'endroits différents. Un beau cauchemard.
+
+ En cherchant un peu sur le net, on voit que si on met toutes nos chaines dans
+ un fichier LocalizableResources.properties, on n'a plus besoins de tous les
+ autres ficheirs de propriétés. On trouve un script python qui nous met tout ça
+ en un seul endroit mais vous vous voyez utiliser un script python a l'heure de
+ l'automatisation de toutes les taches répétitives. Un script python, alors que
+ vous faites du Java !
+
+ Si vous êtes arrivés jusqu'ici et que vous avez persévéré, vous voyez bien que
+ l'internationalisation en utilisant UiBinder est un cauchemard.
+
+** Le fonctionnement attendu
+
+ Bon, et si on se posait les bonnes questions. Qu'est ce que veulent toutes les
+ personnes impliquées dans la boucle ? Les développeurs ? Les traducteurs ?
+
+ Les développeurs, ils veulent surtout en écrire le moins possible. Répéter les
+ informations de génération en haut de chaque fichier c'est un peu répétitif
+ et, comment dire, pénible. Appliquer un script python c'est pas optimum, si on
+ pouvait faire ça avec un outil de gestion des builds (comme Maven) ça serait
+ bien quand même. Le développeur ne doit faire que coder, toutes les
+ manipulations de fichier doivent être laissées à l'outil de gestion de build.
+
+ Les traducteurs, ils veulent des fichiers facile à manipuler, au maximum un
+ fichier par langue. Il faut donc grouper les traductions de tous les fichiers.
+ Il ne faut aps aller chercher les nouvelles clés dans le code. Tout doit être
+ dans le fichier de propriété, seule la traduction doit être à la charge du
+ traducteur.
+
+ Donc en résumé, on veut que les chaînes soient extraites de façon automatisées
+ et placées dans un fichier de propriété unique (un par langue). Il faut que
+ l'on conserve les chaînes déjà traduites d'une version à l'autre. Il faut que
+ la configuration de la génération soit centralisée et que cette génération
+ soit gérée par l'outil de gestion de build.
+
+** Et comment on s'y prend ?
+
+ Le processus de build peut déjà être géré par Maven
+ (http://mojo.codehaus.org/gwt-maven-plugin/) on va donc se baser sur Maven,
+ d'autant plus que la librairie nuiton-i18n
+ (http://maven-site.nuiton.org/i18n/) fournit un plugin qui gère les clés de
+ traduction et leur extraction déjà très bien. On va donc se baser sur ces deux
+ outils.
+
+ On va considérer que vous avez réussi à compiler/lancer votre projet avec
+ Maven pour se consacrer à ce qui nous intéresse, la traduction de nos fichiers
+ UiBinder. On va donc utiliser nuiton-i18n et plus particulièrement le parser
+ xml avec nos propres règles.
+
+** Création de notre règle de parsing
+
+ Nuiton-i18n fournit un parser XML qui est très puissant et peut être configuré
+ par des règles externes. Nous allons donc créer une règle pour parser les
+ fichiers UiBinder de GWT. Notre règle s'appelera 'gwt.rules' et sera placée
+ dans notre répertoire *src/main/i18n*. Son contenu sera uniquement :
+
+--------------------------------------------------------------------------------
+//ui:msg/@key
+--------------------------------------------------------------------------------
+
+ La valeur est du jxpath indiquant que l'on recherche tous les attributs key
+ des éléments ui:msg. Jusque là, pas de soucis. Vous pourrez améliorer cette
+ règle si vous avez plus de champs à traduire, mais elle devrait suffire à la
+ plupart des cas.
+
+** Configuration du plugin
+
+ Nous allons configurer le plugin nuiton-i18n pour arriver à nos fins.
+
+ Dans une première exécution, nous allons lui dire de parser nos fichiers
+ UiBinder (*.ui.xml) situés dans notre dossier src/main/java en utilisant la
+ rule créée précédemment. Il ne faut pas oublier de préciser les namespace pour
+ que le plugin s'y retrouve dans les path.
+
+ Dans une deuxième execution, on génère les fichiers de propriété qui seront
+ situés dans src/main/resources/i18n.
+
+ Dans une dernière exécution, on génère le bundle. On précise le fichier et
+ répertoire de sortie, soit LocalizableResource (les langues et le .properties
+ sont ajoutés automatiquement) et WEB-INF/com/google/gwt/i18n/client dans le
+ répertoire de votre hostedWebapp (ici src/main/webapp).
+
+--------------------------------------------------------------------------------
+<plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scan-gwt-sources</id>
+ <goals>
+ <goal>parserXml</goal>
+ </goals>
+ <configuration>
+ <basedir>${project.basedir}/src/main/java</basedir>
+ <includes>**/*.ui.xml</includes>
+ <userRulesFiles>
+ <file>${basedir}/src/main/i18n/gwt.rules</file>
+ </userRulesFiles>
+ <namespaces>
+ <gwt>urn:import:com.google.gwt.user.client.ui</gwt>
+ <ui>urn:ui:com.google.gwt.uibinder</ui>
+ </namespaces>
+ </configuration>
+ </execution>
+ <execution>
+ <id>gen</id>
+ <goals>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>make-bundle</id>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ <configuration>
+ <generateDefinitionFile>false</generateDefinitionFile>
+ <addBundleOuputDirParent>false</addBundleOuputDirParent>
+ <bundleOutputPackage>com/google/gwt/i18n/client</bundleOutputPackage>
+ <bundleOutputName>LocalizableResource</bundleOutputName>
+ </configuration>
+ </execution>
+ </executions>
+</plugin>
+--------------------------------------------------------------------------------
+
+** Premier build
+
+ Lancez un premier build, vous allez avoir vos fichiers de propriétés vides qui
+ vont venir se placer dans votre répertoire src/main/resources/i18n.
+ Remplissez-les (pensez à bien échapper les caractères spéciaux en les
+ remplaçant par leur code unicode.
+
+** Second build, c'était compliqué ?
+
+ Lancez un deuxième build, lancez votre application. Vos langues sont
+ disponibles ? Bien... C'est toujours un cauchemard ?
Added: trunk/src/site/en/apt/gwt.apt
===================================================================
--- trunk/src/site/en/apt/gwt.apt (rev 0)
+++ trunk/src/site/en/apt/gwt.apt 2011-03-24 14:37:51 UTC (rev 1894)
@@ -0,0 +1,164 @@
+GWT UiBinder and i18n, you said nightmare ?
+
+* GWT with nuiton-i18n (and Maven) and it's easy
+
+** The way i18n works in GWT
+
+ If you got screens you made using UiBider and that you want to localize, you
+ will go to the ad-hoc page of the GWT documentation
+ (http://code.google.com/intl/fr/webtoolkit/doc/latest/DevGuideUiBinderI18n.h…)
+ In this documentation, you learn tha tyou must use, for localization, the
+ following syntax :
+
+--------------------------------------------------------------------------------
+ <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
+ ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
+ ui:generateLocales="default">
+ <div><ui:msg description="Greeting">Hello, world.</ui:msg></div>
+ </ui:UiBinder>
+--------------------------------------------------------------------------------
+
+ This will give you a nice property file that looks like that :
+
+--------------------------------------------------------------------------------
+ # Generated from my.app.HelloWorldMyBinderImplGenMessages
+ # for locale default
+ # Description: Greeting
+ 022A824F26735ED0582324BE34F3CAE1=Hello, world.
+--------------------------------------------------------------------------------
+
+ Nice, but this property file, if you give it to a translator, he will look at
+ you with big eyes, smash the door and you will never see him again. And you
+ will got a property file per UiBinder file. Yes you read well.
+
+ Let's admit that, try to improve the property file then. Changing the
+ generator, we succeed in getting nice files. Ok. But we still get lots of
+ property files, that are generated in different directories. A nightmare.
+
+ If you search on the net, we see that if we put all our translated strings in
+ a file called LocalizableResources.properties, we do not need all the other
+ files anymore. You can find a python script that puts everything in a single
+ place, but you see yourself using python script whereas all repetitive tasks
+ are automatized. A python script, but you are coding in Java !
+
+ So if you get there, you found out that localization in GWT when using
+ UiBinder can be quite a pain.
+
+** How we want it to work
+
+ So let's ask the right questions. What all people involved in the localization
+ process want ? Developers ? Translators ?
+
+ Developers want to write the minimum code. Repeat generation documentation on
+ top of each file can be quite repetitive and useless. Applying a python script
+ is not optimum, if we could process this with our build manager (like Maven or
+ Ant) that could be great. The developer must only have to code, all the files
+ manipulations must be left to the build manager.
+
+ The translators want files easy to deal with. And one file per language
+ maximum. We must gather the translation sof all files in one. The translator
+ should not have to search for translation keys in the code. Everything must be
+ in the property file, only translation must be done by the translator.
+
+ So to summarize, we want the strings to be extracted in an automatized way and
+ placed in a unique property file (one per language). We must keep the already
+ translated strings from a version to the other. And the generation
+ configuration must be centralised and the generation dealt with by the build
+ manager.
+
+** How we do that ?
+
+ The build process can already be managed by Maven
+ (http://mojo.codehaus.org/gwt-maven-plugin/) so we will be based on Maven,
+ and nuiton-i18n got a Maven plugin managing translation keys and extraction
+ quite well.
+
+ We will consider here that you can compile/run your GWT project with Maven to
+ go to the interesting part, the translation of UiBinder files. So we will use
+ the xml parser with our own rules.
+
+** Creating our own parsing rule
+
+ Nuiton-i18n got a XML parser that is quite powerful and can be configured with
+ external rules. So we will create a rule to parse GWT UiBinder files. Our rule
+ will be named gwt.rules and will be placed in *src/main/i18n* directory. It's
+ content will be :
+
+--------------------------------------------------------------------------------
+ //ui:msg/@key
+--------------------------------------------------------------------------------
+
+ The value is jxpath indicating that we look all the key attributes of the
+ ui:msg elements. So far no problem. You can update this rule if you got other
+ stuff to translate, but this should cover most of the cases.
+
+** Plugin configuration
+
+ We will configure the nuiton-i18n plugin to be able to do what we want.
+
+ In a first execution, we will tell him to parse our UiBinder files (*.ui.xml)
+ located in our src/main/java directory using the rule previously created.
+ Do not forget to indicate the namespaces so the plugin can deal with paths.
+
+ In a second execution, we generate the property files located in
+ src/main/resources/i18n.
+
+ The last execution generate the Bundle. We give the name of the file and its
+ package : LocalizableResource (language and .properties are added by the
+ plugin) and com/google/gwt/i18n/client.
+
+--------------------------------------------------------------------------------
+<plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scan-gwt-sources</id>
+ <goals>
+ <goal>parserXml</goal>
+ </goals>
+ <configuration>
+ <basedir>${project.basedir}/src/main/java</basedir>
+ <includes>**/*.ui.xml</includes>
+ <userRulesFiles>
+ <file>${basedir}/src/main/i18n/gwt.rules</file>
+ </userRulesFiles>
+ <namespaces>
+ <gwt>urn:import:com.google.gwt.user.client.ui</gwt>
+ <ui>urn:ui:com.google.gwt.uibinder</ui>
+ </namespaces>
+ </configuration>
+ </execution>
+ <execution>
+ <id>gen</id>
+ <goals>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>make-bundle</id>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ <configuration>
+ <generateDefinitionFile>false</generateDefinitionFile>
+ <addBundleOuputDirParent>false</addBundleOuputDirParent>
+ <bundleOutputPackage>com/google/gwt/i18n/client</bundleOutputPackage>
+ <bundleOutputName>LocalizableResource</bundleOutputName>
+ </configuration>
+ </execution>
+ </executions>
+</plugin>
+--------------------------------------------------------------------------------
+
+** First build
+
+ Launch a first build, your empty (not translated) property files will be
+ created and in your src/main/resources/i18n. Fill them (translate) (think
+ about escaping special caracters by replacing them with their unicode code).
+
+** Second build, said difficult ?
+
+ Launch a second build, launch your app. Your languages are available ? Ok...
+ still getting nightmares ?
Modified: trunk/src/site/site_en.xml
===================================================================
--- trunk/src/site/site_en.xml 2011-03-24 13:24:18 UTC (rev 1893)
+++ trunk/src/site/site_en.xml 2011-03-24 14:37:51 UTC (rev 1894)
@@ -57,6 +57,7 @@
<item name="Home" href="index.html"/>
<item name="Presentation" href="presentation.html"/>
<item name="Best Practices" href="bestPractices.html"/>
+ <item name="Use with GWT" href="gwt.html"/>
</menu>
<menu name="Tutorials">
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2011-03-24 13:24:18 UTC (rev 1893)
+++ trunk/src/site/site_fr.xml 2011-03-24 14:37:51 UTC (rev 1894)
@@ -57,6 +57,7 @@
<item name="Accueil" href="index.html"/>
<item name="Présentation" href="presentation.html"/>
<item name="Best Practices" href="bestPractices.html"/>
+ <item name="Utilisation avec GWT" href="gwt.html"/>
</menu>
<menu name="Tutoriaux">
1
0
Author: jcouteau
Date: 2011-03-24 14:24:18 +0100 (Thu, 24 Mar 2011)
New Revision: 1893
Url: http://nuiton.org/repositories/revision/i18n/1893
Log:
Update tutorials
Added:
trunk/src/site/apt/library.apt.vm
trunk/src/site/en/apt/library.apt.vm
trunk/src/site/resources/application-i18n.tar.gz
trunk/src/site/resources/helloworld.tar.gz
trunk/src/site/resources/library-i18n.tar.gz
Removed:
trunk/src/site/apt/library.apt
trunk/src/site/en/apt/library.apt
Modified:
trunk/src/site/apt/application.apt
trunk/src/site/apt/helloWorld.apt
trunk/src/site/en/apt/application.apt
trunk/src/site/en/apt/helloWorld.apt
trunk/src/site/resources/application-i18n.zip
trunk/src/site/resources/helloworld.zip
trunk/src/site/resources/library-i18n.zip
Modified: trunk/src/site/apt/application.apt
===================================================================
--- trunk/src/site/apt/application.apt 2011-03-24 12:15:20 UTC (rev 1892)
+++ trunk/src/site/apt/application.apt 2011-03-24 13:24:18 UTC (rev 1893)
@@ -80,5 +80,7 @@
* Sources du tutoriel
- {{{./application-i18n.zip}Sources du tutoriel}}
+ * {{{./application-i18n.zip}Sources du tutoriel (zip)}}
+ * {{{./application-i18n.tar.gz}Sources du tutoriel (tar.gz)}}
+
Modified: trunk/src/site/apt/helloWorld.apt
===================================================================
--- trunk/src/site/apt/helloWorld.apt 2011-03-24 12:15:20 UTC (rev 1892)
+++ trunk/src/site/apt/helloWorld.apt 2011-03-24 13:24:18 UTC (rev 1893)
@@ -71,14 +71,14 @@
la ligne
----
-org.nuiton.i18n.I18n.init(Locale.FRANCE);
+org.nuiton.i18n.I18n.init(null, Locale.FRANCE);
----
avant le premier appel à la librairie Nuiton I18n. Cela a pour effet de dire
- à Nuiton I18n quelle langue utiliser (en l'occurence le français). Il
- recherche donc dans le classpath tous les fichiers i18n/????fr_FR et les
- charge.
+ à Nuiton I18n quelle langue utiliser (en l'occurence le français). Comme nous
+ mettons l'initializer à null, il utilise celui par défaut. Il recherche donc
+ dans le classpath tous les fichiers i18n/????fr_FR et les charge.
Pour tester il suffit de recompiler et de relancer l'application, vous devriez
obtenir :
@@ -111,6 +111,6 @@
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.
+ {{{./helloworld.zip}ici (zip)}} ou {{{./helloworld.tar.gz}ici (tar.gz)}}.
+ Elles sont packagées avec les librairies nécessaires à la compilation et
+ l'exécution de cet exemple.
Deleted: trunk/src/site/apt/library.apt
===================================================================
--- trunk/src/site/apt/library.apt 2011-03-24 12:15:20 UTC (rev 1892)
+++ trunk/src/site/apt/library.apt 2011-03-24 13:24:18 UTC (rev 1893)
@@ -1,206 +0,0 @@
-~~~
-~~ #%L
-~~ I18n
-~~
-~~ $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%
-~~~
-Tutoriel de librairie utilisant Nuiton I18n (utilisation de Maven)
-
-* Pourquoi un tutoriel différent pour une librairie et pour une application
-finale ?
-
- Lorsque l'on crée une application finale, au moment du build, on crée un
- bundle regroupant les chaînes de l'application et de ses dépendances afin
- d'optimiser le chargement de l'application (on peut ainsi économiser jusqu'à
- plusieurs secondes au démarrage). Lorsque l'on crée une librairie, aucun
- bundle n'est réalisé, l'utilisation et la configuration de la librairie est
- donc plus simple.
-
-* Le tutoriel
-
- Dans ce tutoriel nous allons créer une librairie avec une classe unique qui va
- juste afficher un message. C'est ce message qui sera traduit.
-
-* Créons le projet Maven et configurons le plugin Nuiton I18n
-
- Créons un projet Maven standard. Dans le pom.xml, nous allons configurer le
- plugin Maven Nuiton I18n.
-
--------------------------------------------------------------------------------
-<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>
--------------------------------------------------------------------------------
-
- Dans la configuration du plugin, nous spécifions les goals à effectuer. Le
- goal parserJava extrait toutes les chaînes de charactère à traduire du code
- java. Le goal gen récupère le fichier de ressources contenant les chaînes déjà
- traduites et y ajoute les chaînes extraites par le goal parserJava qui ne sont
- pas déjà présentes. Vous pouvez ensuite traduire les chaînes.
-
- Afin que le plugin fonctionne, il ne faut pas oublier d'ajouter la librairie
- Nuiton I18n dans les dépendances.
-
--------------------------------------------------------------------------------
-<dependency>
- <groupId>org.nuiton.i18n</groupId>
- <artifactId>nuiton-i18n-api</artifactId>
- <version>1.2.1</version>
- <scope>compile</scope>
-</dependency>
--------------------------------------------------------------------------------
-
- Comme nous réalisons un import static, il faut configurer le plugin maven de
- compilation
-
--------------------------------------------------------------------------------
-<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>
--------------------------------------------------------------------------------
-
- Et pour récupérer le plugin et la librairie Nuiton I18n, il ne faut pas
- oublier d'ajouter les dépots nuiton.
-
--------------------------------------------------------------------------------
-<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>
--------------------------------------------------------------------------------
-
-* Créons notre librairie
-
- Notre librairie, pour faire simple, ne contiendra qu'une classe et une
- méthode statique
-
--------------------------------------------------------------------------------
-package org.myOrganisation.myLibrary;
-
-import static org.nuiton.i18n.I18n._;
-
-public class myLibrary {
-
- static public void myMethod(){
- System.out.println(_("My message to translate"));
- }
-}
--------------------------------------------------------------------------------
-
-* Premier build
-
- Lorsque vous buildez votre librairie pour la première fois avec la commande
- mvn compile, vous devez obtenir la création de deux nouveaux fichiers de
- ressource contenant chacun la chaîne à traduire sans traduction.
-
- Vous pouvez traduire la chaîne de charactère dans les deux langues, vous aurez
- alors la traduction disponibles dans vos prochains builds.
-
-* Second build
-
- Si vous buildez de nouveau la librairie, puis l'intégrez dans une application
- finale utilisant Nuiton I18n, le message sera affiché traduit.
-
-* Sources du tutoriel
-
- {{{./library-i18n.zip}Sources du tutoriel}}
Copied: trunk/src/site/apt/library.apt.vm (from rev 1892, trunk/src/site/apt/library.apt)
===================================================================
--- trunk/src/site/apt/library.apt.vm (rev 0)
+++ trunk/src/site/apt/library.apt.vm 2011-03-24 13:24:18 UTC (rev 1893)
@@ -0,0 +1,208 @@
+~~~
+~~ #%L
+~~ I18n
+~~
+~~ $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%
+~~~
+Tutoriel de librairie utilisant Nuiton I18n (utilisation de Maven)
+
+* Pourquoi un tutoriel différent pour une librairie et pour une application
+finale ?
+
+ Lorsque l'on crée une application finale, au moment du build, on crée un
+ bundle regroupant les chaînes de l'application et de ses dépendances afin
+ d'optimiser le chargement de l'application (on peut ainsi économiser jusqu'à
+ plusieurs secondes au démarrage). Lorsque l'on crée une librairie, aucun
+ bundle n'est réalisé, l'utilisation et la configuration de la librairie est
+ donc plus simple.
+
+* Le tutoriel
+
+ Dans ce tutoriel nous allons créer une librairie avec une classe unique qui va
+ juste afficher un message. C'est ce message qui sera traduit.
+
+* Créons le projet Maven et configurons le plugin Nuiton I18n
+
+ Créons un projet Maven standard. Dans le pom.xml, nous allons configurer le
+ plugin Maven Nuiton I18n.
+
+-------------------------------------------------------------------------------
+<plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <version>${projet.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ </executions>
+</plugin>
+-------------------------------------------------------------------------------
+
+ Dans la configuration du plugin, nous spécifions les goals à effectuer. Le
+ goal parserJava extrait toutes les chaînes de charactère à traduire du code
+ java. Le goal gen récupère le fichier de ressources contenant les chaînes déjà
+ traduites et y ajoute les chaînes extraites par le goal parserJava qui ne sont
+ pas déjà présentes. Vous pouvez ensuite traduire les chaînes.
+
+ Afin que le plugin fonctionne, il ne faut pas oublier d'ajouter la librairie
+ Nuiton I18n dans les dépendances.
+
+-------------------------------------------------------------------------------
+<dependency>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>nuiton-i18n-api</artifactId>
+ <version>${projet.version}</version>
+ <scope>compile</scope>
+</dependency>
+-------------------------------------------------------------------------------
+
+ Comme nous réalisons un import static, il faut configurer le plugin maven de
+ compilation
+
+-------------------------------------------------------------------------------
+<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>
+-------------------------------------------------------------------------------
+
+ Et pour récupérer le plugin et la librairie Nuiton I18n, il ne faut pas
+ oublier d'ajouter les dépots nuiton.
+
+-------------------------------------------------------------------------------
+<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>
+-------------------------------------------------------------------------------
+
+* Créons notre librairie
+
+ Notre librairie, pour faire simple, ne contiendra qu'une classe et une
+ méthode statique
+
+-------------------------------------------------------------------------------
+package org.myOrganisation.myLibrary;
+
+import static org.nuiton.i18n.I18n._;
+
+public class myLibrary {
+
+ static public void myMethod(){
+ System.out.println(_("My message to translate"));
+ }
+}
+-------------------------------------------------------------------------------
+
+* Premier build
+
+ Lorsque vous buildez votre librairie pour la première fois avec la commande
+ mvn compile, vous devez obtenir la création de deux nouveaux fichiers de
+ ressource contenant chacun la chaîne à traduire sans traduction.
+
+ Vous pouvez traduire la chaîne de charactère dans les deux langues, vous aurez
+ alors la traduction disponibles dans vos prochains builds.
+
+* Second build
+
+ Si vous buildez de nouveau la librairie, puis l'intégrez dans une application
+ finale utilisant Nuiton I18n, le message sera affiché traduit.
+
+* Sources du tutoriel
+
+ * {{{./library-i18n.zip}Sources du tutoriel (zip)}}
+
+ * {{{./library-i18n.tar.gz}Sources du tutoriel (tar.gz)}}
Property changes on: trunk/src/site/apt/library.apt.vm
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/src/site/en/apt/application.apt
===================================================================
--- trunk/src/site/en/apt/application.apt 2011-03-24 12:15:20 UTC (rev 1892)
+++ trunk/src/site/en/apt/application.apt 2011-03-24 13:24:18 UTC (rev 1893)
@@ -77,5 +77,7 @@
* Tutorial sources
- {{{../application-i18n.zip}Tutorial sources}}
+ * {{{../application-i18n.zip}Tutorial sources (zip}}
+ * {{{../application-i18n.tar.gz}Tutorial sources (tar.gz}}
+
Modified: trunk/src/site/en/apt/helloWorld.apt
===================================================================
--- trunk/src/site/en/apt/helloWorld.apt 2011-03-24 12:15:20 UTC (rev 1892)
+++ trunk/src/site/en/apt/helloWorld.apt 2011-03-24 13:24:18 UTC (rev 1893)
@@ -69,13 +69,14 @@
not know whiwh language to load. We will then modify our class adding the line
----
-org.nuiton.i18n.I18n.init(Locale.FRANCE);
+org.nuiton.i18n.I18n.init(null, Locale.FRANCE);
----
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.
+ language to use (in this case french). We put null to the initializer, like
+ that 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 :
@@ -105,6 +106,6 @@
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.
+ This tutorial sources can be downloaded {{{../helloworld.zip}here (zip)}} or
+ {{{../helloworld.tar.gz}here (tar.gz)}}. They are packaged with the libraries
+ needed for the compilation and execution of this example.
Deleted: trunk/src/site/en/apt/library.apt
===================================================================
--- trunk/src/site/en/apt/library.apt 2011-03-24 12:15:20 UTC (rev 1892)
+++ trunk/src/site/en/apt/library.apt 2011-03-24 13:24:18 UTC (rev 1893)
@@ -1,204 +0,0 @@
-~~~
-~~ #%L
-~~ I18n
-~~
-~~ $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}}
Copied: trunk/src/site/en/apt/library.apt.vm (from rev 1892, trunk/src/site/en/apt/library.apt)
===================================================================
--- trunk/src/site/en/apt/library.apt.vm (rev 0)
+++ trunk/src/site/en/apt/library.apt.vm 2011-03-24 13:24:18 UTC (rev 1893)
@@ -0,0 +1,206 @@
+~~~
+~~ #%L
+~~ I18n
+~~
+~~ $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>${project.version}</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>${project.version}</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 (zip)}}
+
+ * {{{../library-i18n.tar.gz}Tutorial sources (tar.gz)}}
Property changes on: trunk/src/site/en/apt/library.apt.vm
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/src/site/resources/application-i18n.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/application-i18n.tar.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/site/resources/application-i18n.zip
===================================================================
(Binary files differ)
Added: trunk/src/site/resources/helloworld.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/helloworld.tar.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/site/resources/helloworld.zip
===================================================================
(Binary files differ)
Added: trunk/src/site/resources/library-i18n.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/library-i18n.tar.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/site/resources/library-i18n.zip
===================================================================
(Binary files differ)
1
0
r1892 - in trunk: . ant-i18n-task maven-i18n-plugin nuiton-i18n
by hudson@users.nuiton.org 24 Mar '11
by hudson@users.nuiton.org 24 Mar '11
24 Mar '11
Author: hudson
Date: 2011-03-24 13:15:20 +0100 (Thu, 24 Mar 2011)
New Revision: 1892
Url: http://nuiton.org/repositories/revision/i18n/1892
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/ant-i18n-task/pom.xml
trunk/maven-i18n-plugin/pom.xml
trunk/nuiton-i18n/pom.xml
trunk/pom.xml
Modified: trunk/ant-i18n-task/pom.xml
===================================================================
--- trunk/ant-i18n-task/pom.xml 2011-03-24 12:15:19 UTC (rev 1891)
+++ trunk/ant-i18n-task/pom.xml 2011-03-24 12:15:20 UTC (rev 1892)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/maven-i18n-plugin/pom.xml
===================================================================
--- trunk/maven-i18n-plugin/pom.xml 2011-03-24 12:15:19 UTC (rev 1891)
+++ trunk/maven-i18n-plugin/pom.xml 2011-03-24 12:15:20 UTC (rev 1892)
@@ -33,7 +33,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/nuiton-i18n/pom.xml
===================================================================
--- trunk/nuiton-i18n/pom.xml 2011-03-24 12:15:19 UTC (rev 1891)
+++ trunk/nuiton-i18n/pom.xml 2011-03-24 12:15:20 UTC (rev 1892)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-24 12:15:19 UTC (rev 1891)
+++ trunk/pom.xml 2011-03-24 12:15:20 UTC (rev 1892)
@@ -37,7 +37,7 @@
</parent>
<artifactId>i18n</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<modules>
<module>nuiton-i18n</module>
@@ -200,11 +200,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/i18n/tags/i18n-2.3.2</connection>
+ <connection>scm:svn:http://svn.nuiton.org/svn/i18n/trunk</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/i18n/tags/i18n-2.3.2
+ scm:svn:http://svn.nuiton.org/svn/i18n/trunk
</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/i18n/tags/i18n-2.3.2</url>
+ <url>http://www.nuiton.org/repositories/browse/i18n/trunk</url>
</scm>
<profiles>
1
0
Author: hudson
Date: 2011-03-24 13:15:19 +0100 (Thu, 24 Mar 2011)
New Revision: 1891
Url: http://nuiton.org/repositories/revision/i18n/1891
Log:
[maven-release-plugin] copy for tag i18n-2.3.2
Added:
tags/i18n-2.3.2/
1
0
r1890 - in trunk: . ant-i18n-task maven-i18n-plugin nuiton-i18n
by hudson@users.nuiton.org 24 Mar '11
by hudson@users.nuiton.org 24 Mar '11
24 Mar '11
Author: hudson
Date: 2011-03-24 13:15:18 +0100 (Thu, 24 Mar 2011)
New Revision: 1890
Url: http://nuiton.org/repositories/revision/i18n/1890
Log:
[maven-release-plugin] prepare release i18n-2.3.2
Modified:
trunk/ant-i18n-task/pom.xml
trunk/maven-i18n-plugin/pom.xml
trunk/nuiton-i18n/pom.xml
trunk/pom.xml
Modified: trunk/ant-i18n-task/pom.xml
===================================================================
--- trunk/ant-i18n-task/pom.xml 2011-03-21 20:28:14 UTC (rev 1889)
+++ trunk/ant-i18n-task/pom.xml 2011-03-24 12:15:18 UTC (rev 1890)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.2</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/maven-i18n-plugin/pom.xml
===================================================================
--- trunk/maven-i18n-plugin/pom.xml 2011-03-21 20:28:14 UTC (rev 1889)
+++ trunk/maven-i18n-plugin/pom.xml 2011-03-24 12:15:18 UTC (rev 1890)
@@ -33,7 +33,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.2</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/nuiton-i18n/pom.xml
===================================================================
--- trunk/nuiton-i18n/pom.xml 2011-03-21 20:28:14 UTC (rev 1889)
+++ trunk/nuiton-i18n/pom.xml 2011-03-24 12:15:18 UTC (rev 1890)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.2</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-21 20:28:14 UTC (rev 1889)
+++ trunk/pom.xml 2011-03-24 12:15:18 UTC (rev 1890)
@@ -37,7 +37,7 @@
</parent>
<artifactId>i18n</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.2</version>
<modules>
<module>nuiton-i18n</module>
@@ -200,11 +200,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/i18n/trunk</connection>
+ <connection>scm:svn:http://svn.nuiton.org/svn/i18n/tags/i18n-2.3.2</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/i18n/trunk
+ scm:svn:http://svn.nuiton.org/svn/i18n/tags/i18n-2.3.2
</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/i18n/trunk</url>
+ <url>http://www.nuiton.org/repositories/browse/i18n/tags/i18n-2.3.2</url>
</scm>
<profiles>
1
0
r1889 - trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle
by tchemit@users.nuiton.org 21 Mar '11
by tchemit@users.nuiton.org 21 Mar '11
21 Mar '11
Author: tchemit
Date: 2011-03-21 21:28:14 +0100 (Mon, 21 Mar 2011)
New Revision: 1889
Url: http://nuiton.org/repositories/revision/i18n/1889
Log:
Evolution #1402: Add bundleOutputPackage parameter to specify package of generated bundle folder
Modified:
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java 2011-03-12 14:20:53 UTC (rev 1888)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java 2011-03-21 20:28:14 UTC (rev 1889)
@@ -25,6 +25,7 @@
package org.nuiton.i18n.plugin.bundle;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.plugin.MojoFailureException;
import java.io.File;
@@ -43,15 +44,38 @@
public abstract class AbstractMakeI18nBundleMojo extends AbstractI18nBundleMojo {
/**
- * Directory where to generate aggregated bundles.
+ * Root directory where to generate aggregated bundles (this directory will
+ * be added as resources of the project).
*
- * @parameter expression="${i18n.bundleOutputDir}" default-value="${basedir}/target/generated-sources/resources/META-INF"
+ * @parameter expression="${i18n.bundleOutputDir}" default-value="${basedir}/target/generated-sources/resources"
* @required
* @since 1.0.0
*/
protected File bundleOutputDir;
+
/**
+ * Package name of the generate aggregated bundles.
+ * <p/>
+ * <strong>Note:</strong> By default we use the <code>META-INF</code> package
+ * since it is the favorite package of <code>I18n</code> runtime initializer.
+ * <p/>
+ * The package name is dotted as it will be stored as folder like in Java
+ * language.
+ * <p/>
+ * Example :
+ * <pre>
+ * package name : foo.bar
+ * directory : foo/bar
+ * </pre>
+ *
+ * @parameter expression="${i18n.bundleOutputPackage}" default-value="META-INF"
+ * @required
+ * @since 2.3.2
+ */
+ protected String bundleOutputPackage;
+
+ /**
* Name of the bundle to generate.
*
* @parameter expression="${i18n.bundleOutputName}" default-value="${project.artifactId}-i18n"
@@ -104,6 +128,14 @@
/** to keep all none translated i18n keys by locale. */
protected Map<Locale, SortedSet<String>> unsafeMapping;
+ /**
+ * The definitive directory where to generate the bundles (includes the
+ * package of bunlde).
+ *
+ * @since 2.3.2
+ */
+ protected File outputFolder;
+
@Override
public void init() throws Exception {
super.init();
@@ -118,7 +150,15 @@
unsafeMapping = null;
}
- createDirectoryIfNecessary(bundleOutputDir);
+ // get the definitive folder where to generate bundles (including
+ // bundle package)
+
+ outputFolder = getBundleOutputFolder();
+
+ if (isVerbose()) {
+ getLog().info("Will generates bundles in " + outputFolder);
+ }
+ createDirectoryIfNecessary(outputFolder);
}
protected void failsIfWarning() throws MojoFailureException {
@@ -165,13 +205,13 @@
*/
protected void generateDefaultBundle() throws IOException {
- File bundleFirstLocale = getBundleFile(bundleOutputDir,
+ File bundleFirstLocale = getBundleFile(outputFolder,
bundleOutputName,
locales[0],
false
);
- File bundleWithoutLocale = getBundleFile(bundleOutputDir,
+ File bundleWithoutLocale = getBundleFile(outputFolder,
bundleOutputName,
null,
false
@@ -184,4 +224,15 @@
FileUtils.copyFile(bundleFirstLocale, bundleWithoutLocale);
}
+ protected File getBundleOutputFolder() {
+ File result = bundleOutputDir;
+ if (StringUtils.isNotEmpty(bundleOutputPackage)) {
+ String[] paths = bundleOutputPackage.split("\\.");
+ for (String path : paths) {
+ result = new File(result, path);
+ }
+ }
+ return result;
+ }
+
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java 2011-03-12 14:20:53 UTC (rev 1888)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java 2011-03-21 20:28:14 UTC (rev 1889)
@@ -25,8 +25,6 @@
package org.nuiton.i18n.plugin.bundle;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.nuiton.i18n.bundle.I18nBundleEntry;
import org.nuiton.i18n.bundle.I18nBundleUtil;
import org.nuiton.i18n.init.DefaultI18nInitializer;
@@ -70,21 +68,6 @@
public class BundleMojo extends AbstractMakeI18nBundleMojo {
/**
- * A flag to use the parent of directory {@link #bundleOutputDir}
- * as directory to add in build ressources.
- * <p/>
- * If the flag is not activated, the, we use directly the given
- * {@link #bundleOutputDir} directory.
- * <p/>
- * <b>Note :</b> By default we use the parent directory, since this is more
- * natural, only special cases should desactivate this parameter.
- *
- * @parameter expression="${i18n.addBundleOuputDirParent}" default-value="true"
- * @since 2.0
- */
- protected boolean addBundleOuputDirParent;
-
- /**
* A flag to generate the i18n definition file.
* <p/>
* This file contains all generated bundles and the paths of all i18n
@@ -99,15 +82,9 @@
public void init() throws Exception {
super.init();
- // ajout de repertoire de generation (le parent en fait)
- // dans les resources du projet
-
- File ressourceDir = bundleOutputDir;
-
- if (addBundleOuputDirParent) {
- ressourceDir = ressourceDir.getParentFile();
- }
- addResourceDir(ressourceDir, "**/*.properties");
+ // add root bundle directory as resources of the project
+
+ addResourceDir(bundleOutputDir, "**/*.properties");
}
@Override
@@ -118,10 +95,11 @@
version = PluginHelper.removeSnapshotSuffix(version);
if (!silent) {
- getLog().info("config - bundle name : " + bundleOutputName);
- getLog().info("config - basedir : " + bundleOutputDir);
- getLog().info("config - locales : " + Arrays.toString(locales));
- getLog().info("config - version : " + version);
+ getLog().info("config - resources dir : " + bundleOutputDir);
+ getLog().info("config - package name : " + bundleOutputPackage);
+ getLog().info("config - bundle name : " + bundleOutputName);
+ getLog().info("config - locales : " + Arrays.toString(locales));
+ getLog().info("config - version : " + version);
}
Map<Locale, String> bundleDico =
@@ -131,7 +109,7 @@
long t0 = System.nanoTime();
- File bundleOut = getI18nFile(bundleOutputDir,
+ File bundleOut = getI18nFile(outputFolder,
bundleOutputName,
locale,
false
@@ -227,7 +205,7 @@
// charger
String f = String.format(DefaultI18nInitializer.UNIQUE_BUNDLE_DEF,
bundleOutputName);
- File defOut = new File(bundleOutputDir, f);
+ File defOut = new File(outputFolder, f);
if (!silent) {
getLog().info("prepare i18n definition file in " +
defOut.getAbsolutePath());
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java 2011-03-12 14:20:53 UTC (rev 1888)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java 2011-03-21 20:28:14 UTC (rev 1889)
@@ -73,7 +73,7 @@
long t0 = System.nanoTime();
File bundleOut = getBundleFile(
- bundleOutputDir,
+ outputFolder,
bundleOutputName,
locale,
false
1
0
Author: tchemit
Date: 2011-03-12 15:20:53 +0100 (Sat, 12 Mar 2011)
New Revision: 1888
Url: http://nuiton.org/repositories/revision/i18n/1888
Log:
Update mavenpom4redmineAndCentral to 2.5.2.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-02-24 14:53:25 UTC (rev 1887)
+++ trunk/pom.xml 2011-03-12 14:20:53 UTC (rev 1888)
@@ -33,7 +33,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>2.5.1</version>
+ <version>2.5.2</version>
</parent>
<artifactId>i18n</artifactId>
1
0