ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 {}. 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 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

{}.

Implements Gettext\Generators\GeneratorInterface.

Definition at line 14 of file JsonDictionary.php.

References PHPMailer\PHPMailer\$options, $values, and Gettext\Generators\PhpArray\toArray().

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  }
static toArray(Translations $translations)
Generates an array with the translations.
Definition: PhpArray.php:26
$values
+ 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.


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