Child pages
  • i18n

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getAvailableTimeZoneIDs()
Get the list of available time zones.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getCountries()
Gets the list of countries available for localization
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getCurrentCountry()
Gets the current country; based on the current locale settings in the Servoy Client Locale preferences.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getCurrentLanguage()
Gets the current language; based on the current locale settings in the Servoy Client Locale preferences.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getCurrentTimeZone()
Gets the current time zone of the client; based on the current locale settings in the Servoy Client Locale preferences.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDefaultDateFormat()
Gets the current default date format; based on the current locale settings in the Servoy Client Locale preferences.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDefaultNumberFormat()
Gets the current default number format; based on the current locale settings in the Servoy Client Locale preferences.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getI18NMessage(i18nKey)
Gets the real message (for the clients locale) for a specified message key.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getI18NMessage(i18nKey, dynamicValues)
Gets the real message (for the clients locale) for a specified message key.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
#getLanguages()
Returns a dataset with rows that contains a language key (en) and the displayname (English) column.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
#getSystemMessages()
Returns a dataset with rows that contains 3 columns: 'key' (i18n key), 'reference' (reference text for that key) and 'locale ([CURRENT_LOCALE])' (where [CURRENT_LOCALE] is the current language) - with the system messages of servoy.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getTimeZoneOffset(timezone, [date])
Returns the offset (in milliseconds) of this time zone from UTC for the current date or at the specified date.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getTimeZones()
Returns an array of known timezones.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setI18NMessage(i18nKey, value)
Sets the value of i18n key for client scope,if value null the setting is removed.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setI18NMessagesFilter(columnName, value)
Call this if you want to add a filter for a column (created by you) in the i18n table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setI18NMessagesFilter(columnName, value)
Call this if you want to add a filter for a column (created by you) in the i18n table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setLocale(language, country)
Set/Overwrite the locale for this client.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setTimeZone()
Sets the current time zone of the client.

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idgetAvailableTimeZoneIDs
classnode
Table Row (tr)
idname
Table Cell (td)
getAvailableTimeZoneIDs
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getAvailableTimeZoneIDs
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Get the list of available time zones.
Table Row (tr)
idret
Table Cell (td)
Returns
String[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Get the list of available time zones 
var timezones = i18n.getAvailableTimeZoneIDs();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetCountries
classnode
Table Row (tr)
idname
Table Cell (td)
getCountries
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getCountries
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the list of countries available for localization
Table Row (tr)
idret
Table Cell (td)
Returns
String[] – a String array containing the available countries.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
i18n.getCountries()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetCurrentCountry
classnode
Table Row (tr)
idname
Table Cell (td)
getCurrentCountry
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getCurrentCountry
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Gets the current country; based on the current locale settings in the Servoy Client Locale preferences.

NOTE: For more information on i18n, see the chapter on Internationalization (i18n) in the Servoy Developer User's Guide, beginning with the Introduction to i18n

Table Row (tr)
idret
Table Cell (td)
Returns
String – a String representing the current country.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var currCountry = i18n.getCurrentCountry();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetCurrentLanguage
classnode
Table Row (tr)
idname
Table Cell (td)
getCurrentLanguage
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getCurrentLanguage
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Gets the current language; based on the current locale settings in the Servoy Client Locale preferences.

NOTE: For more information on i18n, see the chapter on Internationalization (i18n) in the Servoy Developer User's Guide, beginning with the Introduction to i18n

Table Row (tr)
idret
Table Cell (td)
Returns
String – a String representing the current language.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var currLang = i18n.getCurrentLanguage();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetCurrentTimeZone
classnode
Table Row (tr)
idname
Table Cell (td)
getCurrentTimeZone
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getCurrentTimeZone
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the current time zone of the client; based on the current locale settings in the Servoy Client Locale preferences. For Servoy Web Clients the time zone is given by the browser (if it is possible to obtain it).
Table Row (tr)
idret
Table Cell (td)
Returns
String – a String representing the current time zone.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var currTimeZone = i18n.getCurrentTimeZone();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDefaultDateFormat
classnode
Table Row (tr)
idname
Table Cell (td)
getDefaultDateFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getDefaultDateFormat
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the current default date format; based on the current locale settings in the Servoy Client Locale preferences.
Table Row (tr)
idret
Table Cell (td)
Returns
String – a String representing the default date format.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var defaultDateFormat = i18n.getDefaultDateFormat();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDefaultNumberFormat
classnode
Table Row (tr)
idname
Table Cell (td)
getDefaultNumberFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getDefaultNumberFormat
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the current default number format; based on the current locale settings in the Servoy Client Locale preferences.
Table Row (tr)
idret
Table Cell (td)
Returns
String – a String representing the default number format.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var defaultNumberFormat = i18n.getDefaultNumberFormat();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetI18NMessage-String
classnode
Table Row (tr)
idname
Table Cell (td)
getI18NMessage
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getI18NMessage
Span
stylefloat: left;
idiets
(i18nKey)
Table Row (tr)
iddes
Table Cell (td)
Gets the real message (for the clients locale) for a specified message key.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} i18nKey – The message key
Table Row (tr)
idret
Table Cell (td)
Returns
String – a String that is the message for the message key.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// returns 'Welcome my_name in my solution'
// if the key 'mykey.username.text' is 'Welcome {0} in my solution'
i18n.getI18NMessage('mykey.username.text',new Array('my_name'))
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetI18NMessage-String_
classnode
Table Row (tr)
idname
Table Cell (td)
getI18NMessage
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getI18NMessage
Span
stylefloat: left;
idiets
(i18nKey, dynamicValues)
Table Row (tr)
iddes
Table Cell (td)
Gets the real message (for the clients locale) for a specified message key.
You can use parameter substitution by using {n}, where n is a index number of the value thats in the arguments array.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} i18nKey – The message key
{Object[]} dynamicValues – Arguments array when using parameter substitution.
Table Row (tr)
idret
Table Cell (td)
Returns
String – a String that is the message for the message key.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// returns 'Welcome my_name in my solution'
// if the key 'mykey.username.text' is 'Welcome {0} in my solution'
i18n.getI18NMessage('mykey.username.text',new Array('my_name'))
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetLanguages
classnode
Table Row (tr)
idname
Table Cell (td)
getLanguages
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
getLanguages
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Returns a dataset with rows that contains a language key (en) and the displayname (English) column.

