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

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.