Author: tchemit Date: 2011-05-11 17:46:17 +0200 (Wed, 11 May 2011) New Revision: 1924 Url: http://nuiton.org/repositories/revision/i18n/1924 Log: update docs Modified: trunk/src/site/apt/index.apt trunk/src/site/en/apt/index.apt Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2011-05-11 15:46:11 UTC (rev 1923) +++ trunk/src/site/apt/index.apt 2011-05-11 15:46:17 UTC (rev 1924) @@ -53,26 +53,47 @@ Quoi de neuf dans la version 2.4 - La version 2.4 gère désormais les fichiers properties en UTF-8 par défaut. - Il est cependant possible de modifier cet encoding dans le plugin et via - le {{{./nuiton-i18n/apidocs/org/nuiton/i18n/init/I18nInitializer.html}I18nInitializer}} - pour l'api runtime. +* Meilleure utilisation des encodings - Il est aussi possible d'utiliser un autre formattage que celui de <String.format> - en utilisant l'interface {{{./nuiton-i18n/apidocs/org/nuiton/i18n/I18nFormatter.html}I18nFormatter}}. - Le plugin maven permet d'appliquer une conversion si différents formattages - sont utilisés en utilisant le paramètre <<bundleFormatConverter>> du goal <<bundle>>. - Ce converter implante le contrat {{{./nuiton-i18n/apidocs/org/nuiton/i18n/plugin/bundle/BundleFormatConverter.html}BundleFormatConverter}}. + Depuis la JDK 1.6, il est possible de charger et écrire des fichiers de + propriétés en spécifiant son propre encoding, il n'y a donc plus de raison de + rester sur un encoding ISO-8859-1 ou US/ASCII. + I18n a intégré ces changements, et il devient donc désormais raisonnable + d'utiliser comme encoding par défaut <UTF-8>. Cet encoding par défaut peut + toujours être modifié à différents niveaux : + + - lors de la génération des fichiers i18n (via le plugin i18n) + - lors de l'initialisation de I18n au runtime via l'initializer ({{{./nuiton-i18n/apidocs/org/nuiton/i18n/init/I18nInitializer.html}I18nInitializer}}). + +* Gestion d'autre formats pour les traductions + + Par défaut, I18n utilise un <String.format> et sa syntaxe pour les traductions. + + Cependant, on peut vouloir utiliser le plugin i18n sans utiliser le runtime + I18n et utiliser à la place un système de traduction basé notamment sur + <MessageFormat> (comme le fait struts2 ou GWT par exemple). + + La version 2.4 permet d'utiliser désormais de changer de syntaxe et ceci + à différents niveaux : + + - au niveau de la génération d'un bundle via le paramètre <<bundleFormatConverter>> du goal <<bundle>> + - au niveau du runtime en spécifiant à l'initializer le bon messageFormatter à utiliser. + (voir l'interface {{{./nuiton-i18n/apidocs/org/nuiton/i18n/I18nMessageFormatter.html}I18nMessageFormatter}}). + + A noter qu'au runtime, les syntaxes de traductions ne peuvents pas être + changées et utiliser un formatter qui ne correspond pas à la syntaxe des + traductions ne fonctionnera pas correctement. + Quoi de neuf dans la version 2.3 La version 2.3 améliore de façon considérable les temps de détection des clefs - i18n pour les fichiers java (mojo <<parserJava>>). + i18n pour les fichiers java (mojo <<parserJava>>). - Voir {{{http://nuiton.org/issues/show/1275}Evolution #1275: Improve parserJava performance}}. + Voir {{{http://nuiton.org/issues/show/1275}Evolution #1275: Improve parserJava performance}}. - On passe à des temps très raisonnable (en dessous de 5 millisecondes par - fichier!) comme montré ci-dessous : + On passe à des temps très raisonnable (en dessous de 5 millisecondes par + fichier!) comme montré ci-dessous : -------------------------------------------------------------------------------- mvn package -Pnotests -Di18n.strictMode -DnuitonI18nVersion=2.2 Modified: trunk/src/site/en/apt/index.apt =================================================================== --- trunk/src/site/en/apt/index.apt 2011-05-11 15:46:11 UTC (rev 1923) +++ trunk/src/site/en/apt/index.apt 2011-05-11 15:46:17 UTC (rev 1924) @@ -53,18 +53,38 @@ What's new in 2.4 version - The 2.4 version manage properties file with UTF-8 encoding by default. - It's also possible to change this encoding with maven plugin and with - {{{./nuiton-i18n/apidocs/org/nuiton/i18n/init/I18nInitializer.html}I18nInitializer}} - for runtime api. +* Better usage of encodings - A new formatter {{{./nuiton-i18n/apidocs/org/nuiton/i18n/I18nFormatter.html}I18nFormatter}} - is available to allow different implementation than <String.format> (default one). - The maven plugin also allow to apply a conversion if different format are used - when using <<bundle>> goal, you can set the <<bundleFormatConverter>> parameter. - This converter implements the interface - {{{./nuiton-i18n/apidocs/org/nuiton/i18n/plugin/bundle/BundleFormatConverter.html}BundleFormatConverter}}. + Since JDK 1.6, it is possible to load and store properties files using a + given encoding, there is then no more reason to stay on a hardcoded encoding + such as <ISO-8859-1> or <US/ASCII>. + I18n integrates this changes and now it is more serious to use as default + encoding <<UTF-8>>. + + This encoding can be changed at two places: + + - while generating files (by the i18n plugin) + - at the runtime initialization of I18n class via the initializer ({{{./nuiton-i18n/apidocs/org/nuiton/i18n/init/I18nInitializer.html}I18nInitializer}}). + +* Deal other syntax formats for translations + + By default, I18n use the <String.format> syntax for translations. + + By sometimes, we would like to use the i18n plugin to manage translations and + their bundles, but use a different i18n runtime system base on <MessageFormat> + (like does struts2 or GWT). + + Version 2.4 allows now to change the syntax of translations at differents places: + + - at generation time of the bundle using parameter <<bundleFormatConverter>> of <<bundle>> mojo. + - at runtime time, by giving to the i18n initializer the correct messageFormatter to use. + (see contract {{{./nuiton-i18n/apidocs/org/nuiton/i18n/I18nMessageFormatter.html}I18nMessageFormatter}}). + + Note that at runtime time translations can not be swapped froma syntax to + another one, using a different syntax from the one used by translations will + not work properly. + What's new in 2.3 version Version 2.3 improves a lot performance on detection of java file i18n keys
participants (1)
-
tchemit@users.nuiton.org