diff --git a/WebFeedGatewayPlugin.php b/WebFeedGatewayPlugin.php index 10f3926..720a825 100644 --- a/WebFeedGatewayPlugin.php +++ b/WebFeedGatewayPlugin.php @@ -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 @@ -126,7 +128,8 @@ public function fetch($args, $request): bool 'latestDate' => $latestDate, 'feedUrl' => $request->getRequestUrl(), 'userGroups' => $userGroups, - 'includeIdentifiers' => $includeIdentifiers + 'includeIdentifiers' => $includeIdentifiers, + 'language' => str_replace('_', '-', str_replace(['@cyrillic', '@latin', '_Latn', '_Cyrl'], '', Locale::getLocale())), ] ) ->setHeaders(['content-type: ' . static::FEED_MIME_TYPE[$feedType] . '; charset=utf-8']) diff --git a/templates/rss.tpl b/templates/rss.tpl index 6b15c9e..faaa16a 100644 --- a/templates/rss.tpl +++ b/templates/rss.tpl @@ -37,7 +37,7 @@ {/if} {if $context->getPrimaryLocale()} - {$context->getPrimaryLocale()|replace:'_':'-'|strip|escape:"html"} + {$language|escape} {/if} {$context->getLocalizedName()|strip|escape:"html"} diff --git a/templates/rss2.tpl b/templates/rss2.tpl index e0b8565..b48cb6e 100644 --- a/templates/rss2.tpl +++ b/templates/rss2.tpl @@ -26,7 +26,7 @@ {* optional elements *} {if $context->getPrimaryLocale()} - {$context->getPrimaryLocale()|replace:'_':'-'|strip|escape:"html"} + {$language|escape} {/if} {if $context->getLocalizedData('licenseTerms')}