Changeset 22045 for branches/version-2_12-multilang/data/class/helper
- Timestamp:
- 2012/10/01 08:54:42 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-multilang/data/class/helper/SC_Helper_Locale.php
r22005 r22045 47 47 * @return string a string corresponding with message alias 48 48 */ 49 function get_locale($string, $lang_code = LANG_CODE, $device_type_id = DEVICE_TYPE_PC) {49 function get_locale($string, $lang_code = LANG_CODE, $device_type_id = FALSE) { 50 50 // Get string list of specified language. 51 51 $translations = $this->get_translations($lang_code, $device_type_id); … … 66 66 * @return array strings 67 67 */ 68 function get_translations($lang_code = LANG_CODE, $device_type_id = DEVICE_TYPE_PC) { 68 function get_translations($lang_code = LANG_CODE, $device_type_id = FALSE) { 69 $translations_key = "translations_" . $lang_code . "_" . $device_type_id; 69 70 // If the strings of specified language is not loaded 70 if (empty($this->_translations[$ lang_code][$device_type_id])) {71 if (empty($this->_translations[$translations_key])) { 71 72 $translations = array(); 72 73 … … 83 84 } 84 85 85 $this->_translations[$ lang_code][$device_type_id] = $translations;86 $this->_translations[$translations_key] = $translations; 86 87 } 87 88 88 return $this->_translations[$ lang_code][$device_type_id];89 return $this->_translations[$translations_key]; 89 90 } 90 91 … … 96 97 * @return array file list 97 98 */ 98 function get_locale_file_list($lang_code = LANG_CODE, $device_type_id = DEVICE_TYPE_PC) {99 function get_locale_file_list($lang_code = LANG_CODE, $device_type_id = FALSE) { 99 100 $file_list = array(); 100 101 … … 123 124 124 125 // Path to the template locale file. 125 $template_locale_path = HTML_REALDIR . SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true) . "locales/{$lang_code}.mo"; 126 // If a locale file of specified language is exist, add to the file list. 127 if (file_exists($template_locale_path)) { 128 $file_list[] = $template_locale_path; 126 if ($device_type_id !== FALSE) { 127 $template_locale_path = HTML_REALDIR . SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true) . "locales/{$lang_code}.mo"; 128 // If a locale file of specified language is exist, add to the file list. 129 if (file_exists($template_locale_path)) { 130 $file_list[] = $template_locale_path; 131 } 129 132 } 130 133
Note: See TracChangeset
for help on using the changeset viewer.
