<?php
// $Id: language_local.php,v 1.1 2006/09/15 14:02:08 ohwada Exp $

// 2006-09-10 K.OHWADA
// this is new file
// porting form weblinks_language_convert.php


//=========================================================
// Happy Linux Framework Module
// 2006-09-10 K.OHWADA
//=========================================================

//=========================================================
// class happy_linux_language_local
// for japanese
//=========================================================
class happy_linux_language_local extends happy_linux_language
{
	var $_server;

//---------------------------------------------------------
// constructor
//---------------------------------------------------------
function happy_linux_language_local()
{
	$this->happy_linux_language();

	$this->_server =& happy_linux_server::getInstance();
}

function &getInstance()
{
	static $instance;
	if (!isset($instance)) 
	{
		$instance = new happy_linux_language_local();
	}

	return $instance;
}

//---------------------------------------------------------
// function
//---------------------------------------------------------
function convert_telafriend_subject($text)
{
	return $this->_convert_sjis_win_mac($text);
}

function convert_telafriend_body($text)
{
	return $this->_convert_sjis_win_mac($text);
}

function convert_download_filename($text)
{
	return $this->_convert_sjis_win_mac($text);
}

function get_country()
{
	return "japan";
}

function get_google_url()
{
	return "http://www.google.co.jp/search?hl=ja&amp;q=";
}

function get_happy_linux_url()
{
	return "http://linux.ohwada.jp/";
}

//---------------------------------------------------------
// private
//---------------------------------------------------------
function _convert_sjis_win_mac($str)
{
	$this->_server->presume_agent();
	$os = $this->_server->get_os();
	if (($os == 'win')||($os == 'mac'))
	{
		$str = $this->_convert_eucjp_to_sjis($str);
	}
	return $str;
}

function _convert_eucjp_to_sjis($str)
{
	if ( function_exists('mb_convert_encoding') )
	{
		$str = mb_convert_encoding($str, 'SJIS', 'EUC-JP');
	}
	return $str;
}

// --- class end ---
}

?>