From b6f4276c6cc2e5a53f0a4afb1536960427fa995e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 6 Oct 2025 15:09:01 -0400 Subject: Change regional language codes (#8065) * Change regional language codes According to `ISO-639-1` and `ISO-3166-1 alpha-2` recommendations, regional languages must be written with the language code in lowercase and the region in uppercase. For instance, we should have `en-US` instead of `en-us`. Folders have been updated to reflect those recommendations and regional language codes have been updated in the translation files. * Update README files * Fix configuration for typos * Revert language order in documentation * Remove unnecessary code * Change language configuration getter * Fix phpstan error * Fix typo * Add types * escape regex * Move language logic to avoid magic or deprecated methods * Minor fix on regex --- app/Models/Context.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/Models/Context.php') diff --git a/app/Models/Context.php b/app/Models/Context.php index 1dccff6f6..d6942fbcd 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -160,6 +160,12 @@ final class FreshRSS_Context { FreshRSS_Context::$user_conf->shortcuts = $shortcuts; FreshRSS_Context::$user_conf->save(); } + + FreshRSS_Context::$user_conf->language = preg_replace_callback( + '/-(\\w{2})$/', + static fn (array $matches): string => strtoupper($matches[0]), + FreshRSS_Context::$user_conf->language ?? Minz_Translate::DEFAULT_LANGUAGE + ) ?? Minz_Translate::DEFAULT_LANGUAGE; } /** -- cgit v1.2.3