Namespace Locale
Provides translations, currency conversion and other internationalization methods.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
Locale.country
The current country.
|
<static> |
Locale.lang
The current language.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Locale.formatCurrency(value, options)
Format a number as a given currency.
|
<static> |
Locale.getAllLanguages()
Get a list of the long names of all the languages supported by Salsa's
translation system.
|
<static> |
Locale.getEventListing(options)
Returns a list of event objects in the given parameters.
|
<static> |
Locale.getLanguages()
Get a list of the long names of all the language available to this
organization or chapter.
|
<static> |
Locale.getRegionalListing(zip, options)
|
<static> |
Locale.getState(code)
Returns a state name for the given state code.
|
<static> |
Locale.getTranslation(obj, field)
Translate a field from the given object into the current language
|
Field Detail
<static>
Locale.country
The current country.
<static>
Locale.lang
The current language.
Method Detail
<static>
{String}
Locale.formatCurrency(value, options)
Format a number as a given currency. If none of the optional parameters are passed, the
number will be formatted as dollars, i.e 33.5 will be formatted as $33.50
<? var amount = 13.5; print(salsa.formatCurrency(amount)); // $13.50 print(salsa.formatCurrency(amount, { symbol: '£'})); // £13.50 print(salsa.formatCurrency(amount, { symbol: 'F', separator: ', ', decimals: 2, symbol_after: true })); // 13,50 F ?>
- Parameters:
- {Number} value
- Value to be formatted as a currency.
- {Object} options Optional
- An Object of optional parameters. Possible options are:
- {String} symbol Optional
- Currency symbol to be used. Defaults to "$".
- {String} separator Optional
- Decimal separator. Defaults to ".".
- {String} decimals Optional
- The number of decimal places to round to. Defaults to 2.
- {bool} symbol_after Optional
- Boolean value indicating whether the currency symbol should be placed after the numeric part. Defaults to false.
- {String} limit Optional
- A String describing the limit and(optional) offset of the number of rows to retrieve in the form "offset, limit" such as "50, 100"
options {...}
- Returns:
- A new formatted
String
<static>
Locale.getAllLanguages()
Get a list of the long names of all the languages supported by Salsa's
translation system.
<static>
{Array}
Locale.getEventListing(options)
Returns a list of event objects in the given parameters. Locale.getEventListing differs from Locale.getRegionalListing in that it
allows searches that do not include zip codes, will search international zip codes, contains more search options, and returns additional
event object fields includes Location_Common_Name. Passing all parameters used in Locale.getRegionalListing will still work
<? var nearby_events = Locale.getRegionalListing({ zip: 20009, radius: 5, // 5 miles distributed_event_KEY: 2, orderBy: 'Start DESC', start: '2011-05-10', end: '2011-06-30', limit: 5 }); for(var i, var event = null; event = nearby_events[i]; i++){ print(event.Event_Name); } ?>
- Parameters:
- {Object} options Optional
- An Object of optional parameters. Possible options are:
- {String} zip Optional
- zip Zip / Postal Code
- {String} radius Optional
- Include events at most this distance form the ZIP code (in iles). Default is 30 miles.
- {Integer} distributed_event_KEY Optional
- An optional distributed_event_KEY parameter to limit searching to a single distributed event.
- {String} orderBy Optional
- The field to order results by. Defaults to the field
zipdistance
which is the distance in miles. - {String} limit Optional
- A String describing the limit and(optional) offset of the number of rows to retrieve in the form "offset, limit" such as "50, 100"
- {String} country Optional
- A String representative of the two character code for the country (automatically generated in the country drop down).
- {Date} start Optional
- A Date object in the format "yyyy-MM-dd" to search for all events starting after the given date.
- {Date} end Optional
- A Date object in the format "yyyy-MM-dd" to search for all events ending before the given date.
- {String} city Optional
- A String describing the city to search for events in.
- {String} state Optional
- A String representative of how the event state codes are stored (automatically generated in the state drop down).
options {...}
- Returns:
- An
Array
of event objects, each including azipdistance
field as the distance in miles from the specified zip code (if a zip code is passed), the the Event_Name, Start date, and Directions
<static>
Locale.getLanguages()
Get a list of the long names of all the language available to this
organization or chapter.
- Returns:
- A Java array of organization- or chapter-specific available languages.
<static>
{Array}
Locale.getRegionalListing(zip, options)
<? var nearby_events = Locale.getRegionalListing('20009', { radius: 5, // 5 miles distributed_event_KEY: 2, orderBy: 'Start DESC', limit: 5 }); for(var i, var event = null; event = nearby_events[i]; i++){ print(event.Event_Name); } ?>
- Parameters:
- {String} zip
- Zip Code
- {Object} options Optional
- An Object of optional parameters. Possible options are:
- {String} radius Optional
- Include events at most this distance form the ZIP code (in iles). Default is 30 miles.
- {Integer} distributed_event_KEY Optional
- An optional distributed_event_KEY parameter to limit searching to a single distributed event.
- {String} orderBy Optional
- The field to order results by. Defaults to the field
zipdistance
which is the distance in miles. - {String} limit Optional
- A String describing the limit and(optional) offset of the number of rows to retrieve in the form "offset, limit" such as "50, 100"
options {...}
- Returns:
- An
Array
of event objects, each including azipdistance
field as the distance in miles from the specified zip code.
<static>
{String}
Locale.getState(code)
Returns a state name for the given state code.
- Parameters:
- {String} code
- The state code
- Returns:
- The name of the state for the given code
<static>
{String}
Locale.getTranslation(obj, field)
Translate a field from the given object into the current language
var vals = DB.getObject('content_item', key); print(salsa.getTranslation(vals, 'Content'));
- Parameters:
- {Object} obj
- The object that contains the field you want to translate
- {String} field
- The field that you want to translate
- Returns:
- The translated value