私の多言語 joomla 2.5 ページでは、JoomGalleryを使用したいと思います。画像はカテゴリに割り当てられます。ウェブページの現在の言語に応じてこれらのカテゴリを作成するにはどうすればよいですか?
ありがとうございました。スパイキー
私の多言語 joomla 2.5 ページでは、JoomGalleryを使用したいと思います。画像はカテゴリに割り当てられます。ウェブページの現在の言語に応じてこれらのカテゴリを作成するにはどうすればよいですか?
ありがとうございました。スパイキー
簡単な答え:カテゴリの翻訳はまだサポートされていません。回避策として、joomlaの文字列変換機能を使用できます。デザインの素早いタッチの言い訳:主な目標は、管理コードを変更せずに、バックエンドの管理者の翻訳を変更できるようにすることでした。以下の例では、ドイツ語を基本言語として使用しています。これは、次のことを意味します。
次の関数は、他の言語で正しい定数値を自動的に取得するのに役立ちます。
/**
* Remove umlauts and special chars.
*/
if(!function_exists('toASCII')) {
function toASCII($str) {
$str = mb_strtolower($str,'UTF-8'); // Useful if the current server setting is not UTF-8
//$str = strtolower($str);
$str = preg_replace( '#ß#' , "ss", $str ); // maps German ß onto ss
$str = preg_replace( '#ä#' , "ae", $str ); // Æ => AE
$str = preg_replace( '#ö#' , "oe", $str ); // Œ => OE
$str = preg_replace( '#ü#' , "ue", $str ); // œ => oe
$str = preg_replace( '#Ä#' , "ae", $str ); // Æ => AE
$str = preg_replace( '#Ö#' , "oe", $str ); // Œ => OE
$str = preg_replace( '#Ü#' , "ue", $str ); // œ => oe
$str = preg_replace( '# #' , "", $str ); // remove spaces
$str = preg_replace( '#-#' , "", $str ); // remove hyphens
$str = preg_replace( "#'#" , "", $str ); // remove apostrophs
$str = preg_replace( "#/#" , "", $str ); // remove apostrophs
$str = preg_replace( "#\(#" , "", $str ); // remove apostrophs
$str = preg_replace( "#\)#" , "", $str ); // remove apostrophs
$str = preg_replace( "#\.#" , "", $str ); // remove apostrophs
$str = preg_replace( "#,#" , "", $str ); // remove apostrophs
$str = preg_replace( "#\[#" , "", $str ); // remove apostrophs
$str = preg_replace( "#\]#" , "", $str ); // remove apostrophs
// Process all other special chars
$str = strtr(utf8_decode($str),
utf8_decode('ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ'),
'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy');
return strtoupper($str);
}
}
function translate($de_string) {
// Translate all JoomGallery category names
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$activeItemLanguage = $active->language;
$lang = substr($activeItemLanguage, 0, 2);
// Do not translate german category names
$trans_str = $de_string;
if ($lang != "de") {
// Parse all category names and replace them with an existing override-string.
$const = toASCII($trans_str);
$trans_str = JText::_($const);
}
return $trans_str;
}
使用方法:カテゴリ名を表示するテンプレートの文字列関数を置き換えます。
<?php echo translate($this->escape($row->name)); ?>
それ以外の
<?php echo $this->escape($row->name); ?>