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

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...
 

Detailed Description

Definition at line 8 of file YamlDictionary.php.

Member Function Documentation

◆ toString()

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

{}.

Implements Gettext\Generators\GeneratorInterface.

Definition at line 13 of file YamlDictionary.php.

References $output, and Gettext\Generators\PhpArray\toArray().

14  {
15  $array = PhpArray::toArray($translations);
16 
17  //for a simple json translation dictionary, one domain is supported
18  $values = current($array);
19 
20  // remove meta / header data
21  if (array_key_exists('', $values)) {
22  unset($values['']);
23  }
24 
25  //map to a simple yml dictionary (no plurals)
26  $yml = new Dumper();
27  $output = $yml->dump(
28  array_map(
29  function ($val) {
30  return isset($val[1]) ? $val[1] : null;
31  },
32  $values
33  ),
34  1
35  );
36 
37  return $output;
38  }
static toArray(Translations $translations)
Generates an array with the translations.
Definition: PhpArray.php:26
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
+ Here is the call graph for this function:

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