Changeset 22045


Ignore:
Timestamp:
2012/10/01 08:54:42 (8 years ago)
Author:
pineray
Message:

#163 テキスト出力多言語対応

デバイス別の言語ファイルを読み込まないオプションを追加.

Location:
branches/version-2_12-multilang/data/class
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-multilang/data/class/SC_I18n.php

    r22005 r22045  
    4747        } 
    4848        // If device type ID is not specified, detect the viewing device. 
    49         if (empty($options['device_type_id'])) { 
     49        if (!isset($options['device_type_id']) || ($options['device_type_id'] !== FALSE && !strlen($options['device_type_id']))) { 
    5050            $options['device_type_id'] = SC_Display_Ex::detectDevice(); 
    5151        } 
     
    8585        } 
    8686        // If device type ID is not specified, detect the viewing device. 
    87         if (empty($options['device_type_id'])) { 
     87        if (!isset($options['device_type_id']) || ($options['device_type_id'] !== FALSE && !strlen($options['device_type_id']))) { 
    8888            $options['device_type_id'] = SC_Display_Ex::detectDevice(); 
    8989        } 
  • branches/version-2_12-multilang/data/class/SC_Initial.php

    r22041 r22045  
    207207            } 
    208208        } else { 
    209             die(SC_I18n_Ex::t('SC_INITIAL_ERROR_NOT_FOUND', array('T_CACHE_REALDIR' => CACHE_REALDIR), array('lang_code' => 'ja', 'device_type_id' => 10))); 
     209            die(SC_I18n_Ex::t('SC_INITIAL_ERROR_NOT_FOUND', array('T_CACHE_REALDIR' => CACHE_REALDIR), array('lang_code' => 'ja', 'device_type_id' => FALSE))); 
    210210        } 
    211211    } 
  • branches/version-2_12-multilang/data/class/helper/SC_Helper_Locale.php

    r22005 r22045  
    4747     * @return  string  a string corresponding with message alias 
    4848     */ 
    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) { 
    5050        // Get string list of specified language. 
    5151        $translations = $this->get_translations($lang_code, $device_type_id); 
     
    6666     * @return  array   strings 
    6767     */ 
    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; 
    6970        // 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])) { 
    7172            $translations = array(); 
    7273 
     
    8384            } 
    8485 
    85             $this->_translations[$lang_code][$device_type_id] = $translations; 
     86            $this->_translations[$translations_key] = $translations; 
    8687        } 
    8788 
    88         return $this->_translations[$lang_code][$device_type_id]; 
     89        return $this->_translations[$translations_key]; 
    8990    } 
    9091 
     
    9697     * @return  array   file list 
    9798     */ 
    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) { 
    99100        $file_list = array(); 
    100101 
     
    123124 
    124125        // 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            } 
    129132        } 
    130133 
Note: See TracChangeset for help on using the changeset viewer.