Chief!
|
 |
« on: November 15, 2012, 11:25:09 PM » |
|
CubeCart 5.0.7 Language Class | - _language = ''; string; Current language Matches the LANG_REGEX. Examples: en-US, en-GB, en-CA, de-DE, fr-FR, fr-CA
- - _language_custom = array(); array; Custom language
This is used in the magic setter and magic unsetter as a flag that this string name=>value pair is temporary as the value does not matter (it is not used anywhere else in this class). Examples: $_language_custom['yada']="yada", $_language_custom['yowza']="yowza"
- _language_data = array(); array; Language data - holds the language file <info> block 'title'=>"Italiano", 'code'=>"it-IT", 'locale'=>"it-IT', 'character_set'=>"utf-8", 'version'=>"1.0.0", 'minVersion'=>"5.1.0", 'maxVersion'=>"5.0.*", - _language_definitions = array(); array; Language definitions - _language_definition_data = array(); array; Language definitions data - _language_groups = false; array; Language groups - _language_strings = array(); array; Language strings
const LANG_REGEX = '#^([a-z]{2})\-?([A-Z]{2})?$#'; const EMAIL_FILE = '#^email_(([a-z]{2})(\-[A-Z]{2})?(\-custom)?)\.[a-z]+(\.gz)?$#';
# _instance (static); instance; Class instance
| # __construct() (final);
- If the language is trying to be changed try to change it
- See if the language is set in the session
- Else try the default config language
- Set the language to the session
- Load the language
+ loadlang(); Load the core language files, Set the system locale + assignLang(); Gives the _language_strings to Smarty + __get($name); Magic get of a string value; string: name of string node returns string: value of string node + __isset($name); Magic isset of a string value string: name of string node returns boolean + __set($name, $value); Magic set of a string value name and value of string node string: name of string node array: value of string node if not already in _language_strings, assigns to _language_custom and _language_strings + __unset($name); Magic unset of a string value string: name of string node if in _language_custom, removes from _language_custom and _language_strings + static getInstance(); Setup the instance (singleton) + addStrings($strings); Add strings to the language array: name=>value pairs merges to _language_strings + change($language); Change language string: language assigns to _language, loadLanguageXML(), _setLocale() + create($array); Create language file array: array of nodes for the language->info node creates file 'lang_code.xml' in language folder returns boolean + current(); Current language returns _language + deleteLanguage($code, $path = CC_LANGUAGE_DIR); Delete a language string: language code tring: path to language directory returns boolean + fullyTranslated($type, $id); Check if a prod/doc/cat is translated in all languages string: 'document'|'product'|'category' int: id returns boolean + getCustom($group, $language = ''); Get custom language strings string: the `type` in the language database string: the language desired, the default is _language returns array of name=>value pairs or empty array + getData($element = ''); Get language data string: node in info block of language data returns _language_data of the $element, or the entire _language_data, or false + getDefinitions($group); Get language definitions string: returns array: , or empty array + getGroups(); Get language groups + getLanguage(); Get current language + getLanguageInfo($language); Get langauge information + getLanguageStrings(); Get all the language strings + getFriendlyModulePath($path, $name_only = false); Get friendly module path from relative path + getStrings($group = false); Get language strings + importEmail($source, $path = CC_LANGUAGE_DIR); Import email language + importLanguage($file, $overwrite = false); Import language file if valid + listLanguages($cache = true); List available languages + loadDefinitions($name, $path = CC_LANGUAGE_DIR, $file_name = 'definitions.xml', $cache = true); Load language definitions + loadLanguageXML($name, $language = '', $path = CC_LANGUAGE_DIR, $merge = true); Load language XML file(s) + saveLanguageXML($language, $compress = false, $replace, $path = CC_LANGUAGE_DIR); Save XML file + setTemplate(); Sets all the LANG variables in the templates + translateCategory(&$category); Translate a category + translateDocument(&$document); Translate a document + translateProduct(&$product); Translate a product - _checkPath($path); Checks to make sure the path passed in is valid - _extractXML($language); Extract XML information - _setLocale(); Set Locale - _valid($language); Validate language
|
|