From: Hinrich D. <hd...@us...> - 2002-06-09 22:10:00
|
Update of /cvsroot/post-nuke/postnuke_official/html/includes In directory usw-pr-cvs1:/tmp/cvs-serv31757 Modified Files: pnML.php Log Message: - dummy sync commit Index: pnML.php =================================================================== RCS file: /cvsroot/post-nuke/postnuke_official/html/includes/pnML.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pnML.php 26 May 2002 17:47:12 -0000 1.2 --- pnML.php 9 Jun 2002 22:09:58 -0000 1.3 *************** *** 49,53 **** * @return the translated string, or the original string if no translation is available */ ! function pnML($string, $args = NULL) { global $pnML_backend, $pnML_listeners; --- 49,53 ---- * @return the translated string, or the original string if no translation is available */ ! function pnML($string) { global $pnML_backend, $pnML_listeners; *************** *** 66,70 **** $trans = $string; } ! if (isset($args)) { $trans = pnML_bind_variables($trans, $args); } --- 66,72 ---- $trans = $string; } ! if (func_num_args() > 1) { ! $args = func_get_args(); ! unset($args[0]); // Unset $string argument $trans = pnML_bind_variables($trans, $args); } *************** *** 78,82 **** * @return the translation string, or the key if no translation is available */ ! function pnMLByKey($key, $args = NULL) { global $pnML_backend, $pnML_listeners; --- 80,84 ---- * @return the translation string, or the key if no translation is available */ ! function pnMLByKey($key) { global $pnML_backend, $pnML_listeners; *************** *** 95,99 **** $trans = $key; } else { ! if (isset($args)) { $trans = pnML_bind_variables($trans, $args); } --- 97,103 ---- $trans = $key; } else { ! if (func_num_args() > 1) { ! $args = func_get_args(); ! unset($args[0]); // Unset $string argument $trans = pnML_bind_variables($trans, $args); } *************** *** 113,145 **** return true; } ! /* ! function pnMLGetXMLBackend($modname, $type, $lang) { ! $ctx = array('modname' => $modname, ! 'type' => $type, ! 'lang' => $lang); ! $xmlBackend = new pnML_XMLTranslationsBackend; ! $res = $xmlBackend->load($ctx); ! if (!isset($res)) { ! return; // throw back ! } ! if ($res == false) { ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'TRANSLATION_EXCEPTION', ! new SystemException(__FILE__."(".__LINE__."): Missing translation context ($modname, $type, $lang). You need to generate it.")); return; } ! return $xmlBackend; } ! */ function pnML_bind_variables($string, $args) { ! if (is_array($args)) { ! $i = 1; ! foreach($args as $var) { ! $search = "#($i)"; ! $string = str_replace($search, $var, $string); ! } ! } else { ! $string = str_replace('#(1)', $args, $string); } return $string; --- 117,144 ---- return true; } ! ! function pnMLGetDynamic($refid, $table_name, $fields) { ! $table_name .= '_mldata'; ! $fields = implode(',', $fields); ! ! $query = "SELECT $fields FROM $table_name WHERE pn_refid = $refid"; ! $dbresult = $dbconn->Execute($query); ! ! if($dbconn->ErrorNo() != 0) { ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', ! new SystemException(__FILE__."(".__LINE__."): Database error while querying: $query")); return; } ! ! return $dbresult; } ! function pnML_bind_variables($string, $args) { ! $i = 1; ! foreach($args as $var) { ! $search = "#($i)"; ! $string = str_replace($search, $var, $string); } return $string; *************** *** 159,169 **** } ! $lang = pnUserGetLang(); ! $lang = 'en'; $ctx = array('modname' => $modname, 'moddir' => $moddir, 'type' => $type, ! 'lang' => $lang); $res = $pnML_backend->load($ctx); --- 158,168 ---- } ! //$locale = pnUserGetLocale(); ! $locale = 'en'; $ctx = array('modname' => $modname, 'moddir' => $moddir, 'type' => $type, ! 'locale' => $locale); $res = $pnML_backend->load($ctx); *************** *** 238,245 **** $D->msg('pnML_XMLTranslationsBackend::load');*/ ! list($ostype, $oslang) = pnVarPrepForOS($translation_ctx['type'], ! $translation_ctx['lang']); ! $filename = "modules/$translation_ctx[moddir]/pnlang/xml/$oslang/pn$ostype.xml"; if (!file_exists($filename)) { return false; --- 237,244 ---- $D->msg('pnML_XMLTranslationsBackend::load');*/ ! list($ostype, $oslocale) = pnVarPrepForOS($translation_ctx['type'], ! $translation_ctx['locale']); ! $filename = "modules/$translation_ctx[moddir]/pnlang/xml/$oslocale/pn$ostype.xml"; if (!file_exists($filename)) { return false; *************** *** 369,377 **** $reference['line'] = $attribs['line']; $this->curEntry['references'][] = $reference; ! } elseif ($tag == 'original') { $this->curEntry['original'] = array(); $this->curEntry['original']['file'] = $attribs['file']; $this->curEntry['original']['xpath'] = $attribs['xpath']; ! } } --- 368,377 ---- $reference['line'] = $attribs['line']; $this->curEntry['references'][] = $reference; ! } ! /*elseif ($tag == 'original') { $this->curEntry['original'] = array(); $this->curEntry['original']['file'] = $attribs['file']; $this->curEntry['original']['xpath'] = $attribs['xpath']; ! }*/ } *************** *** 390,400 **** $this->transKeyEntries[$key] = count($this->trans) -1; } elseif ($tag == 'string') { ! // FIXME <marco> consider to decode utf-8 here ! $this->curEntry['string'] = trim($this->curData); } elseif ($tag == 'key') { $this->curEntry['key'] = trim($this->curData); } elseif ($tag == 'translation') { ! // FIXME <marco> consider to decode utf-8 here ! $this->curEntry['translation'] = trim($this->curData); } $this->curData = ''; --- 390,398 ---- $this->transKeyEntries[$key] = count($this->trans) -1; } elseif ($tag == 'string') { ! $this->curEntry['string'] = utf8_decode(trim($this->curData)); } elseif ($tag == 'key') { $this->curEntry['key'] = trim($this->curData); } elseif ($tag == 'translation') { ! $this->curEntry['translation'] = utf8_decode(trim($this->curData)); } $this->curData = ''; *************** *** 414,422 **** { global $pnML_PHPBackend_entries; - /*if (!isset($pnML_PHPBackend_entries[$string])) { - return; - }*/ - // It seems to be faster in this way - // Jim said it avoid two lookups return @$pnML_PHPBackend_entries[$string]; } --- 412,415 ---- *************** *** 425,433 **** { global $pnML_PHPBackend_keyEntries; - /*if (!isset($pnML_PHPBackend_keyEntries[$key])) { - return; - }*/ - // It seems to be faster in this way - // Jim said it avoid two lookups return @$pnML_PHPBackend_keyEntries[$key]; } --- 418,421 ---- *************** *** 435,442 **** function load($translation_ctx) { ! list($ostype, $oslang) = pnVarPrepForOS($translation_ctx['type'], ! $translation_ctx['lang']); ! $filename = "modules/$translation_ctx[moddir]/pnlang/php/$oslang/pn$ostype.php"; if (!file_exists($filename)) { return false; --- 423,430 ---- function load($translation_ctx) { ! list($ostype, $oslocale) = pnVarPrepForOS($translation_ctx['type'], ! $translation_ctx['locale']); ! $filename = "modules/$translation_ctx[moddir]/pnlang/php/$oslocale/pn$ostype.php"; if (!file_exists($filename)) { return false; |