Skip to content

Commit fbbe139

Browse files
committed
i18n: set the domain for a theme if it is missing (#2392)
* i18n: set the domain for a theme if it is missing If there is no header in the po file then it was not being found for a theme. This PR allows po files to exist without any header such as the below. msgid "" msgstr "" "X-Domain: worldpeace\n" * lint * changelog
1 parent d9a085c commit fbbe139

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

docs/simplesamlphp-changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ See the [upgrade notes](https://simplesamlphp.org/docs/stable/simplesamlphp-upgr
99

1010
Released TBD
1111

12+
## Version 2.3.7
13+
14+
Released TBD
15+
16+
* Fixed loading translations for themes where there is no explicit X-Domain set in the po file.
17+
18+
## Version 2.3.6
19+
20+
Released 2025-02-17
21+
1222
* Fixed PHP 8.4 deprecation notices
1323
* Fixed infinite recursion (#2367)
1424
* Added a new feature flag `encryption.optional` to allow unencrypted assertions if the SP does

src/SimpleSAML/Locale/Localization.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ private function loadGettextGettextFromPO(
265265
$file = new File($langPath . $domain . '.po', false);
266266
if ($file->getRealPath() !== false && $file->isReadable()) {
267267
$translations = (new PoLoader())->loadFile($file->getRealPath());
268+
if (empty($translations->getDomain())) {
269+
$translations->setDomain($domain);
270+
}
268271
$arrayGenerator = new ArrayGenerator();
269272
$this->translator->addTranslations(
270273
$arrayGenerator->generateArray($translations),

0 commit comments

Comments
 (0)