ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Gettext\Generators\JsonDictionary Class Reference
+ Inheritance diagram for Gettext\Generators\JsonDictionary:
+ Collaboration diagram for Gettext\Generators\JsonDictionary:

Static Public Member Functions

static toString (Translations $translations)
 {@parentDoc}. More...
 
- Static Public Member Functions inherited from Gettext\Generators\Generator
static toFile (Translations $translations, $file)
 Saves the translations in a file. More...
 
- Static Public Member Functions inherited from Gettext\Generators\GeneratorInterface
static toFile (Translations $translations, $file)
 Saves the translations in a file. More...
 
static toString (Translations $translations)
 Generates a string with the translations ready to save in a file. More...
 

Static Public Attributes

static $options = 0
 

Detailed Description

Definition at line 7 of file JsonDictionary.php.

Member Function Documentation

◆ toString()

static Gettext\Generators\JsonDictionary::toString ( Translations  $translations)
static

{@parentDoc}.

Implements Gettext\Generators\GeneratorInterface.

Definition at line 14 of file JsonDictionary.php.

15 {
16 $array = PhpArray::toArray($translations);
17
18 //for a simple json translation dictionary, one domain is supported
19 $values = current($array);
20
21 // remove meta / header data
22 if (array_key_exists('', $values)) {
23 unset($values['']);
24 }
25
26 //map to a simple json dictionary (no plurals)
27 return json_encode(
28 array_filter(
29 array_map(function ($val) {
30 return isset($val[1]) ? $val[1] : null;
31 }, $values)
32 ),
34 );
35 }
toArray($value)
Wrap the given value in an array if it is no array.

References Gettext\Generators\JsonDictionary\$options, and ILIAS\UI\Implementation\Component\toArray().

+ Here is the call graph for this function:

Field Documentation

◆ $options

Gettext\Generators\JsonDictionary::$options = 0
static

Definition at line 9 of file JsonDictionary.php.

Referenced by Gettext\Generators\JsonDictionary\toString().


The documentation for this class was generated from the following file: