Changeset 6901

Show
Ignore:
Timestamp:
09/30/08 14:58:51 (2 months ago)
Author:
p_lindheimer
Message:

more textdomain changes to make sure callbacks have the proper translation domain for the hosting modules

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.5/amp_conf/htdocs/admin/functions.inc.php

    r6884 r6901  
    669669                                        textdomain($thismod); 
    670670                         
    671                                         freepbx_debug("applying hook for $thismod with domain: $saved_domain"); 
    672671                                        if ($hookReturn = $funct($target_menuid, $viewing_itemid)) { 
    673672                                                $this->hookHtml .= $hookReturn; 
     
    675674 
    676675                                        textdomain('amp'); 
    677                                         freepbx_debug("returned to $thismod with domain: $saved_domain"); 
    678676                                } else { 
    679677                                        if ($hookReturn = $funct($target_menuid, $viewing_itemid)) { 
     
    861859                $exten = array($exten); 
    862860        } 
     861 
    863862        foreach(array_keys($module_hash) as $mod) { 
    864863                $function = $mod."_check_extensions"; 
    865864                if (function_exists($function)) { 
    866                         $module_usage = $function($exten); 
     865                        if (isset($_COOKIE['lang']) && is_dir("./modules/$mod/i18n/".$_COOKIE['lang'])) { 
     866                                $prev_domain = textdomain(NULL); 
     867                                bindtextdomain($mod,"./modules/$mod/i18n"); 
     868                                bind_textdomain_codeset($mod, 'utf8'); 
     869                                textdomain($mod); 
     870                                $module_usage = $function($exten); 
     871                                textdomain($prev_domain); 
     872                        } else { 
     873                                $module_usage = $function($exten); 
     874                        } 
    867875                        if (!empty($module_usage)) { 
    868876                                $exten_usage[$mod] = $module_usage; 
     
    901909function framework_check_destination_usage($dest=true, $module_hash=false) { 
    902910        global $active_modules; 
     911 
    903912        $dest_usage = array(); 
    904913        $dest_matches = array(); 
     
    911920                $dest = array($dest); 
    912921        } 
     922 
    913923        foreach(array_keys($module_hash) as $mod) { 
    914924                $function = $mod."_check_destinations"; 
    915925                if (function_exists($function)) { 
    916                         $module_usage = $function($dest); 
     926                        if (isset($_COOKIE['lang']) && is_dir("./modules/$mod/i18n/".$_COOKIE['lang'])) { 
     927                                freepbx_debug("switching the domain for $mod"); 
     928                                $prev_domain = textdomain(NULL); 
     929                                bindtextdomain($mod,"./modules/$mod/i18n"); 
     930                                bind_textdomain_codeset($mod, 'utf8'); 
     931                                textdomain($mod); 
     932                                $module_usage = $function($dest); 
     933                                textdomain($prev_domain); 
     934                        } else { 
     935                                $module_usage = $function($dest); 
     936                        } 
    917937                        if (!empty($module_usage)) { 
    918938                                $dest_usage[$mod] = $module_usage; 
     
    10221042                } 
    10231043                $object = $usage_count > 1 ? _("Objects"):_("Object"); 
    1024                 return array('text' => ' '.sprintf(_("Used as Destination by %s %s"),$usage_count, $object), 
     1044                return array('text' => ' '.sprintf(dgettext('amp',"Used as Destination by %s %s"),$usage_count, $object), 
    10251045                             'tooltip' => $str, 
    10261046                                                                ); 
     
    10611081                        $dest_results[$target] = $dest_cache[$target]; 
    10621082                } else { 
    1063  
    10641083                        $found_owner = false; 
    10651084                        foreach(array_keys($module_hash) as $mod) { 
    10661085                                $function = $mod."_getdestinfo"; 
    10671086                                if (function_exists($function)) { 
    1068                                         $check_module = $function($target); 
     1087                                        if (isset($_COOKIE['lang']) && is_dir("./modules/$mod/i18n/".$_COOKIE['lang'])) { 
     1088                                                $prev_domain = textdomain(NULL); 
     1089                                                bindtextdomain($mod,"./modules/$mod/i18n"); 
     1090                                                bind_textdomain_codeset($mod, 'utf8'); 
     1091                                                textdomain($mod); 
     1092                                                $check_module = $function($target); 
     1093                                                textdomain($prev_domain); 
     1094                                        } else { 
     1095                                                $check_module = $function($target); 
     1096                                        } 
    10691097                                        if ($check_module !== false) { 
    10701098                                                $found_owner = true; 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads