Changeset 22049
- Timestamp:
- 2012/10/02 08:57:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-multilang/data/class/helper/SC_Helper_Locale.php
r22045 r22049 47 47 * @return string a string corresponding with message alias 48 48 */ 49 function get_locale($string, $lang_code = LANG_CODE, $device_type_id = FALSE) { 49 function get_locale($string, $lang_code = FALSE, $device_type_id = FALSE) { 50 // Set language code when it is not set. 51 if ($lang_code === FALSE) { 52 $lang_code = LANG_CODE; 53 } 50 54 // Get string list of specified language. 51 55 $translations = $this->get_translations($lang_code, $device_type_id); … … 66 70 * @return array strings 67 71 */ 68 function get_translations($lang_code = LANG_CODE, $device_type_id = FALSE) {72 function get_translations($lang_code, $device_type_id = FALSE) { 69 73 $translations_key = "translations_" . $lang_code . "_" . $device_type_id; 70 74 // If the strings of specified language is not loaded … … 97 101 * @return array file list 98 102 */ 99 function get_locale_file_list($lang_code = LANG_CODE, $device_type_id = FALSE) {103 function get_locale_file_list($lang_code, $device_type_id = FALSE) { 100 104 $file_list = array(); 101 105 … … 108 112 109 113 // Get a list of enabled plugins. 110 $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin(); 111 // Get the plugins directory. 112 $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory(); 113 foreach ($arrPluginDataList as $arrPluginData) { 114 // Check that the plugin filename is contained in the list of plugins directory. 115 if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) { 116 // Path to the plugin locale file. 117 $plugin_locale_path = PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . "/locales/{$lang_code}.mo"; 118 // If a locale file of specified language is exist, add to the file list. 119 if (file_exists($plugin_locale_path)) { 120 $file_list[] = $plugin_locale_path; 114 if (defined(PLUGIN_UPLOAD_REALDIR)) { 115 $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin(); 116 // Get the plugins directory. 117 $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory(); 118 foreach ($arrPluginDataList as $arrPluginData) { 119 // Check that the plugin filename is contained in the list of plugins directory. 120 if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) { 121 // Path to the plugin locale file. 122 $plugin_locale_path = PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . "/locales/{$lang_code}.mo"; 123 // If a locale file of specified language is exist, add to the file list. 124 if (file_exists($plugin_locale_path)) { 125 $file_list[] = $plugin_locale_path; 126 } 121 127 } 122 128 } … … 142 148 * @return integer index 143 149 */ 144 function get_plural_index($count, $lang_code = LANG_CODE) { 150 function get_plural_index($count, $lang_code = FALSE) { 151 // Set language code when it is not set. 152 if ($lang_code === FALSE) { 153 $lang_code = LANG_CODE; 154 } 145 155 // Get a formula 146 156 $string = $this->get_plural_forms($lang_code); … … 164 174 * @return string formula 165 175 */ 166 function get_plural_forms($lang_code = LANG_CODE) {176 function get_plural_forms($lang_code) { 167 177 // If formula is empty, include the file. 168 178 if(empty($this->_plural_forms)){
Note: See TracChangeset
for help on using the changeset viewer.