See http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt for a list that could be returned.

Table Row (tr)
idret
Table Cell (td)
Returns
JSDataSet – a JSDataSet with all the languages.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var set = i18n.getLanguages();
for(var i=1;i<=set.getMaxRowIndex();i++)
{
	application.output(set.getValue(i, 1) + " " + set.getValue(i, 2));
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSystemMessages
classnode
Table Row (tr)
idname
Table Cell (td)
getSystemMessages
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
getSystemMessages
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns a dataset with rows that contains 3 columns: 'key' (i18n key), 'reference' (reference text for that key) and 'locale ([CURRENT_LOCALE])' (where [CURRENT_LOCALE] is the current language) - with the system messages of servoy.
This means all servoy messages, with all available translations.
Table Row (tr)
idret
Table Cell (td)
Returns
JSDataSet – a JSDataSet with all the system messages.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var set = i18n.getSystemMessages();
for(var i=1;i<=set.getMaxRowIndex();i++)
{
	application.output(set.getValue(i, 1) + " " + set.getValue(i, 2)+ " " + set.getValue(i, 3));
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTimeZoneOffset
classnode
Table Row (tr)
idname
Table Cell (td)
getTimeZoneOffset
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getTimeZoneOffset
Span
stylefloat: left;
idiets
(timezone, [date])
Table Row (tr)
iddes
Table Cell (td)
Returns the offset (in milliseconds) of this time zone from UTC for the current date or at the specified date.
Table Row (tr)
idprs
Table Cell (td)
Parameters
timezone – The time zone to get the offset for.
[date] – The date in the time zone (default current date). Needed in case daylight saving time/GMT offset changes are used in the time zone.
Table Row (tr)
idret
Table Cell (td)
Returns
Number – an int representing the time zone's offset from UTC.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var timeZoneOffset = i18n.getTimeZoneOffset('America/Los_Angeles');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTimeZones
classnode
Table Row (tr)
idname
Table Cell (td)
getTimeZones
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getTimeZones
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an array of known timezones.
Table Row (tr)
idret
Table Cell (td)
Returns
String[] – an Array with all the timezones.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var timeZones = i18n.getTimeZones();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetI18NMessage
classnode
Table Row (tr)
idname
Table Cell (td)
setI18NMessage
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setI18NMessage
Span
stylefloat: left;
idiets
(i18nKey, value)
Table Row (tr)
iddes
Table Cell (td)
Sets the value of i18n key for client scope,if value null the setting is removed.
All forms not yet loaded will change (execute this in solution startup or first form)
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} i18nKey – The message key
{String} value – They value for the message key.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//sets the value of i18n key for client scope; if value null the setting is removed
//Warning: already created form elements with i18n text lookup will not change,
//so call this method in the solution startup method or in methods from first form
//this method saves message for current locale, so if locale is changed with setLocale, all messages set from scripting will be lost

i18n.setI18NMessage('mykey.username.text','my_name')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetI18NMessagesFilter-String_String
classnode
Table Row (tr)
idname
Table Cell (td)
setI18NMessagesFilter
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setI18NMessagesFilter
Span
stylefloat: left;
idiets
(columnName, value)
Table Row (tr)
iddes
Table Cell (td)
Call this if you want to add a filter for a column (created by you) in the i18n table.
So that you can have multiple default values and multiple values per locale for one key.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} columnName – The column name that is the filter column in the i18n table.
{String} value – The filter value.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// Puts i18n in filter mode - this allows you to have multiple default/per locale
// values for one key and to use one of them based on the filter parameters.
// Let's say you added a new column "message_variant" to your i18n table.
// Now you can have keys that will translate to a language differently depending on the used variant
// For example you have 2 rows in you table for key X, language EN, different values and different "message_variant" (let's say 1 and 2)
// If you want the solution to use the first variant, you will have to call:
i18n.setI18NMessagesFilter('message_variant', '1')

