From: darolmar Date: Fri, 13 Sep 2013 11:44:01 +0000 (+0200) Subject: i18n how to X-Git-Tag: Jalview_2_9~200^2~17^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=464b8a14300e7064a74d77168c997b8fbd6770ab;p=jalview.git i18n how to --- diff --git a/doc/i18n.html b/doc/i18n.html new file mode 100644 index 0000000..80ce2d0 --- /dev/null +++ b/doc/i18n.html @@ -0,0 +1,47 @@ + + + + Jalview i18n + +

Best practices

+
    +
  1. Follow the standards described in this guide
  2. +
  3. Always use properties files for user interface text; never include displayable text in code
  4. +
  5. Use properties files only for user interface text (Messages_xx.properties) and config files for configuration settings (jalview.properties).
  6. +
  7. Use a proper naming schema for keys in your resource bundles. The name of the keys should provide some information about the context of the displayed text. This helps the translators during the translation process.
  8. +
  9. Group keys by view, ie. edit.title, edit.instructions, list.title, list.instructions, create.title, etc
  10. +
  11. Never use displayable text when executing comparisons within the logic of the tool (separate codified values from displayable text)
  12. +
  13. Always use the MessageManager class for retrieving properties values, and invoke MessageManager methods dynamically, to accommodate dynamic user preferences (see MessageManager below).
  14. +
  15. All numbers and dates should be formatted specific to the user's locale (e.g. java.text.NumberFormat and java.text.DateFormat)
  16. +
  17. Test code in more than one language
  18. +
+

MessageManager

+

The jalview.util.MessageManager class is a wrapper class for the ResourceBundle class. It provides dynamic language/locale support for individual users, and is recommended for all JalView code.

+

To use it within your code, you only have to invoke MessageManager with the text key in Messages_xx.properties:

+

JButton ok = new JButton(MessageManager.getString("button.ok"));

+

This will set JButton text to the one included at button.ok key. In English JButton text will be OK, while in Spanish will be Aceptar. This is the big thing of i18n. :)

+

How to translate JalView

+

Anyone interested in localizing/translating JalView is strongly encouraged to join the Jalview Development List list. We would recommend that you read this entire page before proceeding.

+

If you are planning on working on a JalView translation, please send us an email (Jalview Development List). There may be someone else already working on translating JalView to your target language.

+

Once you have downloaded the source code (available at http://www.jalview.org/download), you must edit {jalview.home}/resources/lang/Messages_xx.properties, where xx refers to your language country code. If it doesn't exits, rename Messages.properties to Messages_xx.properties.

+

Next step...start transtalation!

+

Once you have it translated, we would appreciate if you contribute it forwarding the file to Jalview Development List. We will commit it to the code base as soon as possible. Thanks so much for this in advance!

+ + +