Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To answer your question I would chose (2).</p> <p>In practice I found that for me it is a lot easier to use something else rather than the Java resource bundles.</p> <p>I personally use a different way of handling this. I use the gettext way (there is a file there called GetTextResource.java that you must use in your application to benefit from the gettext extensions - see <a href="http://google.com/codesearch/p?hl=en#p9nGS4eQGUI/gnu/gettext/gettext-0.14.6.tar.gz|jPzy56HzMrQ/gettext-0.14.6/gettext-runtime/intl-java/gnu/gettext/GettextResource.java&amp;q=GetTextResource.java" rel="nofollow noreferrer">here</a>).</p> <p><strong>If</strong> you're familiar with gettext you will definitely find this approach a lot easier and practical. You simply give to your translators the po files (which can be edited with <a href="http://www.poedit.net/" rel="nofollow noreferrer">poedit</a>). From the po files you create the java class you will use inside your application (this is done using msgfmt - specifying parameters for java compilation of the po files). Po files can be updated fairly easy using the xgettext command (from command line).</p> <p>Of course everything is inside the <a href="http://www.gnu.org/software/gettext/manual/gettext.html" rel="nofollow noreferrer">gettext manual</a>.</p> <p>Advantages:</p> <ul> <li><p>gettext offers you a way to select the plural form [ No more messages like: "N file(s) deleted" (where N is a number) - see <a href="http://www.gnu.org/software/gettext/manual/gettext.html#ngettext-Invocation" rel="nofollow noreferrer">ngettext</a>.</p></li> <li><p>a scriptable method for translating strings once your java files are updated with new tokens</p></li> <li><p>no need to access each string using some macros (like Translate(DELETE_BUTTON_MACRO) ). You just write your code like this:</p> <pre><code>package translateutil; import gnu.gettext.GettextResource; import java.util.ResourceBundle; import java.util.Locale; public class TranslateUtil { private static ResourceBundle myResources =null; public static boolean init(Locale loc, String resourceName) { boolean bRet = true; Locale.setDefault(loc); try { myResources = ResourceBundle.getBundle(resourceName); System.out.printf( _("Current language: %s\n"), Locale.getDefault().getDisplayName() ); System.out.printf( _("%s resource found\n"), myResources.getClass().getName() ); } catch(Exception e) { // let the application go on in English in case the ResourceBundle // was not found. Notify about the error bRet = false; System.out.println( e.toString() ); myResources = null; } return bRet; } public static String _(String str) { if (myResources == null) { return str; } { return GettextResource.gettext(myResources, str); } } public static String _Plural(String singular, String plural, long param) { if (myResources == null) { if (param == 1) { return singular; } else { return plural; } } else { return GettextResource.ngettext(myResources, singular, plural, param); } } } </code></pre></li> </ul> <p>Here is a sample</p> <pre><code> // example // similar for plural import static translateutil.TranslateUtil._; System.out.println(_("The english text")); </code></pre> <p>No matter what you choice is: Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload