Plugin Framework Function phrase()

public final function phrase(
$text, $replace = array()
)

Summary

Retrieves one of the Phrases for your Plugin.

Where You Can Use It

Can be used in methods called by plugins. From Zenario 7.0.0 onwards.

Description

Zenario is a multilingual CMS, so you should not hardcode Phrases into your Plugin code. Instead you should refer to all Phrases using Phrase-codes, and define their values in an xml file. This allows your Plugin to be translated into other languages by translating this file.

See the Plugin Phrases section for more information.

Parameters

$code

The codename of a Phrase to look up

$replace

The values of any merge fields that your Phrase uses, in the format key => value. May be omitted if your phrase has no merge fields (and most phrases tend not to).

Return Value

An escaped phrase in the visitor's local language.

Example

_WELCOME_NAME,"Welcome, [[name]]."
echo $this->phrase('_WELCOME_NAME', array('name' => htmlspecialchars($name)));

Displays the "_WELCOME_NAME" phrase, with [[name]] replaced by the contents of the $name variable. Note that this needs to be escaped, as the phrase is assumed to already be escaped.