diff --git a/lib/i18n/i18n.inc.php b/lib/i18n/i18n.inc.php new file mode 100644 index 0000000..3bf8f22 --- /dev/null +++ b/lib/i18n/i18n.inc.php @@ -0,0 +1,21 @@ +sDomain = $sDomain; + $this->sPath = $sPath; + } + + function gettext($sContents) { + return dcgettext($this->sDomain, $sContents, LC_MESSAGES); + } +} + +class KTi18nGeneric { + function KTi18n() { + } + + function gettext($sContents) { + return $sContents; + } +} diff --git a/lib/i18n/i18nregistry.inc.php b/lib/i18n/i18nregistry.inc.php new file mode 100644 index 0000000..c053a4a --- /dev/null +++ b/lib/i18n/i18nregistry.inc.php @@ -0,0 +1,39 @@ +_ai18nDetails[$sDomain] = array($sDomain, $sDirectory); + bindtextdomain($sDomain, $sDirectory); + bind_textdomain_codeset($sDomain, 'UTF-8'); + } + + function &geti18n($sDomain) { + $oi18n =& KTUtil::arrayGet($this->_ai18ns, $sDomain); + if (!empty($oi18n)) { + return $oi18n; + } + $aDetails = KTUtil::arrayGet($this->_ai18nDetails, $sDomain); + if (empty($aDetails)) { + return new KTi18nGeneric; + } + $oi18n =& new KTi18n($sDomain, $sDirectory); + $this->ai18ns[$sDomain] =& $oi18n; + return $oi18n; + } +} + diff --git a/lib/i18n/i18nutil.inc.php b/lib/i18n/i18nutil.inc.php new file mode 100644 index 0000000..873009d --- /dev/null +++ b/lib/i18n/i18nutil.inc.php @@ -0,0 +1,6 @@ +