-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathPo.php
More file actions
37 lines (32 loc) · 992 Bytes
/
Po.php
File metadata and controls
37 lines (32 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace Gettext\Languages\Exporter;
use Exception;
class Po extends Exporter
{
/**
* {@inheritdoc}
*
* @see \Gettext\Languages\Exporter\Exporter::getDescription()
*/
public static function getDescription()
{
return 'Build a string to be used for gettext .po files';
}
/**
* {@inheritdoc}
*
* @see \Gettext\Languages\Exporter\Exporter::toStringDoWithOptions()
*/
protected static function toStringDoWithOptions($languages, array $options)
{
if (count($languages) !== 1) {
throw new Exception('The ' . get_called_class() . ' exporter can only export one language');
}
$language = $languages[0];
$lines = array();
$lines[] = '"Language: ' . $language->id . '\n"';
$lines[] = '"Plural-Forms: nplurals=' . count($language->categories) . '; plural=' . $language->formula . '\n"';
$lines[] = '';
return implode("\n", $lines);
}
}