Did the locale conversion in upgrade from 3.3 to 3.5 miss Norwegian nb_NO?

We upgraded our multi-lingual large OJS site from 3.3.0.15 to 3.5.0.5 and the upgrade finished yesterday.

Looking in the locale settings in the database and in the ojs/locale directory, it has left nb_NO untouched. I would like to know if it was meant to be so, or if it is a mistake.

Example from journal_settings:

| 7724 | 89 | supportedFormLocales | [“da”,“en”,“nb_NO”,“sv”] | |

I am seeing these kinds of things in the apache error log:

[Thu Aug 27 15:04:39.026149 2026] [php:notice] [pid 1122560:tid 1122560] [client 216.73.217.117:7770] InvalidArgumentException: Invalid/unsupported locale “nb_NO”, default locale restored in /usr/local/ojs/lib/pkp/classes/
i18n/Locale.php:156

The config.inc.php locale is set to “en”.

I encountered a bug when I installed 3.5.0-5 today that sounds like it may be related to this. The details are highly technical and were only identified by claude code. I thought about filing an issue to fix it, but there are already 1.1k open issues. :roll_eyes:

The problem in my case is that lib/pkp/lib/weblateLanguages/languages.json is generated by fetching remotely and the OJS code no longer handles the results.

Specifically, Locale::setLocale() builds its ICU candidate list from the full key set of getWeblateLocaleNames():

languages.json` (generated from Weblate’s language-data CSV via PKP\dev\ComposerScript::weblateFilesDownload) includes the entry “und” — the BCP-47 reserved code for “undetermined language” — as if it were a real installable UI locale.

Once “und” is present anywhere in the $langtag array passed to PHP’s Locale::lookup(), the call returns null for the entire array, including exact matches like “en” that would otherwise resolve correctly. This was confirmed by bisection: adding entries from languages.json to a test array one at a time, Locale::lookup($acc, “en”, true) succeeds for 741 entries and flips to null the instant "und" is added — regardless of "en" already being present and matching.

This appears related to ICU’s internal handling of und as an alias for the root locale (see also php-src issue bugs.php.net #81383 re: Locale::lookup() incorrectly returning null). Since setLocale() has no fallback for a null result from Locale::lookup() in this build (\Locale::setDefault(\Locale::lookup(...)) with no ?: guard), this is fatal on every single request — the install is unusable until und is manually removed from languages.json.

That’s the solution I used, though a better fix would be to handle the unexpected locales in the code.

Hi all,

See:

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks Alec,
I have already before running the upgrade script applied the fix from #13139 (PR #13165) to our OJS 3.5.0-5 installation, since we are running PHP 8.4. The nb_NO issue I am reporting is separate: the 3.3 → 3.5 locale migration did not convert nb_NO as expected, or it should not be converted? (There are a few other locales that were not converted either, but those we don’t use.)

Hi @mirkh,

There are two related big changes we made with 3.5 as part of the CRAFT OA project (with heavy lifting from TSV in Finland):

  • #9707: Align UI locales with Weblate locales
  • #9425: Make submission language selection and metadata forms independent from website language settings

With these, we adopted the Weblate locale list for UI translations. However, for metadata, we stay with the ISO codes.

Weblate uses nb_NO for Bokmål; that’s non-standard but a long-standing practice. ISO 639-3 uses nob. (I raised this with the Weblate project without a resolution.)

Long story short: the use of nb_NO is not an oversight, and it’s frustrating that it’s out of spec!

Regards,
Alec Smecher
Public Knowledge Project Team