// Using filter fall back : if there is no key for 'message_variant' with value '1', it will
// search for value '2'
var filterValue = new Array();
filterValue[0] = '1';
filterValue[1] = '2';
i18n.setI18NMessagesFilter('message_variant', filterValue)

// ATTENTION: if you use setI18NMessagesFilter(...) it is not recommended to use the i18n Dialog (especially before the filter is applied through JS).
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetI18NMessagesFilter-String_
classnode
Table Row (tr)
idname
Table Cell (td)
setI18NMessagesFilter
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setI18NMessagesFilter
Span
stylefloat: left;
idiets
(columnName, value)
Table Row (tr)
iddes
Table Cell (td)
Call this if you want to add a filter for a column (created by you) in the i18n table.
So that you can have multiple default values and multiple values per locale for one key.
You can use filter fall back by setting the filter value as an array of strings.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} columnName – The column name that is the filter column in the i18n table.
{String[]} value – The filter value.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// Puts i18n in filter mode - this allows you to have multiple default/per locale
// values for one key and to use one of them based on the filter parameters.
// Let's say you added a new column "message_variant" to your i18n table.
// Now you can have keys that will translate to a language differently depending on the used variant
// For example you have 2 rows in you table for key X, language EN, different values and different "message_variant" (let's say 1 and 2)
// If you want the solution to use the first variant, you will have to call:
i18n.setI18NMessagesFilter('message_variant', '1')

// Using filter fall back : if there is no key for 'message_variant' with value '1', it will
// search for value '2'
var filterValue = new Array();
filterValue[0] = '1';
filterValue[1] = '2';
i18n.setI18NMessagesFilter('message_variant', filterValue)

// ATTENTION: if you use setI18NMessagesFilter(...) it is not recommended to use the i18n Dialog (especially before the filter is applied through JS).
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetLocale
classnode
Table Row (tr)
idname
Table Cell (td)
setLocale
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setLocale
Span
stylefloat: left;
idiets
(language, country)
Table Row (tr)
iddes
Table Cell (td)

Set/Overwrite the locale for this client.
All forms not yet loaded will change (execute this in solution startup or first form).

The language must be a lowercase 2 letter code defined by ISO-649.
see http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
The country must be an upper case 2 letter code defined by IS-3166
see http://www.chemie.fu\-berlin.de/diverse/doc/ISO\_3166.html

NOTE: For more information on i18n, see the chapter on Internationalization (i18n) in the Servoy Developer User's Guide, beginning with the Introduction to i18n

Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} language – The lowercase 2 letter code
{String} country – The upper case 2 letter code.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Warning: already created form elements with i18n text lookup will not change,
//so call this method in the solution startup method or in methods from first form

i18n.setLocale('en','US');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetTimeZone
classnode
Table Row (tr)
idname
Table Cell (td)
setTimeZone
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setTimeZone
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Sets the current time zone of the client.
The parameter should be a string having the format which can be retrieved via i18n.getAvailableTimeZones or
can be seen in the SmartClient Edit -> Preferences -> Locale at the "Default Timezone" combobox.
For instance the time zone for Netherlands is set using the ID "Europe/Amsterdam".
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// This will set the default time zone to Central European Time
i18n.setTimeZone("Europe/Amsterdam");
Table Row (tr)
classlastDetailRow
Table Cell (td)