101t / php-languages-hook

The easy way to translate your website in PHP as hooking file for every language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php-languages-hook

Build Status

The easy way to translate your website in PHP to hook all language files It is based on Key => Value dictionary array for every language.

Getting Started

First of all define your default website language inside of class.translate.php

$default_lang = "tr";

then go to your code and translate it

<?php 
include_once(dirname(__FILE__)."/class.translate.php");

if (isset($_GET["lang"])) {
	$_SESSION['lang'] = $_GET["lang"];
}
echo $translate->_("Hello World"); echo "<br>";
echo $translate->_("Welcome");
?>

and then you could define your languages bar option (optional)

<?php 
	foreach ($translate->languages() as $key => $value) {
		echo "<a href=\"index.php?lang=".$key."\">".$value."</a>&nbsp;";
	}
?>

then go to /lang/hooks/ directory and create your custome language based on two standart variables, and do not forget rename it as 2 characters language code e.g. it.php for italian language.

$name = "YOURLANGUAGENAME";
$hook = array("KEYWORDS" => "VALUEWORDSOFMEANING");

that is all.

License

GNU © Tarek Kalaji

About

The easy way to translate your website in PHP as hooking file for every language


Languages

Language:PHP 100.0%