Skip to content

Commit

Permalink
Use article locale as a default for file locale
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnyga committed Mar 5, 2021
1 parent f0b8194 commit dda68ee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@
$fileSeq = 0;

for ($i = 1; $i <= $maxFiles; $i++) {

if (empty($article['fileLocale'.$i])) {
$fileLocale = $articleLocale;
} else {
$fileLocale = $locales[trim($article['fileLocale'.$i])];
}

if (!preg_match("@^https?://@", $article['file'.$i]) && $article['file'.$i] != "") {

Expand Down Expand Up @@ -274,7 +280,7 @@

# save galley data
$galleys[$fileId] = "\t\t\t\t<article_galley xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" locale=\"".$locales[trim($article['fileLocale'.$i])]."\" approved=\"false\" xsi:schemaLocation=\"http://pkp.sfu.ca native.xsd\">\r\n";
$galleys[$fileId] .= "\t\t\t\t\t<name locale=\"".$locales[trim($article['fileLocale'.$i])]."\">".$article['fileLabel'.$i]."</name>\r\n";
$galleys[$fileId] .= "\t\t\t\t\t<name locale=\"".$fileLocale."\">".$article['fileLabel'.$i]."</name>\r\n";

$galleys[$fileId] .= searchLocalisations('fileLabel'.$i, $article, 5, 'name');
$galleys[$fileId] .= "\t\t\t\t\t<seq>".$fileSeq."</seq>\r\n";
Expand All @@ -286,7 +292,7 @@
if (preg_match("@^https?://@", $article['file'.$i]) && $article['file'.$i] != "") {
# save remote galley data
$galleys[$fileId] = "\t\t\t\t<article_galley xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" locale=\"".$locales[trim($article['fileLocale'.$i])]."\" approved=\"false\" xsi:schemaLocation=\"http://pkp.sfu.ca native.xsd\">\r\n";
$galleys[$fileId] .= "\t\t\t\t\t<name locale=\"".$locales[$article['fileLocale'.$i]]."\">".$article['fileLabel'.$i]."</name>\r\n";
$galleys[$fileId] .= "\t\t\t\t\t<name locale=\"".$fileLocale."\">".$article['fileLabel'.$i]."</name>\r\n";
$galleys[$fileId] .= searchLocalisations('fileLabel'.$i, $article, 5, 'name');
$galleys[$fileId] .= "\t\t\t\t\t<seq>".$fileSeq."</seq>\r\n";
$galleys[$fileId] .= "\t\t\t\t\t<remote src=\"" . trim(htmlentities($article['file'.$i], ENT_XML1)) . "\" />\r\n";
Expand Down

0 comments on commit dda68ee

Please sign in to comment.