->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