VuFind API Documentation

JsTranslations extends AbstractJsStrings
in package

JsTranslations helper for passing translation text to Javascript

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$strings  : array<string|int, mixed>
Strings to convey (key = js key, value = value to map)
$transEsc  : TransEsc
Translate + escape helper
$translate  : Translate
Translate helper
$varName  : string
Variable name to store values
__construct()  : mixed
Constructor
addStrings()  : void
Add strings to the internal array.
getJSON()  : string
Generate JSON from the internal strings
getJSONFromArray()  : string
Generate JSON from an array
getScript()  : string
Assign JSON to a variable.
mapValue()  : string
Translate string

Properties

$strings

Strings to convey (key = js key, value = value to map)

protected array<string|int, mixed> $strings = []

Methods

__construct()

Constructor

public __construct(Translate $translate, TransEsc $transEsc[, string $varName = 'vufindString' ]) : mixed
Parameters
$translate : Translate

Translate helper

$transEsc : TransEsc

Translate + escape helper

$varName : string = 'vufindString'

Variable name to store translations

Return values
mixed

addStrings()

Add strings to the internal array.

public addStrings(array<string|int, mixed> $new) : void
Parameters
$new : array<string|int, mixed>

Strings to add

Return values
void

getJSON()

Generate JSON from the internal strings

public getJSON() : string
Return values
string

getJSONFromArray()

Generate JSON from an array

public getJSONFromArray(array<string|int, mixed> $strings) : string
Parameters
$strings : array<string|int, mixed>

Strings to convey (key = js key, value = value to map)

Return values
string

getScript()

Assign JSON to a variable.

public getScript() : string
Return values
string

mapValue()

Translate string

protected mapValue(string|array<string|int, mixed> $translation, string $key) : string
Parameters
$translation : string|array<string|int, mixed>

String to translate

$key : string

JSON object key

Return values
string

Search results