Rico Translation

View this page in Japanese View this page in Japanese

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.

Translation Status

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:

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

Supporting Multiple Languages

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.


// Not required when using ricoLiveGridForms.php
// Must be placed after the line to include rico.js

require "chklang2.php";


' 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' />

RicoTranslate Object Reference

The RicoTranslate object contains the following properties and methods:

A 12 item array containing the translated names of each month (January is item 0)
A 7 item array containing the translated names of each day of the week (Sunday is item 0)
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)
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)
Contains the 2-character language code that is currently loaded (default is "en")
Contains the character to use as the thousands separator when formatting numbers (default is ",")
Contains the character to use as the decimal point when formatting numbers (default is ".")
Contains the default date format (default is "mm/dd/yyyy")
Contains the default time format (default is "hh:nn:ss a/pm")
addPhraseId (phraseId, phrase)
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.
getPhraseById (phraseId)
Returns the phrase specified by phraseId. Optional substitution parameters may follow phraseId.

Submitting Updates

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.