Commit a34e84503058aca68eb6a923e23b0334d127cc7a
1 parent
b11d0228
Allow for plugins to register i18n domains
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4332 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
12 additions
and
0 deletions
lib/plugins/plugin.inc.php
| @@ -13,6 +13,7 @@ class KTPlugin { | @@ -13,6 +13,7 @@ class KTPlugin { | ||
| 13 | var $_aAdminCategories = array(); | 13 | var $_aAdminCategories = array(); |
| 14 | var $_aAdminPages = array(); | 14 | var $_aAdminPages = array(); |
| 15 | var $_aDashlets = array(); | 15 | var $_aDashlets = array(); |
| 16 | + var $_ai18n = array(); | ||
| 16 | 17 | ||
| 17 | function KTPlugin($sFilename = null) { | 18 | function KTPlugin($sFilename = null) { |
| 18 | $this->sFilename = $sFilename; | 19 | $this->sFilename = $sFilename; |
| @@ -68,6 +69,11 @@ class KTPlugin { | @@ -68,6 +69,11 @@ class KTPlugin { | ||
| 68 | $this->_aDashlets[$sNamespace] = array($sClassName, $sNamespace, $sFilename, $this->sNamespace); | 69 | $this->_aDashlets[$sNamespace] = array($sClassName, $sNamespace, $sFilename, $this->sNamespace); |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 72 | + function registeri18n($sDomain, $sPath) { | ||
| 73 | + $sPath = $this->_fixFilename($sPath); | ||
| 74 | + $this->_ai18n[$sDomain] = array($sDomain, $sPath); | ||
| 75 | + } | ||
| 76 | + | ||
| 71 | function _fixFilename($sFilename) { | 77 | function _fixFilename($sFilename) { |
| 72 | if (empty($sFilename)) { | 78 | if (empty($sFilename)) { |
| 73 | $sFilename = $this->sFilename; | 79 | $sFilename = $this->sFilename; |
| @@ -92,6 +98,7 @@ class KTPlugin { | @@ -92,6 +98,7 @@ class KTPlugin { | ||
| 92 | require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); | 98 | require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); |
| 93 | require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); | 99 | require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); |
| 94 | require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); | 100 | require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); |
| 101 | + require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php"); | ||
| 95 | 102 | ||
| 96 | $oPRegistry =& KTPortletRegistry::getSingleton(); | 103 | $oPRegistry =& KTPortletRegistry::getSingleton(); |
| 97 | $oTRegistry =& KTTriggerRegistry::getSingleton(); | 104 | $oTRegistry =& KTTriggerRegistry::getSingleton(); |
| @@ -100,6 +107,7 @@ class KTPlugin { | @@ -100,6 +107,7 @@ class KTPlugin { | ||
| 100 | $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton(); | 107 | $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton(); |
| 101 | $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); | 108 | $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); |
| 102 | $oDashletRegistry =& KTDashletRegistry::getSingleton(); | 109 | $oDashletRegistry =& KTDashletRegistry::getSingleton(); |
| 110 | + $oi18nRegistry =& KTi18nRegistry::getSingleton(); | ||
| 103 | 111 | ||
| 104 | foreach ($this->_aPortlets as $k => $v) { | 112 | foreach ($this->_aPortlets as $k => $v) { |
| 105 | call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $v); | 113 | call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $v); |
| @@ -132,6 +140,10 @@ class KTPlugin { | @@ -132,6 +140,10 @@ class KTPlugin { | ||
| 132 | foreach ($this->_aDashlets as $k => $v) { | 140 | foreach ($this->_aDashlets as $k => $v) { |
| 133 | call_user_func_array(array(&$oDashletRegistry, 'registerDashlet'), $v); | 141 | call_user_func_array(array(&$oDashletRegistry, 'registerDashlet'), $v); |
| 134 | } | 142 | } |
| 143 | + | ||
| 144 | + foreach ($this->_ai18n as $k => $v) { | ||
| 145 | + call_user_func_array(array(&$oi18nRegistry, 'registeri18n'), $v); | ||
| 146 | + } | ||
| 135 | } | 147 | } |
| 136 | } | 148 | } |
| 137 | 149 |