include/Localization/Localization.php

Show: inherited
Table of Contents

\Localization

Package: SugarCRM

Localization manager

Api
 

Properties

Propertypublic  $availableCharsets= 'array( 'BIG-5', //Taiwan and Hong Kong /*'CP866' // ms-dos Cyrillic */ /*'CP949' //Microsoft Korean */ 'CP1251', //MS Cyrillic 'CP1252', //MS Western European & US 'EUC-CN', //Simplified Chinese GB2312 'EUC-JP', //Unix Japanese 'EUC-KR', //Korean 'EUC-TW', //Taiwanese 'ISO-2022-JP', //Japanese 'ISO-2022-KR', //Korean 'ISO-8859-1', //Western European and US 'ISO-8859-2', //Central and Eastern European 'ISO-8859-3', //Latin 3 'ISO-8859-4', //Latin 4 'ISO-8859-5', //Cyrillic 'ISO-8859-6', //Arabic 'ISO-8859-7', //Greek 'ISO-8859-8', //Hebrew 'ISO-8859-9', //Latin 5 'ISO-8859-10', //Latin 6 'ISO-8859-13', //Latin 7 'ISO-8859-14', //Latin 8 'ISO-8859-15', //Latin 9 'KOI8-R', //Cyrillic Russian 'KOI8-U', //Cyrillic Ukranian 'SJIS', //MS Japanese 'UTF-8', //UTF-8 )'
Default valuearray( 'BIG-5', //Taiwan and Hong Kong /*'CP866' // ms-dos Cyrillic */ /*'CP949' //Microsoft Korean */ 'CP1251', //MS Cyrillic 'CP1252', //MS Western European & US 'EUC-CN', //Simplified Chinese GB2312 'EUC-JP', //Unix Japanese 'EUC-KR', //Korean 'EUC-TW', //Taiwanese 'ISO-2022-JP', //Japanese 'ISO-2022-KR', //Korean 'ISO-8859-1', //Western European and US 'ISO-8859-2', //Central and Eastern European 'ISO-8859-3', //Latin 3 'ISO-8859-4', //Latin 4 'ISO-8859-5', //Cyrillic 'ISO-8859-6', //Arabic 'ISO-8859-7', //Greek 'ISO-8859-8', //Hebrew 'ISO-8859-9', //Latin 5 'ISO-8859-10', //Latin 6 'ISO-8859-13', //Latin 7 'ISO-8859-14', //Latin 8 'ISO-8859-15', //Latin 9 'KOI8-R', //Cyrillic Russian 'KOI8-U', //Cyrillic Ukranian 'SJIS', //MS Japanese 'UTF-8', //UTF-8 )Details
Type
n/a
Propertypublic  $currencies= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $default_email_charset= ''UTF-8''
Default value'UTF-8'Details
Type
n/a
Propertypublic  $default_export_charset= ''UTF-8''
Default value'UTF-8'Details
Type
n/a
Propertypublic  $iconvCharsetMap= 'array( 'KS_C_5601-1987' => 'CP949', 'ISO-8859-8-I' => 'ISO-8859-8' )'
Default valuearray( 'KS_C_5601-1987' => 'CP949', 'ISO-8859-8-I' => 'ISO-8859-8' )Details
Type
n/a
Propertypublic  $invalidNameFormatUpgradeFilename= ''upgradeInvalidLocaleNameFormat.php''
Default value'upgradeInvalidLocaleNameFormat.php'Details
Type
n/a
Propertypublic  $localeNameFormat= ''
Details
Type
n/a
Propertypublic  $localeNameFormatDefault= ''
Details
Type
n/a

Methods

methodpublicLocalization( ) : void

sole constructor

methodpubliccreateInvalidLocaleNameFormatUpgradeNotice( ) : void

Creates the file that is created when there is an invalid name format during an upgrade

methodpublicdetectCharset( \$str $str, \$strict $strict = false ) : string

Attempts to detect the charset used in the string

Parameters
Name Type Description
$str \$str

string

$strict \$strict

bool default false (use strict encoding?)

Returns
Type Description
string
methodpublicgetCharsetSelect( ) : void

returns an array of charsets with keys for available translations; appropriate for get_select_options_with_id()

methodpublicgetCurrencies( ) : array

getter for currencies array

Returns
Type Description
array $this->currencies returns array( id => array(name => X, etc
methodpublicgetCurrencySymbol(  $user = null ) : void

Parameters
Name Type Description
$user
methodpublicgetDecimalSeparator(  $user = null ) : void

Parameters
Name Type Description
$user
methodpublicgetDefaultCurrencies( ) : array

retrieves default OOTB currencies for sugar_config and installer.

Returns
Type Description
array ret Array of default currencies keyed by ISO4217 code
methodpublicgetExportCharset( string $charset = '',  $user = null ) : string

returns the charset preferred in descending order: User, Sugar Config, DEFAULT

Parameters
Name Type Description
$charset string

charset to override ALL, pass a valid charset here

$user
Returns
Type Description
string charset the chosen character set
methodpublicgetLocaleConfigDefaults( ) : array

returns an array of Sugar Config defaults that are determined by locale settings

Returns
Type Description
array
methodpublicgetLocaleFormatMacro(  $user = null ) : string

get's the Name format macro string, preferring $current_user

Parameters
Name Type Description
$user
Returns
Type Description
string format Name Format macro for locale
methodpublicgetLocaleFormattedName( string $firstName, string $lastName, string $salutationKey = '', string $title = '', string $format = "", object $user = null, bool $returnEmptyStringIfEmpty = false ) : string

returns formatted name according to $current_user's locale settings

Parameters
Name Type Description
$firstName string

firstName

$lastName string

lastName

$salutationKey string

salutation

$title string

title

$format string

format If a particular format is desired, then pass this optional parameter as a simple string. sfl is "Salutation FirstName LastName", "l, f s" is "LastName[comma][space]FirstName[space]Salutation"

$user object

user object

$returnEmptyStringIfEmpty bool

returnEmptyStringIfEmpty true if we should return back an empty string rather than a single space when the formatted name would be blank

Returns
Type Description
string formattedName
methodpublicgetLocaleFormattedNumber( string $number, string $currencySymbol = '', bool $is_currency = true,  $user = null ) : string

returns a number formatted by user preference or system default

Parameters
Name Type Description
$number string

number Number to be formatted and returned

$currencySymbol string

currencySymbol Currency symbol if override is necessary

$is_currency bool

is_currency Flag to also return the currency symbol

$user
Returns
Type Description
string Formatted number
methodpublicgetNameJs( string $first = '', string $last = '', string $salutation = '',  $title = '' ) : string

outputs some simple Javascript to show a preview of Name format in "My Account" and "Admin->Localization"

Parameters
Name Type Description
$first string

first First Name, use app_strings default if not specified

$last string

last Last Name, use app_strings default if not specified

$salutation string

salutation Saluation, use app_strings default if not specified

$title
Returns
Type Description
string some Javascript
methodpublicgetNumberGroupingSeparator(  $user = null ) : void

Parameters
Name Type Description
$user
methodpublicgetNumberJs( ) : void

returns Javascript to format numbers and currency for ***DISPLAY***

methodpublicgetOutboundEmailCharset(  $user = null ) : string

returns the charset preferred in descending order: User, Sugar Config, DEFAULT

Parameters
Name Type Description
$user
Returns
Type Description
string charset the chosen character set
methodpublicgetPrecedentPreference( string $prefName, object $user = null,  $sugarConfigPrefName = '' ) : string

abstraction of precedence

Parameters
Name Type Description
$prefName string

prefName Name of preference to retrieve based on overrides

$user object

user User in focus, default null (current_user)

$sugarConfigPrefName
Returns
Type Description
string pref Most significant preference
methodpublicgetPrecision(  $user = null ) : void

Parameters
Name Type Description
$user
methodpublicgetUsableLocaleNameOptions( array $options ) : array

Creates dropdown items that have localized example names while filtering out invalid formats

Parameters
Name Type Description
$options array

un-prettied dropdown list

Returns
Type Description
array array of dropdown options
methodpublicinvalidLocaleNameFormatUpgrade( ) : bool

Checks to see if there was an invalid Name Format encountered during the upgrade

Returns
Type Description
bool true if there was an invalid name, false if all went well.
methodpublicisAllowedNameFormat(  $name_format ) : bool

Checks to see that the characters in $name_format are allowed: s, f, l, space/tab or punctuation

Parameters
Name Type Description
$name_format
Returns
Type Description
bool
methodpublicloadCurrencies( ) : void

wrapper for whatever currency system we implement

methodpublicnormalizeCharset(  $charset ) : void

Parameters
Name Type Description
$charset
methodpublicprepBeanForExport( \bean $bean ) : \bean

prepares a bean for export by translating any text fields into the export character set

Parameters
Name Type Description
$bean \bean

object A SugarBean

Returns
Type Description
\bean object The bean with translated strings
methodpublicremoveInvalidLocaleNameFormatUpgradeNotice( ) : void

Removes the file that is created when there is an invalid name format during an upgrade

methodpublictranslateCharset( string $string, string $fromCharset, string $toCharset = 'UTF-8', bool $forceIconv = false ) : string

translates a character set from one encoding to another encoding

Parameters
Name Type Description
$string string

string the string to be translated

$fromCharset string

fromCharset the charset the string is currently in

$toCharset string

toCharset the charset to translate into (defaults to UTF-8)

$forceIconv bool

forceIconv force using the iconv library instead of mb_string

Returns
Type Description
string the translated string
methodpublictranslateCharsetMIME(  $string,  $fromCharset,  $toCharset = 'UTF-8',  $encoding = "Q" ) : void

translates a character set from one to another, and the into MIME-header friendly format

Parameters
Name Type Description
$string
$fromCharset
$toCharset
$encoding
methodpublictranslateForEmail( mixed $var ) : mixed

translates the passed variable for email sending (export)

Parameters
Name Type Description
$var mixed

the var (array or string) to translate

Returns
Type Description
mixed the translated variable
methodpublictranslateStringPack( array $strings, string $charset ) : array

returns a mod|app_strings array in the target charset

Parameters
Name Type Description
$strings array

strings $mod_string, et.al.

$charset string

charset Target charset

Returns
Type Description
array Translated string pack
Documentation was generated by DocBlox 0.18.1.