ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
YamlDictionary.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Gettext\Extractors;
4 
7 
12 {
16  public static function fromString($string, Translations $translations = null, $file = '')
17  {
18  if ($translations === null) {
19  $translations = new Translations();
20  }
21 
22  $yml = new Parser();
23 
24  if (($entries = $yml->parse($string))) {
25  foreach ($entries as $original => $translation) {
26  $translations->insert(null, $original)->setTranslation($translation);
27  }
28  }
29 
30  return $translations;
31  }
32 }
Class to get gettext strings from plain json.
Class to manage a collection of translations.
Parser parses YAML strings to convert them to PHP arrays.
Definition: Parser.php:21
static fromString($string, Translations $translations=null, $file='')
{Parses a string and append the translations found in the Translations instance.The file path to inse...
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file