Skip to content
Snippets Groups Projects
Commit e6d43802 authored by Seamus Lee's avatar Seamus Lee
Browse files

[REF] Fix passing null into string functions in translation BAO

parent eb4a92db
Branches
Tags
No related merge requests found
......@@ -218,12 +218,12 @@ class CRM_Core_BAO_Translation extends CRM_Core_DAO_Translation implements HookI
->addWhere('entity_table', '=', CRM_Core_DAO_AllCoreTables::getTableForEntityName($apiRequest['entity']))
->setCheckPermissions(FALSE)
->setSelect(['entity_field', 'entity_id', 'string', 'language']);
if ((substr($userLocale->nominal, '-3', '3') !== '_NO')) {
if ((substr($userLocale->nominal ?? '', '-3', '3') !== '_NO')) {
// Generally we want to check for any translations of the base language
// and prefer, for example, French French over US English for French Canadians.
// Sites that genuinely want to cater to both will add translations for both
// and we work through preferences below.
$translations->addWhere('language', 'LIKE', substr($userLocale->nominal, 0, 2) . '%');
$translations->addWhere('language', 'LIKE', substr($userLocale->nominal ?? '', 0, 2) . '%');
}
else {
// And here we have ... the Norwegians. They have three main variants which
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment