ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
CsvDictionary.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Gettext\Generators
;
4
5
use
Gettext\Translations
;
6
7
class
CsvDictionary
extends
Generator
implements
GeneratorInterface
8
{
12
public
static
function
toString
(
Translations
$translations)
13
{
14
$array =
PhpArray::toArray
($translations);
15
16
//for a simple json translation dictionary, one domain is supported
17
$values = current($array);
18
19
// remove meta / header data
20
if
(array_key_exists(
''
, $values)) {
21
unset($values[
''
]);
22
}
23
24
$handle = fopen(
'php://memory'
,
'w'
);
25
26
//map to a simple csv dictionary (no plurals)
27
foreach
($values as $original => $translated) {
28
if
(!isset($translated[1])) {
29
$translated[1] =
''
;
30
}
31
fputcsv($handle,
array
($original, $translated[1]));
32
}
33
34
rewind($handle);
35
$csv = stream_get_contents($handle);
36
37
fclose($handle);
38
39
return
$csv;
40
}
41
}
Gettext\Generators\Generator
Definition:
Generator.php:7
Gettext\Generators\GeneratorInterface
Definition:
GeneratorInterface.php:7
Gettext\Generators\PhpArray\toArray
static toArray(Translations $translations)
Generates an array with the translations.
Definition:
PhpArray.php:26
Translations
Gettext\Translations
Class to manage a collection of translations.
Definition:
Translations.php:11
Gettext\Generators
Definition:
CsvDictionary.php:3
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
Gettext\Generators\CsvDictionary
Definition:
CsvDictionary.php:7
Gettext\Generators\CsvDictionary\toString
static toString(Translations $translations)
{}.
Definition:
CsvDictionary.php:12
libs
composer
vendor
gettext
gettext
src
Generators
CsvDictionary.php
Generated on Sat Jan 18 2025 19:01:04 for ILIAS by
1.8.13 (using
Doxyfile
)