<?php

/*  Alternate WebKit
(C) 2011 by Alternate Tools
-----------------------------------------------------

File:         class_translation.php
Description:  Language translation module file

*/

if (!defined("CLASS_TRANSLATIONS"))
{
    define ("CLASS_TRANSLATIONS", "DEFINED");

    class cTranslation
    {

        var $m_transFile;
        
        function cTranslation()  // PHP 4
        {
           $m_transFile = "";
        }

        function __construct()
        {
           $m_transFile = "";
        }

        function SetTranslationFile($strFile)
        {
            $this->m_transFile = $strFile;
        }

        function GetTranslation($transString)
        {

            if (file_exists($this->m_transFile) == false)
                return "<b>Critical error: Translation file missing - " . $this->m_transFile;

            $transArray = parse_ini_file($this->m_transFile);
            if (isset($transArray[$transString]) == false || $transArray[$transString] == "")
                return "<b>Warning: Translation string missing - " . $transString;

            return $transArray[$transString];
        }
    }
}