ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Jed.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Gettext\Generators;
4 
6 
7 class Jed extends PhpArray implements GeneratorInterface
8 {
12  public static function toString(Translations $translations)
13  {
14  $array = static::toArray($translations);
15 
16  return json_encode($array);
17  }
18 
22  protected static function buildArray(Translations $translations)
23  {
24  $array = array();
25 
26  $context_glue = "\004";
27 
28  foreach ($translations as $translation) {
29  $key = ($translation->hasContext() ? $translation->getContext().$context_glue : '').$translation->getOriginal();
30 
31  if ($translation->hasPluralTranslation()) {
32  $array[$key] = array_merge(array($translation->getTranslation()), $translation->getPluralTranslation());
33  } else {
34  $array[$key] = array($translation->getTranslation());
35  }
36  }
37 
38  return $array;
39  }
40 }
static buildArray(Translations $translations)
{}.
Definition: Jed.php:22
Class to manage a collection of translations.
static toString(Translations $translations)
{}.
Definition: Jed.php:12
toArray($value)
Wrap the given value in an array if it is no array.
$key
Definition: croninfo.php:18