Ancient switch statement that provides hardcoded translation doesn't do anything anymore
@bgm FYI since you might find this academically interesting since it's like "Translation Archaeology".
These lines do nothing: https://github.com/civicrm/civicrm-core/blob/5.22.1/CRM/Activity/Selector/Activity.php#L397-L420
Except for a code-format whitespace change, these lines are unchanged from when they were added 13 years ago and predates the concept of option value labels and was likely added when translation capability was first being added. The comment even still says "DRAFTING".
In particular note that $row['activity_type'] here is the LABEL
for the option value. So this switch() doesn't do anything. Here's a table:
Scenario | Effect of the switch() |
---|---|
US English | Does nothing |
UK English, labels and names are the same | Does nothing |
UK English, labels and names are different | Almost never does anything (see next scenario) |
UK English, but for example the label for activity type Meeting has been changed to Email. I don't know why anyone would do that though. | It would translate Email to Email since it's english, so still does nothing. |
Non-english, and the label is non-english. | Does nothing |
Non-english, but you've for some reason changed the label for e.g. Email back to english. But why would you do that? | It will translate it, but in this situation that's a bug because you changed the label to english on purpose because you wanted english, for whatever reason. |
Extra
What's also interesting but is a separate TODO that I'm not going to look closer at right now: I'm not 100% sure when this code even runs. You can trigger it by visiting manage case if the client has some non-case activities, but I don't know why it's even retrieving those non-case activities when you're looking at manage case. And the function is NOT called when looking at a contact's activity tab. It does NOT run when showing results for an activity search.
For manage case it's called from Case_Page_Tab which calls Core_Select_Controller(output = SESSION). Note that getRows isn't returning any case activities, just the non-case ones. The actual rows you see on manage case come from CRM/Case/Form/ActivityTab.tpl via ajax call to civicrm/ajax/activity, which is CRM_Activity_Page_AJAX::getCaseActivity()