eZ Publish  [4.0]
eztranslatorhandler.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZTranslatorHandler class
00004 //
00005 // Created on: <10-Jun-2002 11:05:00 amos>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file eztranslatorhandler.php
00032 */
00033 
00034 /*!
00035   \class eZTranslatorHandler eztranslatorhandler.php
00036   \ingroup eZTranslation
00037   \brief Base class for translation handling
00038 
00039 */
00040 
00041 class eZTranslatorHandler
00042 {
00043     /*!
00044      Constructor
00045     */
00046     function eZTranslatorHandler( $is_key_based )
00047     {
00048         $this->IsKeyBased = $is_key_based;
00049     }
00050 
00051     /*!
00052      \return true if the handler can lookup translations with translation keys.
00053 
00054     */
00055     function isKeyBased()
00056     {
00057         return $this->IsKeyBased;
00058     }
00059 
00060     /*!
00061      \pure
00062      \return the translation message for the key \a $key or null if the key does not exist.
00063 
00064      This function must overridden if isKeyBased() is true.
00065     */
00066     function findKey( $key )
00067     {
00068         return null;
00069     }
00070 
00071     /*!
00072      \pure
00073      \return the translation message for \a $source and \a $context or null if the key does not exist.
00074 
00075      If you know the translation key use findKey() instead.
00076 
00077      This function must overridden if isKeyBased() is true.
00078     */
00079     function findMessage( $context, $source, $comment = null )
00080     {
00081         return null;
00082     }
00083 
00084     /*!
00085      \pure
00086      \return the translation string for \a $source and \a $context or null if the translation does not exist.
00087 
00088      \sa findMessage, findKey
00089     */
00090     function translate( $context, $source, $comment = null )
00091     {
00092         return null;
00093     }
00094 
00095     /*!
00096      \pure
00097      \return the translation string for \a $key or null if the translation does not exist.
00098 
00099      \sa findMessage, findKey
00100     */
00101     function keyTranslate( $key )
00102     {
00103         return null;
00104     }
00105 
00106     /// \privatesection
00107     /// Tells whether the handler is key based or not
00108     public $IsKeyBased;
00109 }
00110 
00111 ?>