Skip to content

Commit

Permalink
pkp/pkp-lib#9910 Use UI Language in Web Feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Jul 18, 2024
1 parent 1baa7f2 commit b4ca57f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion WebFeedGatewayPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
use Exception;
use PKP\category\Category;
use PKP\core\Registry;
use PKP\facades\Locale;
use PKP\i18n\LocaleConversion;
use PKP\plugins\GatewayPlugin;

class WebFeedGatewayPlugin extends GatewayPlugin
Expand Down Expand Up @@ -126,7 +128,8 @@ public function fetch($args, $request): bool
'latestDate' => $latestDate,
'feedUrl' => $request->getRequestUrl(),
'userGroups' => $userGroups,
'includeIdentifiers' => $includeIdentifiers
'includeIdentifiers' => $includeIdentifiers,
'language' => locale_get_region(Locale::getLocale()) ? locale_get_primary_language(Locale::getLocale()) . '-' . locale_get_region(Locale::getLocale()) : locale_get_primary_language(Locale::getLocale()),
]
)
->setHeaders(['content-type: ' . static::FEED_MIME_TYPE[$feedType] . '; charset=utf-8'])
Expand Down
2 changes: 1 addition & 1 deletion templates/rss.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{/if}

{if $context->getPrimaryLocale()}
<dc:language>{$context->getPrimaryLocale()|replace:'_':'-'|strip|escape:"html"}</dc:language>
<dc:language>{$language|escape}</dc:language>
{/if}

<prism:publicationName>{$context->getLocalizedName()|strip|escape:"html"}</prism:publicationName>
Expand Down
2 changes: 1 addition & 1 deletion templates/rss2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

{* optional elements *}
{if $context->getPrimaryLocale()}
<language>{$context->getPrimaryLocale()|replace:'_':'-'|strip|escape:"html"}</language>
<language>{$language|escape}</language>
{/if}

{if $context->getLocalizedData('licenseTerms')}
Expand Down

0 comments on commit b4ca57f

Please sign in to comment.