1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<HTML>
<BODY>
<STYLE type="text/css">
.keyword {
font-weight: bold;
color: darkred;
}
.string {
color: blue;
}
.code {
font-family: Courier, "Free Mono";
margin-left: 40px;
}
SMALL {
color: darkgray;
}
</STYLE>
<H2>FreeCol internationalisation</H2>
<P>This package contains the FreeCol support for internationalisation
(translation).
<P>The {@link net.sf.freecol.client.gui.i18n.Messages} class provides the API to
the translations. Client code might include:
<P class=code>
<FONT class=keyword>new </FONT>AbstractAction( Messages.message(<FONT class=string>"cancel"</FONT>) )
</P>
..whereupon the Messages class will look for a file called:
<P class=code>
FreeColMessages<FONT color=green>[_la<FONT color=blue>[_CO]</FONT>]</FONT>.properties
</P>
..where <TT>_la</TT> and <TT>_CO</TT> are the language and country codes from the locale. The
most specific file will be loaded. With a US locale, <TT>Messages</TT> will
look for <TT>FreeColMessages_en_US.properties</TT> first, then
<TT>FreeColMessages_en.properties</TT> and finally
<TT>FreeColMessages.properties</TT> if neither of the other two are found.
<P><TT>FreeColMessages.properties</TT> contains a line like this:
<P class=code>
cancel=Cancel
</P>
..while <TT>FreeColMessages_hu.properties</TT> has a corresponding line:
<P class=code>
cancel=Mégse
</P>
<H2>MessageMerge</H2>
<P>Only <TT>FreeColMessages.properties</TT> is updated as new messages are added
so a tool is required for translators to keep their translations up to date when
new messages are added.
<P>At the console, type:
<P class=code>
ant compile-test<BR>
java -cp src/classes net.sf.freecol.client.gui.i18n.MessageMerge <FONT color=red>src/net/sf/freecol/client/gui/i18n/FreeColMessages.properties</FONT> src/net/sf/freecol/client/gui/i18n/FreeColMessages_hu.properties
</P>
..where the red message file is the one to merge from (typically the one shown
above) and the black message file is the one to merge to.
<P><TABLE><TR><TD><IMG src="http://www.zen9658.zen.co.uk/MessageMerge.png" alt="MessageMerge screen" align=left style="margin-right:20px;">
<P>The screen shot shows "players" and "gameState" messages have been added. Select
the added messages from the left and press the [insert in right] button.
<P>To remove obselete or over-zealously inserted messages, select a range from
the right and press the [delete from right] button.
<P>Press the [save right] button to write the changes to the message file shown
on the right hand side. Doing so will destroy your translation file without
warning so ensure that the file on the right-hand side is committed to CVS
before pressing the button or you risk losing your work.
</TD></TR></TABLE>
<CENTER><SMALL>
$Revision: 1185 $ $Date: 2006-01-05 19:19:51 +1030 (Thu, 05 Jan 2006) $
</SMALL></CENTER>
</BODY>
</HTML>
|