update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ abstract class FileDumper implements DumperInterface
if (!file_exists($fullpath)) {
$directory = \dirname($fullpath);
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
throw new RuntimeException(\sprintf('Unable to create directory "%s".', $directory));
}
}
+2 -5
View File
@@ -54,14 +54,11 @@ class MoFileDumper extends FileDumper
.$this->writeLong($offset[2] + $sourcesStart + $sourcesSize);
}
$output = implode('', array_map($this->writeLong(...), $header))
return implode('', array_map($this->writeLong(...), $header))
.$sourceOffsets
.$targetOffsets
.$sources
.$targets
;
return $output;
.$targets;
}
protected function getExtension(): string
+9 -9
View File
@@ -51,14 +51,14 @@ class PoFileDumper extends FileDumper
$sourceRules = $this->getStandardRules($source);
$targetRules = $this->getStandardRules($target);
if (2 == \count($sourceRules) && [] !== $targetRules) {
$output .= sprintf('msgid "%s"'."\n", $this->escape($sourceRules[0]));
$output .= sprintf('msgid_plural "%s"'."\n", $this->escape($sourceRules[1]));
$output .= \sprintf('msgid "%s"'."\n", $this->escape($sourceRules[0]));
$output .= \sprintf('msgid_plural "%s"'."\n", $this->escape($sourceRules[1]));
foreach ($targetRules as $i => $targetRule) {
$output .= sprintf('msgstr[%d] "%s"'."\n", $i, $this->escape($targetRule));
$output .= \sprintf('msgstr[%d] "%s"'."\n", $i, $this->escape($targetRule));
}
} else {
$output .= sprintf('msgid "%s"'."\n", $this->escape($source));
$output .= sprintf('msgstr "%s"'."\n", $this->escape($target));
$output .= \sprintf('msgid "%s"'."\n", $this->escape($source));
$output .= \sprintf('msgstr "%s"'."\n", $this->escape($target));
}
}
@@ -100,9 +100,9 @@ EOF;
if (preg_match($intervalRegexp, $part)) {
// Explicit rule is not a standard rule.
return [];
} else {
$standardRules[] = $part;
}
}
$standardRules[] = $part;
}
return $standardRules;
@@ -123,7 +123,7 @@ EOF;
$output = null;
foreach ((array) $comments as $comment) {
$output .= sprintf('#%s %s'."\n", $prefix, $comment);
$output .= \sprintf('#%s %s'."\n", $prefix, $comment);
}
return $output;
+7 -1
View File
@@ -46,7 +46,7 @@ class XliffFileDumper extends FileDumper
return $this->dumpXliff2($defaultLocale, $messages, $domain);
}
throw new InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
throw new InvalidArgumentException(\sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
}
protected function getExtension(): string
@@ -193,6 +193,12 @@ class XliffFileDumper extends FileDumper
$segment = $translation->appendChild($dom->createElement('segment'));
if ($this->hasMetadataArrayInfo('segment-attributes', $metadata)) {
foreach ($metadata['segment-attributes'] as $name => $value) {
$segment->setAttribute($name, $value);
}
}
$s = $segment->appendChild($dom->createElement('source'));
$s->appendChild($dom->createTextNode($source));
+3 -5
View File
@@ -23,11 +23,9 @@ use Symfony\Component\Yaml\Yaml;
*/
class YamlFileDumper extends FileDumper
{
private string $extension;
public function __construct(string $extension = 'yml')
{
$this->extension = $extension;
public function __construct(
private string $extension = 'yml',
) {
}
public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string