Language
[ class tree: Language ] [ index: Language ] [ all elements ]

Class: I18N_Messages_Translate

Source Location: /I18N-0.8.4/Messages/Translate.php

Class Overview

Tree_OptionsDB
   |
   --I18N_Messages_Translate

Description


Author(s):

Version:

  • 2001/12/29

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 33]
Description


[ Top ]


Class Variables

$options = array(   'tablePrefix' =>    'translate_',                               'sourceLanguage'=>  'en',                                                                                                       'translatorUrl' =>  ''                                       )

[line 36]


Type:   mixed


[ Top ]

$possibleMarkUpDelimiters = array(
                                                                                                                                                                                                                                                                   
                                                                        '>\s*'                          =>  '\s*<'          

                                                                                                                                                                                                                        ,'>[\s*&nbsp;]*'             =>  '[\s*&nbsp;]*<'


                                                                        ,'<\s*input .*value=["\']?\s*'  =>  '\s*["\']?.*>'

                                )

[line 57]

those are the delimiters that are used to look for text to translate inside

only text within those delimiters is translated this way we prevent from translating each HTML-tag, which definetly wouldnt work :-) those delimiters might also work on any other markup language, like xml - but not tested

NOTE: if you have php inside such a tag then you have to use an extra filter since <a href="">< ?=$var? ></a> would find the php-tags and see them as delimiters which results in < ?=$var? > can not be translated, see sf.net/projects/simpletpl, there is a filter in 'SimpleTemplate/Filter/Basic::applyTranslateFunction' which solves this it wraps a given function/method around it so that it finally will be: <a href="">< ?=translateThis($var)? ></a>


Type:   array


[ Top ]



Method Detail

I18N_Messages_Translate (Constructor)   [line 114]

I18N_Messages_Translate I18N_Messages_Translate( mixed $dsn, [mixed $options = array()])

for pre-ZE2 compatibility
  • Version:
  • Author:
  • Access: public

[ Top ]

getAll   [line 211]

array getAll( string $lang)

returns the DB content for the source and the destination language given as paramter $lang

Parameters:

string   $lang     iso-string for the destination language

[ Top ]

simpleTranslate   [line 129]

string simpleTranslate( string $string, string $lang)

tries to translate a given string, but only exactly the string as it is in the DB

Parameters:

string   $string     the string that shall be translated
string   $lang     iso-string for the destination language

[ Top ]

translate   [line 176]

string translate( string $string, string $lang)

tries to translate a given string, it also tries using the regexp's which might be in the DB

Parameters:

string   $string     the string that shall be translated
string   $lang     iso-string for the destination language

[ Top ]

translateMarkUpString   [line 264]

string translateMarkUpString( string $input, string $lang)

translates all the strings that match any of the source language-string the input is mostly an HTML-file, and it is filtered so only real text is translated, at least i try it as good as i can :-)

Parameters:

string   $input     the string that shall be translated, mostly an entire HTML-page
string   $lang     iso-string for the destination language

[ Top ]

__construct   [line 98]

void __construct( mixed $dsn, mixed $options)

  • Version:
  • Author:
  • Access: public

[ Top ]


Documentation generated on Fri, 30 Apr 2004 21:59:13 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.