Skip to content

Commit

Permalink
Merge pull request #24738 from demeritcowboy/null-locale
Browse files Browse the repository at this point in the history
[NFC] Add code comment about null locale
  • Loading branch information
seamuslee001 authored Oct 14, 2022
2 parents 54c8d0e + f3c2d9d commit c7c6911
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CRM/Core/BAO/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ protected static function getTranslatedFieldsForRequest(AbstractAction $apiReque
// 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.
// @todo: Some scripts/unit tests don't set a language so nominal is null,
// so this then ends up retrieving all languages and then just picking
// one. Should it treat null in a better way? Should it be an explicit
// error not to have a language set?
$translations->addWhere('language', 'LIKE', substr($userLocale->nominal ?? '', 0, 2) . '%');
}
else {
Expand Down

0 comments on commit c7c6911

Please sign in to comment.