Skip to content

Commit

Permalink
Merge pull request data-for-change#2505 from data-for-change/modify-t…
Browse files Browse the repository at this point in the history
…itles

modify titles and subtitles
  • Loading branch information
atalyaalon authored Dec 20, 2023
2 parents 96bc426 + 6dcb61f commit dfca9c4
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def get_most_severe_accidents_table_title(
location_info: dict, resolution: BE_CONST.ResolutionCategories
):
if resolution == BE_CONST.ResolutionCategories.SUBURBAN_ROAD:
return "Most severe accidents in segment", segment_dictionary[location_info["road_segment_name"]]
return _("Severe accidents"), f'{_("in segment")} {_(segment_dictionary[location_info["road_segment_name"]])}'
elif resolution == BE_CONST.ResolutionCategories.SUBURBAN_JUNCTION:
return "Severe accidents in suburban junction", f" {location_info['non_urban_intersection_hebrew']}"
return _("Severe accidents"), f"{_('in')}{location_info['non_urban_intersection_hebrew']}"
elif resolution == BE_CONST.ResolutionCategories.STREET:
in_str = _("in")
return "Severe accidents in street", f" {location_info['street1_hebrew']} {in_str}{location_info['yishuv_name']}"
return _("Severe accidents"), f"{_('in street')} {location_info['street1_hebrew']} {in_str}{location_info['yishuv_name']}"

