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

Class: Translation2_Decorator_DefaultText

Source Location: /Translation2-2.0.0beta7/Decorator/DefaultText.php

Class Overview

Translation2_Decorator
   |
   --Translation2_Decorator_DefaultText

Decorator to provide a fallback text for empty strings.


Author(s):

Version:

  • CVS: $Id: DefaultText.php,v 1.9 2005/03/08 23:23:56 quipo Exp $

Copyright:

  • 2004-2005 Lorenzo Alberton, Rolf 'Red' Ochsenbein

Variables

Methods


Inherited Variables

Inherited Methods

Class: Translation2_Decorator

Translation2_Decorator::Translation2_Decorator()
Constructor
Translation2_Decorator::get()
Get translated string
Translation2_Decorator::getDecorator()
Return an instance of a decorator
Translation2_Decorator::getLang()
get lang info
Translation2_Decorator::getLangs()
get langs
Translation2_Decorator::getPage()
Same as getRawPage, but resort to fallback language and replace parameters when needed
Translation2_Decorator::getRaw()
Get translated string
Translation2_Decorator::getRawPage()
Get the array of strings in a page
Translation2_Decorator::getStringID()
Get the stringID for the given string. This method is the reverse of get().
Translation2_Decorator::replaceEmptyStringsWithKeys()
Replace empty strings with their stringID
Translation2_Decorator::setContainerOptions()
Set some storage driver options
Translation2_Decorator::setLang()
Set default lang
Translation2_Decorator::setOption()
set Decorator option
Translation2_Decorator::setOptions()
set Decorator options
Translation2_Decorator::setPageID()
Set default page
Translation2_Decorator::setParams()
Set parameters for next string
Translation2_Decorator::translate()
Get translated string
Translation2_Decorator::_replaceParams()
Replace parameters in strings
Translation2_Decorator::__clone()
Clone internal object references

Class Details

[line 47]
Decorator to provide a fallback text for empty strings.

If the string is empty, return the <parameter>defaultText</parameter> parameter. If the <parameter>defaultText</parameter> parameter is empty too, then return &quot;$emptyPostfix.$outputString.$emptyPrefix&quot;, the three variables being class properties you can set to a custom string.



[ Top ]


Class Variables

$emptyPostfix =  ''

[line 58]

String appended to the returned string when the string is empty and it's replaced by its $stringID. It can be used to mark unreplaced strings.
  • Access: protected

Type:   string


[ Top ]

$emptyPrefix =  ''

[line 67]

String prepended to the returned string when the string is empty and it's replaced by its $stringID. It can be used to mark unreplaced strings.
  • Access: protected

Type:   string


[ Top ]

$outputString =  '%stringID%'

[line 78]

String to output when there was no translation

%stringID% will be replaced with the stringID %stringID_url% will replaced with a urlencoded stringID %url% will be replaced with the targeted url

  • Access: protected

Type:   string


[ Top ]

$url =  '#'

[line 85]

Targeted URL of strings without translations
  • Access: protected

Type:   string


[ Top ]



Method Detail

get   [line 102]

string get( string $stringID, [string $pageID = TRANSLATION2_DEFAULT_PAGEID], [string $langID = null], [string $defaultText = ''])

Get translated string

If the string is empty, return the $defaultText if not empty, the $stringID otherwise.


Overrides Translation2_Decorator::get() (Get translated string)

Parameters:

string   $stringID   — 
string   $pageID   — 
string   $langID   — 
string   $defaultText   —  Text to display when the string is empty

[ Top ]

getPage   [line 142]

array getPage( [string $pageID = TRANSLATION2_DEFAULT_PAGEID], [string $langID = null])

Replace empty strings with their $stringID

Overrides Translation2_Decorator::getPage() (Same as getRawPage, but resort to fallback language and replace parameters when needed)

Parameters:

string   $pageID   — 
string   $langID   — 

[ Top ]

getStringID   [line 162]

string &getStringID( string $string, [string $pageID = TRANSLATION2_DEFAULT_PAGEID])

Get the stringID for the given string. This method is the reverse of get().

If the requested string is unknown to the system, the requested string will be returned.


Overrides Translation2_Decorator::getStringID() (Get the stringID for the given string. This method is the reverse of get().)

Parameters:

string   $string   —  This is NOT the stringID, this is a real string. The method will search for its matching stringID, and then it will return the associate string in the selected language.
string   $pageID   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:18:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.