Changeset 6756

Show
Ignore:
Timestamp:
09/17/08 00:02:57 (3 months ago)
Author:
p_lindheimer
Message:

fixes #3204 set localization domain when applying hooks, for gui hooks, implementation depends on standardization of the gui functions to start with modulename_ which is currently the standard although not required. Implemented so that the domain will only be set if the current target language localization directory exists for the module, otherwise it will fallback to amp since many past languages have put their localizations in the amp domain. They should move this to the proper module going forward

Files:

Legend:

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

    r6424 r6756  
    412412         
    413413        function buildconfigpage() { 
    414                 if ( !$this->_sorted_guifuncs ) 
     414                if ( !$this->_sorted_guifuncs ) { 
    415415                        $this->sortguifuncs(); 
     416                } 
    416417 
    417418                if ( is_array($this->_guifuncs) ) { 
    418419                        foreach ( array_keys($this->_guifuncs) as $sortorder ) { 
    419420                                foreach ( $this->_guifuncs[$sortorder] as $func ) { 
    420                                         $func($this->_compname); 
     421                                        $modparts = explode("_",$func,2); 
     422                                        $thismod = $modparts[0]; 
     423                                        if (isset($_COOKIE['lang']) && is_dir("./modules/$thismod/i18n/".$_COOKIE['lang'])) { 
     424                                                bindtextdomain($thismod,"./modules/$thismod/i18n"); 
     425                                                bind_textdomain_codeset($thismod, 'utf8'); 
     426                                                textdomain($thismod); 
     427                         
     428                                                $func($this->_compname); 
     429 
     430                                                textdomain('amp'); 
     431                                        } else { 
     432                                                $func($this->_compname); 
     433                                        } 
    421434                                } 
    422435                        } 
  • freepbx/branches/2.5/amp_conf/htdocs/admin/functions.inc.php

    r6675 r6756  
    656656                // loop through all active modules 
    657657                foreach($active_modules as $this_module) { 
    658                                 // look for requested hooks for $module 
    659                                 // ie: findme_hook_extensions() 
    660                                 $funct = $this_module['rawname'] . '_hook_' . $target_module; 
    661                                 if( function_exists( $funct ) ) { 
    662                                         // execute the function, appending the  
    663                                         // html output to that of other hooking modules 
     658                        // look for requested hooks for $module 
     659                        // ie: findme_hook_extensions() 
     660                        $funct = $this_module['rawname'] . '_hook_' . $target_module; 
     661                        if( function_exists( $funct ) ) { 
     662                                // execute the function, appending the  
     663                                // html output to that of other hooking modules 
     664 
     665                                $thismod = $this_module['rawname']; 
     666                                if (isset($_COOKIE['lang']) && is_dir("./modules/$thismod/i18n/".$_COOKIE['lang'])) { 
     667                                        bindtextdomain($thismod,"./modules/$thismod/i18n"); 
     668                                        bind_textdomain_codeset($thismod, 'utf8'); 
     669                                        textdomain($thismod); 
     670                         
     671                                        freepbx_debug("applying hook for $thismod with domain: $saved_domain"); 
    664672                                        if ($hookReturn = $funct($target_menuid, $viewing_itemid)) { 
    665673                                                $this->hookHtml .= $hookReturn; 
    666674                                        } 
    667                                         // remember who installed hooks 
    668                                         // we need to know this for processing form vars 
    669                                         $this->arrHooks[] = $this_module['rawname']; 
     675 
     676                                        textdomain('amp'); 
     677                                        freepbx_debug("returned to $thismod with domain: $saved_domain"); 
     678                                } else { 
     679                                        if ($hookReturn = $funct($target_menuid, $viewing_itemid)) { 
     680                                                $this->hookHtml .= $hookReturn; 
     681                                        } 
    670682                                } 
     683                                // remember who installed hooks 
     684                                // we need to know this for processing form vars 
     685                                $this->arrHooks[] = $this_module['rawname']; 
     686                        } 
    671687                } 
    672688        } 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads