Skip to content
Snippets Groups Projects
Unverified Commit d4e3a1cb authored by totten's avatar totten Committed by GitHub
Browse files

Merge pull request #24764 from eileenmcnaughton/runtime

Fix language negotiation exception to be standard
parents 3d86618f b3ba5388
Branches
Tags
No related merge requests found
......@@ -169,11 +169,12 @@ class Locale {
* Ex: `en_US`, `es_ES`, `fr_CA`
* @return \Civi\Core\Locale
* The effective locale specification.
* @throws \CRM_Core_Exception
*/
public static function negotiate(string $preferred): Locale {
// Create a locale for the requested language
if (!preg_match(';^[a-z][a-z]_[A-Z][A-Z]$;', $preferred)) {
throw new \RuntimeException("Cannot instantiate malformed locale: $preferred");
throw new \CRM_Core_Exception("Cannot instantiate malformed locale: $preferred");
}
$systemDefault = \Civi::settings()->get('lcMessages');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment