Пример #1
0
	function prepare()
	{
		$this->setClass('LPC_translated_message_list');
		foreach(LPC_I18n_messageFormatter::$object_cache as $langID=>$msgs) {
			$this->a("<h1>Messages used in this page</h1>");
			$lang=LPC_Language::newLanguage($langID);
			$this->a("<h2>".$lang->getNameH()."</h2>");
			$msgList=new LPC_HTML_node();
			$this->a($msgList);
			foreach($msgs as $key=>$obj) {
				$a=new LPC_HTML_node('a');
				$a->a(htmlspecialchars($key));
				$a->setAttr('href',LPC_url."/translate/message_translate.php?l=$langID&m=".rawurlencode($key));
				if ($trans=$obj->getPattern())
					$a->setAttr('title',$trans);
				if ($msgList->content)
					$msgList->a(" &bull; ");
				$msgList->a($a);
			}
		}
	}
Пример #2
0
<?php

require "common.php";

if (empty($_REQUEST['m'])) {
	header("Location: index.php");
	exit;
}
if (isset($_REQUEST['l'])) {
	$l=LPC_Language::newLanguage();
	$l->fromKey($_REQUEST,'l');
	if ($l->id)
		$_SESSION['LPC_target_lang']=$l->id;
}

if (empty($_SESSION['LPC_target_lang'])) {
	header("Location: lang_select.php?m=".rawurlencode($msgKey));
	exit;
}

$p->title="Message translator";
$p->st();

$msg=new LPC_I18n_message();
$msg=$msg->search(
	array('language','message_key'),
	array($_SESSION['LPC_target_lang'],$msgKey)
);
if ($msg)
	$msg=$msg[0];
else {