Repository: data-for-change/anyway
Issue: Localization after cache does not work in  localization in accident_count_by_accident_year and injured_count_by_accident_year[Bug]

Localization after cache does not work in  localization in accident_count_by_accident_year and injured_count_by_accident_year[Bug]

**To Reproduce**
Steps to reproduce the behavior:
1.Run: www.anyway.co.il/api/infographics-data?news_flash_id=16577&years_ago=5&lang=he
2. `localized_name` remains in English
**Expected behavior**
Should be in Hebrew


Changed files:
anyway/infographics_utils.py

diff --git a/anyway/infographics_utils.py b/anyway/infographics_utils.py
index a1f3ceef..630c4678 100755
--- a/anyway/infographics_utils.py
+++ b/anyway/infographics_utils.py
@@ -592,8 +592,7 @@ class AccidentCountByAccidentYearWidget(SubUrbanWidget):
         super().__init__(request_params, type(self).name)
         self.rank = 8
         self.text = {
-            # "title" will be set in localize_items()
-            "labels": gen_entity_labels(AccidentSeverity)
+            # "title" and "labels" will be set in localize_items()
         }
         self.information = "Fatal, severe and light accidents count in the specified years, split by accident severity"
 
@@ -619,10 +618,12 @@ class AccidentCountByAccidentYearWidget(SubUrbanWidget):
 
     @staticmethod
     def localize_items(request_params: RequestParams, items: Dict) -> Dict:
-        items["data"]["text"]["title"] =\\
-            _("Number of accidents, by year, splitted by accident severity, in segment")\\
-            + " "\\
-            + segment_dictionary[request_params.location_info["road_segment_name"]]
+        items["data"]["text"] = {
+            "title": _("Number of accidents, by year, splitted by accident severity, in segment")
+                     + " "
+                     + segment_dictionary[request_params.location_info["road_segment_name"]],
+            "labels": gen_entity_labels(AccidentSeverity)
+        }
         return items
 
 
@@ -634,8 +635,7 @@ class InjuredCountByAccidentYearWidget(SubUrbanWidget):
         super().__init__(request_params, type(self).name)
         self.rank = 9
         self.text = {
-            # "title" will be set in localize_items()
-            "labels": gen_entity_labels(InjurySeverity)
+            # "title" and "labels" will be set in localize_items()
         }
         self.information = "Fatal, severe and light injured count in the specified years, split by injury severity"
 
@@ -660,10 +660,12 @@ class InjuredCountByAccidentYearWidget(SubUrbanWidget):
 
     @staticmethod
     def localize_items(request_params: RequestParams, items: Dict) -> Dict:
-        items["data"]["text"]["title"] =\\
-            _("Number of injured in accidents, per year, splitted by severity, in segment")\\
-            + " "\\
-            + segment_dictionary[request_params.location_info["road_segment_name"]]
+        items["data"]["text"] = {
+            "title": _("Number of injured in accidents, per year, splitted by severity, in segment")
+                     + " "
+                     + segment_dictionary[request_params.location_info["road_segment_name"]],
+            "labels": gen_entity_labels(InjurySeverity)
+        }
         return items