# count of dead and severely injured
def get_casualties_count_in_accident(accident_id, provider_code, injury_severity, accident_year):
Expand Down Expand Up @@ -210,8 +210,8 @@ def localize_items(request_params: RequestParams, items: Dict) -> Dict:
title, subtitle = get_most_severe_accidents_table_title(request_params.location_info,
request_params.resolution)
items["data"]["text"] = {
"title": _(title),
"subtitle": _(subtitle),
"title": title,
"subtitle": subtitle,
"transcription": MostSevereAccidentsTableWidget.get_transcription(request_params=request_params,
items=items["data"]["items"])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def get_accident_count_by_accident_type(location_info, start_time, end_time):

@staticmethod
def localize_items(request_params: RequestParams, items: Dict) -> Dict:
items["data"]["text"] = {"title": _("Number of accidents by accident type")}
items["data"]["text"] = {"title": _("Number of accidents by accident type"),
"subtitle": f'{_("in segment")} {_(request_params.location_info["road_segment_name"])}'}
for item in items["data"]["items"]:
to_translate = item["accident_type"]
item["accident_type"] = _(to_translate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def generate_items(self) -> None:
@staticmethod
def localize_items(request_params: RequestParams, items: Dict) -> Dict:
items["data"]["text"] = {
"title": _("Accidents in segment"),
"subtitle": _(segment_dictionary[request_params.location_info["road_segment_name"]]),
"title": _("Number of accidents, per year, split by severity"),
"subtitle": f'{_("in segment")} {_(segment_dictionary[request_params.location_info["road_segment_name"]])}',
"labels_map": gen_entity_labels(AccidentSeverity),
}
return items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def generate_items(self) -> None:

@staticmethod
def localize_items(request_params: RequestParams, items: Dict) -> Dict:
items["data"]["text"] = {"title": _("Accidents by time")}
items["data"]["text"] = {"title": _("Accidents by time"),
"subtitle": f'{_("in segment")} {_(request_params.location_info["road_segment_name"])}'}
return items


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def localize_items(request_params: RequestParams, items: Dict) -> Dict:
logging.exception(
f"AccidentCountByDriverTypeWidget.localize_items: Exception while translating {item}."
)
items["data"]["text"] = {"title": _("Number of accidents by driver type")}
items["data"]["text"] = {"title": _("Number of accidents by driver type"),
"subtitle": f'{_("in segment")} {_(request_params.location_info["road_segment_name"])}'}
return items


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def generate_items(self) -> None:
def localize_items(request_params: RequestParams, items: Dict) -> Dict:
items["data"]["text"] = {
"title": _("Injury per age group"),
"subtitle": _(request_params.location_info["road_segment_name"]),
"subtitle": f'{_("in segment")} {_(request_params.location_info["road_segment_name"])}',
}
return items
31 changes: 16 additions & 15 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-09-14 15:58+0300\n"
"POT-Creation-Date: 2023-12-19 21:10+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -263,15 +263,12 @@ msgid "Number of accidents by severity"
msgstr ""

#: anyway/widgets/all_locations_widgets/accident_count_by_severity_widget.py:123
#: anyway/widgets/road_segment_widgets/accident_count_by_accident_year_widget.py:57
#: anyway/widgets/road_segment_widgets/accident_count_by_car_type_widget.py:145
#: anyway/widgets/road_segment_widgets/accident_count_by_hour_widget.py:31
#: anyway/widgets/road_segment_widgets/accident_count_by_road_light_widget.py:33
#: anyway/widgets/road_segment_widgets/accidents_heat_map_widget.py:54
#: anyway/widgets/road_segment_widgets/injured_count_by_accident_year_widget.py:56
#: anyway/widgets/road_segment_widgets/injured_count_by_severity_widget.py:133
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_stacked_widget.py:53
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:50
#: anyway/widgets/road_segment_widgets/suburban_crosswalk_widget.py:73
msgid "road_segment_name"
msgstr ""
Expand Down Expand Up @@ -316,6 +313,12 @@ msgstr ""
msgid "Fatal, severe and light accidents count in the specified location."
msgstr ""

#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:47
#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:49
#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:52
msgid "Severe accidents"
msgstr ""

#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:51
#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:226
msgid "in"
Expand Down Expand Up @@ -407,18 +410,18 @@ msgstr ""
msgid "Number of accidents by accident type"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:64
#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:65
msgid "Collision"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:65
#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:66
msgid ""
"Distribution of accidents by type in the selected segment and time "
"period. Three most common accident types are displayed"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_year_widget.py:56
msgid "Accidents in segment"
msgid "Number of accidents, per year, split by severity"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_year_widget.py:63
Expand All @@ -441,7 +444,7 @@ msgstr ""
msgid "Accidents by time"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_day_night_widget.py:39
#: anyway/widgets/road_segment_widgets/accident_count_by_day_night_widget.py:40
msgid ""
"Distribution of accidents by day/night. Day/night are determined by "
"sunrise and sunset at each day of the year."
Expand All @@ -455,7 +458,7 @@ msgstr ""
msgid "Number of accidents by driver type"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_driver_type_widget.py:85
#: anyway/widgets/road_segment_widgets/accident_count_by_driver_type_widget.py:86
msgid ""
"Driver involvement in accident by driver type: professional - trucks, "
"taxi, bus, work, minibus, tractor, private - private car, motorcycle, "
Expand Down Expand Up @@ -581,14 +584,12 @@ msgstr ""
msgid "Killed and injury stacked per age group"
msgstr ""

#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:29
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget_utils.py:87
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget_utils.py:91
msgid "unknown"
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:39
msgid "Injury per age group"
msgstr ""

#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:49
msgid "Injury per age group"
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget_utils.py:87
msgid "unknown"
msgstr ""

#: anyway/widgets/road_segment_widgets/motorcycle_accidents_vs_all_accidents_widget.py:21
Expand Down
Binary file modified translations/en/LC_MESSAGES/messages.mo
Binary file not shown.
66 changes: 41 additions & 25 deletions translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-06-22 13:32+0000\n"
"POT-Creation-Date: 2023-12-19 21:10+0000\n"
"PO-Revision-Date: 2020-11-26 16:45+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand All @@ -16,7 +16,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"
"Generated-By: Babel 2.12.1\n"

#: anyway/backend_constants.py:148
msgid "killed"
Expand All @@ -30,11 +30,11 @@ msgstr "severe injured"
msgid "light injured"
msgstr "light injured"

#: anyway/flask_app.py:678 anyway/flask_app.py:782
#: anyway/flask_app.py:682 anyway/flask_app.py:786
msgid "Discussion not found:"
msgstr ""

#: anyway/flask_app.py:681
#: anyway/flask_app.py:685
msgid "Illegal Discussion"
msgstr ""

Expand Down Expand Up @@ -264,7 +264,18 @@ msgid "Number of accidents by severity"
msgstr "Number of accidents by severity"

#: anyway/widgets/all_locations_widgets/accident_count_by_severity_widget.py:123
msgid "road_segment_namenon_urban_intersection_hebrew"
#: anyway/widgets/road_segment_widgets/accident_count_by_car_type_widget.py:145
#: anyway/widgets/road_segment_widgets/accident_count_by_hour_widget.py:31
#: anyway/widgets/road_segment_widgets/accident_count_by_road_light_widget.py:33
#: anyway/widgets/road_segment_widgets/accidents_heat_map_widget.py:54
#: anyway/widgets/road_segment_widgets/injured_count_by_severity_widget.py:133
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_stacked_widget.py:53
#: anyway/widgets/road_segment_widgets/suburban_crosswalk_widget.py:73
msgid "road_segment_name"
msgstr ""

#: anyway/widgets/all_locations_widgets/accident_count_by_severity_widget.py:124
msgid "non_urban_intersection_hebrew"
msgstr ""

#: anyway/widgets/all_locations_widgets/accident_count_by_severity_widget.py:129
Expand Down Expand Up @@ -303,6 +314,13 @@ msgstr ""
msgid "Fatal, severe and light accidents count in the specified location."
msgstr ""

#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:47
#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:49
#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:52
#, fuzzy
msgid "Severe accidents"
msgstr "severe injured"

#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:51
#: anyway/widgets/all_locations_widgets/most_severe_accidents_table_widget.py:226
msgid "in"
Expand Down Expand Up @@ -394,32 +412,20 @@ msgstr ""
msgid "Number of accidents by accident type"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:64
#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:65
msgid "Collision"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:65
#: anyway/widgets/road_segment_widgets/accident_count_by_accident_type_widget.py:66
msgid ""
"Distribution of accidents by type in the selected segment and time "
"period. Three most common accident types are displayed"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_year_widget.py:56
msgid "Accidents in segment"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_year_widget.py:57
#: anyway/widgets/road_segment_widgets/accident_count_by_car_type_widget.py:145
#: anyway/widgets/road_segment_widgets/accident_count_by_hour_widget.py:31
#: anyway/widgets/road_segment_widgets/accident_count_by_road_light_widget.py:33
#: anyway/widgets/road_segment_widgets/accidents_heat_map_widget.py:54
#: anyway/widgets/road_segment_widgets/injured_count_by_accident_year_widget.py:56
#: anyway/widgets/road_segment_widgets/injured_count_by_severity_widget.py:133
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_stacked_widget.py:53
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:42
#: anyway/widgets/road_segment_widgets/suburban_crosswalk_widget.py:73
msgid "road_segment_name"
msgstr ""
#, fuzzy
msgid "Number of accidents, per year, split by severity"
msgstr "Number of accidents by severity"

#: anyway/widgets/road_segment_widgets/accident_count_by_accident_year_widget.py:63
msgid ""
Expand All @@ -441,7 +447,7 @@ msgstr ""
msgid "Accidents by time"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_day_night_widget.py:39
#: anyway/widgets/road_segment_widgets/accident_count_by_day_night_widget.py:40
msgid ""
"Distribution of accidents by day/night. Day/night are determined by "
"sunrise and sunset at each day of the year."
Expand All @@ -455,7 +461,7 @@ msgstr ""
msgid "Number of accidents by driver type"
msgstr ""

#: anyway/widgets/road_segment_widgets/accident_count_by_driver_type_widget.py:85
#: anyway/widgets/road_segment_widgets/accident_count_by_driver_type_widget.py:86
msgid ""
"Driver involvement in accident by driver type: professional - trucks, "
"taxi, bus, work, minibus, tractor, private - private car, motorcycle, "
Expand Down Expand Up @@ -589,10 +595,14 @@ msgstr ""
msgid "Killed and injury stacked per age group"
msgstr ""

#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:41
#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget.py:39
msgid "Injury per age group"
msgstr ""

#: anyway/widgets/road_segment_widgets/killed_and_injured_count_per_age_group_widget_utils.py:87
msgid "unknown"
msgstr ""

#: anyway/widgets/road_segment_widgets/motorcycle_accidents_vs_all_accidents_widget.py:21
msgid "all roads"
msgstr ""
Expand Down Expand Up @@ -753,3 +763,9 @@ msgstr ""
#~ msgid "in yishuv"
#~ msgstr ""

#~ msgid "road_segment_namenon_urban_intersection_hebrew"
#~ msgstr ""

#~ msgid "Accidents in segment"
#~ msgstr ""

Binary file modified translations/he/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit dfca9c4

Please sign in to comment.