The Rico library contains a translation object (RicoTranslate) so that applications can be written using Rico that support multiple languages. The translation object also stores the default date and number formats, so that different defaults can be specified for each language. The Rico distribution includes language files that load the translation object with the phrases necessary to display the default grid menus and the Rico calendar.
Language files are stored in "src/translations/ricoLocale_xx.js" where xx is the 2-character language code. Rico is currently distributed with the following translations:
Language | Code | Status |
---|---|---|
English | en | Baseline |
French | fr | Complete and reviewed |
Spanish | es | Complete and reviewed |
Japanese | ja | Complete and reviewed |
Chinese (simplified) | zh | Complete and reviewed |
Korean | ko | Complete and reviewed |
German | de | Complete and reviewed |
Portugese | pt | Complete, needs review |
Italian | it | Complete, needs review |
Russian | ru | Complete and reviewed |
Ukranian | ua | Complete and reviewed |
As Rico evolves, additional phrases are required in the translation files. English phrases are added first, then members of the Rico community add the new phrases to the other translation files. We try to keep all of the translations synchonized, but this is not always possible. Therefore, when rico.js is loaded, it in turn loads the language file for English first. Then it looks for a Rico translation matching the user's OS or browser language. If one is found, it is loaded next. This ensures that, if a phrase is missing from a translation file or a translation for their language is not available, the user at least sees the phrase in English (instead of a blank message).
So with no additional coding, Rico should, in most cases, present localized menus and calendars that are appropriate to the user. However, all modern browsers give the user a way to override the OS language. For example, in Firefox you go to Tools menu > Options > Advanced > General Tab > Languages button. In Internet Explorer you go to Tools menu > Internet Options > General Tab > Languages button. This setting is called the accept language and is not directly accessible via javascript. However, Rico does provide a way to load a translation file based on the accept language. For users who have configured this setting, the language resolved using this approach may be closer to their true preference. The accept language is resolved in Rico by having the server-side script return the accept language header back to the javascript method "Rico.acceptLanguage()". This happens automatically when using the LiveGrid Forms plug-ins for ASP and PHP, and in the LiveGrid plug-in for .net. For other situations, server-side include files are provided in the Rico distribution.
In PHP:
<? // Not required when using ricoLiveGridForms.php // Must be placed after the line to include rico.js require "chklang2.php"; ?>
In ASP:
' Not required when using ricoLiveGridForms.asp ' Must be placed after the line to include rico.js <!-- #INCLUDE FILE = "chklang2.vbs" -->
In .net:
' Not required when using ricoLiveGrid.ascx ' Must be placed after the line to include rico.js <%@ Register TagPrefix="Rico" TagName="ChkLang" Src="chklang.ascx" %> <Rico:ChkLang runat='server' id='translation' />
The RicoTranslate object contains the following properties and methods:
Questions and corrections may be posted to the Open Discussion forum on SourceForge. Alternatively, you can send them directly to: dowdybrown at yahoo dot com.