Skip to content

Commit

Permalink
Update translation tool to fetch also the name, summary and descripti…
Browse files Browse the repository at this point in the history
…on from the info.xml

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
  • Loading branch information
MorrisJobke committed May 23, 2018
1 parent fc574d0 commit fc4c831
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion translations/translationtool/src/translationtool.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private function createFakeFileForAppInfo() {
if ($xml->name) {
$strings[] = $xml->name->__toString();
}

if ($xml->navigations) {
foreach ($xml->navigations as $navigation) {
$name = $navigation->navigation->name->__toString();
Expand All @@ -225,6 +225,60 @@ private function createFakeFileForAppInfo() {
}
}
}

if ($xml->name) {
if ($xml->name->count() > 1) {
foreach ($xml->name as $name) {
if ((string)$name->attributes()->lang === 'en') {
$name = $name->__toString();
if (!in_array($name, $strings)) {
$strings[] = $name;
}
}
}
} else {
$name = $xml->name->__toString();
if (!in_array($name, $strings)) {
$strings[] = $name;
}
}
}

if ($xml->summary) {
if ($xml->summary->count() > 1) {
foreach ($xml->summary as $summary) {
if ((string)$summary->attributes()->lang === 'en') {
$name = $summary->__toString();
if (!in_array($name, $strings)) {
$strings[] = $name;
}
}
}
} else {
$name = $xml->summary->__toString();
if (!in_array($name, $strings)) {
$strings[] = $name;
}
}
}

if ($xml->description) {
if ($xml->description->count() > 1) {
foreach ($xml->description as $description) {
if ((string)$description->attributes()->lang === 'en') {
$name = $description->__toString();
if (!in_array($name, $strings)) {
$strings[] = trim($name);
}
}
}
} else {
$name = $xml->description->__toString();
if (!in_array($name, $strings)) {
$strings[] = trim($name);
}
}
}

$content = '<?php' . PHP_EOL;
foreach ($strings as $string) {
Expand Down
Binary file modified translations/translationtool/translationtool.phar
Binary file not shown.

0 comments on commit fc4c831

Please sign in to comment.