LimeSurvey API - Master branch

TranslationMoToJson
in package

Class for converting gettext MO files into JSON format.

Table of Contents

Properties

$language  : string

Methods

__construct()  : mixed
Initializes the translation service with the given language and creates a message source for the given language.
translateMoToJson()  : array<string|int, mixed>|string
Returns the translations from MO file, as array or in JSON format.

Properties

Methods

__construct()

Initializes the translation service with the given language and creates a message source for the given language.

public __construct(string $language) : mixed
Parameters
$language : string

the language abbreviation (e.g. 'de').

translateMoToJson()

Returns the translations from MO file, as array or in JSON format.

public translateMoToJson([bool $translateToJson = false ]) : array<string|int, mixed>|string
Parameters
$translateToJson : bool = false

containing the translations ("source_msg" => "translated_msg") or in case of error an array with an error message.

Return values
array<string|int, mixed>|string

The translated messages in JSON format or an array with an error message. ["source_msg" => "translated_msg"] ["error" => "error message..."]


        
On this page

Search results