3198d99fbda81d4236e9a4843ad4a18a8b28c67f
[infodrom/rico3] / documentation / translations.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
5 <title>Rico Translation</title>
6 <link href="ricoDocs.css" rel="Stylesheet" type="text/css">
7 </head>
8
9 <body>
10 <h1>Rico Translation</h1>
11
12 <p><a href='translations_ja.html'><img src='images/japanese.gif' alt='View this page in Japanese'></a>
13 <a href='translations_ja.html'>View this page in Japanese</a></p>
14
15 <p>The Rico library contains a translation object (RicoTranslate) so that
16 applications can be written using Rico that support multiple languages.
17 The translation object also stores the default date and number
18 formats, so that different defaults can be specified for each language.
19 The Rico distribution includes language files that load the translation object
20 with the phrases necessary to display the default grid menus and the Rico calendar.
21
22 <h2>Translation Status</h2>
23
24 <p>Language files are stored in
25 "src/translations/ricoLocale_xx.js" where xx is the 2-character language code. 
26 Rico is currently distributed with the following translations:
27
28 <p><table border='1' cellspacing='0' cellpadding='3'>
29 <thead>
30 <tr><th>Language</th><th>Code</th><th>Status</th></tr>
31 </thead>
32 <tbody>
33
34 <tr>
35 <td>English</td>
36 <td>en</td>
37 <td>Baseline</td>
38 </tr>
39
40 <tr>
41 <td>French</td>
42 <td>fr</td>
43 <td>Complete and reviewed</td>
44 </tr>
45
46 <tr>
47 <td>Spanish</td>
48 <td>es</td>
49 <td>Complete and reviewed</td>
50 </tr>
51
52 <tr>
53 <td>Japanese</td>
54 <td>ja</td>
55 <td>Complete and reviewed</td>
56 </tr>
57
58 <tr>
59 <td>Chinese (simplified)</td>
60 <td>zh</td>
61 <td>Complete and reviewed</td>
62 </tr>
63
64 <tr>
65 <td>Korean</td>
66 <td>ko</td>
67 <td>Complete and reviewed</td>
68 </tr>
69
70 <tr>
71 <td>German</td>
72 <td>de</td>
73 <td>Complete and reviewed</td>
74 </tr>
75
76 <tr>
77 <td>Portugese</td>
78 <td>pt</td>
79 <td>Complete, needs review</td>
80 </tr>
81
82 <tr>
83 <td>Italian</td>
84 <td>it</td>
85 <td>Complete, needs review</td>
86 </tr>
87
88 <tr>
89 <td>Russian</td>
90 <td>ru</td>
91 <td>Complete and reviewed</td>
92 </tr>
93
94 <tr>
95 <td>Ukranian</td>
96 <td>ua</td>
97 <td>Complete and reviewed</td>
98 </tr>
99
100 </tbody>
101 </table>
102
103 <h2>Supporting Multiple Languages</h2>
104
105 <p>As Rico evolves, additional phrases are required in the translation files.
106 English phrases are added first, then members of the Rico community
107 add the new phrases to the other translation files.
108 We try to keep all of the translations synchonized, 
109 but this is not always possible.
110 Therefore, when rico.js is loaded, it in turn loads the language file 
111 for English first. 
112 Then it looks for a Rico translation matching the user's OS or browser language.
113 If one is found, it is loaded next.
114 This ensures that, if a phrase is missing from a translation file or a translation
115 for their language is not available, the user at least
116 sees the phrase in English (instead of a blank message).
117
118 <p>So with no additional coding, Rico should, in most cases, 
119 present localized menus and calendars that are appropriate to the user.
120 However, all modern browsers give the user a way to override the OS language.
121 For example, in Firefox you go to Tools menu > Options > Advanced > General Tab > Languages button.
122 In Internet Explorer you go to Tools menu > Internet Options > General Tab > Languages button.
123 This setting is called the 
124 <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4">accept language</a> 
125 and is not directly accessible via javascript.
126 However, Rico does provide a way to load a translation file based on the accept language.
127 For users who have configured this setting, the language resolved using this approach
128 may be closer to their true preference.
129 The accept language is resolved in Rico by having the server-side script return the
130 accept language header back to the javascript method "Rico.acceptLanguage()".
131 This happens automatically when using the LiveGrid Forms plug-ins for ASP and PHP,
132 and in the LiveGrid plug-in for .net.
133 For other situations, server-side include files are provided in the Rico distribution.
134
135 <p>In PHP:
136 <pre>
137 &lt;? 
138 // Not required when using ricoLiveGridForms.php
139 // Must be placed after the line to include rico.js
140
141 require "chklang2.php";
142 ?&gt;
143 </pre>
144
145 <p>In ASP:
146 <pre>
147 ' Not required when using ricoLiveGridForms.asp
148 ' Must be placed after the line to include rico.js
149
150 &lt;!-- #INCLUDE FILE = "chklang2.vbs" --&gt;
151 </pre>
152
153 <p>In .net:
154 <pre>
155 ' Not required when using ricoLiveGrid.ascx
156 ' Must be placed after the line to include rico.js
157
158 &lt;%@ Register TagPrefix="Rico" TagName="ChkLang" Src="chklang.ascx" %&gt;
159 &lt;Rico:ChkLang runat='server' id='translation' /&gt;
160 </pre>
161
162 <h2>RicoTranslate Object Reference</h2>
163
164 <p>The RicoTranslate object contains the following properties and methods:
165 <dl>
166 <dt>monthNames[]
167 <dd>A 12 item array containing the translated names of each month (January is item 0)
168 <dt>dayNames[]
169 <dd>A 7 item array containing the translated names of each day of the week (Sunday is item 0)
170 <dt>monthAbbr()
171 <dd>A function that takes a month number (0-11) and returns the abbreviated month name (defaults to the first 3 characters of monthNames[], but is overridden by some translations)
172 <dt>dayAbbr()
173 <dd>A function that takes a day of week number (0-6) and returns the abbreviated day name (defaults to the first 3 characters of dayNames[], but is overridden by some translations)
174 <dt>langCode
175 <dd>Contains the 2-character language code that is currently loaded (default is "en")
176 <dt>thouSep
177 <dd>Contains the character to use as the thousands separator when formatting numbers (default is ",")
178 <dt>decPoint
179 <dd>Contains the character to use as the decimal point when formatting numbers (default is ".")
180 <dt>dateFmt
181 <dd>Contains the default date format (default is "mm/dd/yyyy")
182 <dt>timeFmt
183 <dd>Contains the default time format (default is "hh:nn:ss a/pm")
184 <dt>addPhraseId (phraseId, phrase)
185 <dd>Adds the specified phrase and assigns it to phraseId. The phrase string may contain references to optional substitution parameters, which are specified using $1, $2, etc.
186 <dt>getPhraseById (phraseId)
187 <dd>Returns the phrase specified by phraseId. Optional substitution parameters may follow phraseId.
188 </dl>
189
190 <h2>Submitting Updates</h2>
191
192 <p>Questions and corrections may be posted to the 
193 <a href='http://sourceforge.net/forum/forum.php?forum_id=470997'>Open Discussion forum on SourceForge</a>.
194 Alternatively, you can send them directly to: dowdybrown at yahoo dot com.
195
196 </body>
197 </html>