From: Bruno Haible Date: Sun, 29 Mar 2020 19:03:50 +0000 (+0200) Subject: doc: Don't recommend to use the reserved identifier '_' in Java. X-Git-Tag: v0.21~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e89fea36545f27487d9652a13e6a0adbea1117d0;p=thirdparty%2Fgettext.git doc: Don't recommend to use the reserved identifier '_' in Java. Reported by Akim Demaille . * gettext-tools/doc/gettext.texi (Java): Use i18n instead _ as magic identifier. --- diff --git a/gettext-tools/doc/gettext.texi b/gettext-tools/doc/gettext.texi index 5d8af7677..6479786f5 100644 --- a/gettext-tools/doc/gettext.texi +++ b/gettext-tools/doc/gettext.texi @@ -10342,7 +10342,7 @@ default-jdk "abc", """text block""" @item gettext shorthand -_("abc") +i18n("abc") @item gettext/ngettext functions @code{GettextResource.gettext}, @code{GettextResource.ngettext}, @@ -10364,7 +10364,7 @@ automatic ---, uses a Java specific message catalog format @item Extractor -@code{xgettext -k_} +@code{xgettext -ki18n} @item Formatting with positions @code{MessageFormat.format "@{1,number@} @{0,number@}"} @@ -10456,7 +10456,7 @@ holding the @code{ResourceBundle} instance and the shorthand: @smallexample private static ResourceBundle myResources = ResourceBundle.getBundle("domain-name"); -public static String _(String s) @{ +public static String i18n(String s) @{ return myResources.getString(s); @} @end smallexample @@ -10464,14 +10464,14 @@ public static String _(String s) @{ All classes containing internationalized strings then contain @smallexample -import static Util._; +import static Util.i18n; @end smallexample @noindent and the shorthand is used like this: @smallexample -System.out.println(_("Operation completed.")); +System.out.println(i18n("Operation completed.")); @end smallexample @item @@ -10487,14 +10487,14 @@ All classes containing internationalized strings then contain @smallexample private static ResourceBundle res = Util.myResources; -private static String _(String s) @{ return res.getString(s); @} +private static String i18n(String s) @{ return res.getString(s); @} @end smallexample @noindent and the shorthand is used like this: @smallexample -System.out.println(_("Operation completed.")); +System.out.println(i18n("Operation completed.")); @end smallexample @item @@ -10505,7 +10505,7 @@ definition of the resource bundle and of the shorthand: public class S @{ public static ResourceBundle myResources = ResourceBundle.getBundle("domain-name"); - public static String _(String s) @{ + public static String i18n(String s) @{ return myResources.getString(s); @} @} @@ -10515,7 +10515,7 @@ public class S @{ and the shorthand is used like this: @smallexample -System.out.println(S._("Operation completed.")); +System.out.println(S.i18n("Operation completed.")); @end smallexample @end itemize