diff --git a/src/swgoh_comlink/helpers/_game_data.py b/src/swgoh_comlink/helpers/_game_data.py index 1d49224..98b9b3c 100644 --- a/src/swgoh_comlink/helpers/_game_data.py +++ b/src/swgoh_comlink/helpers/_game_data.py @@ -92,8 +92,8 @@ def create_localized_unit_name_dictionary(locale: str | list[Any]) -> dict[str, if line.startswith("#") or "|" not in line: continue if line.startswith("UNIT_"): - name_key, desc = line.split("|") - if name_key.endswith("_NAME"): + name_key, desc = line.split("|", 1) + if "_NAME" in name_key: unit_name_map[name_key] = desc return unit_name_map diff --git a/tests/unit/test_helpers.py b/tests/unit/test_helpers.py index 11d8fe1..fa0055a 100644 --- a/tests/unit/test_helpers.py +++ b/tests/unit/test_helpers.py @@ -478,6 +478,20 @@ def test_bytes_in_list(self): result = create_localized_unit_name_dictionary(locale_list) assert result == {"UNIT_LUKE_NAME": "Luke Skywalker"} + def test_name_variant_suffixes_included(self): + from swgoh_comlink.helpers._game_data import create_localized_unit_name_dictionary + + locale_list = [ + "UNIT_JEDIKNIGHTREVAN_NAME_V2|Jedi Knight Revan", + "UNIT_BOSSK_NAME|Bossk", + "UNIT_BOSSK_DESC|A hunter", + ] + result = create_localized_unit_name_dictionary(locale_list) + assert result == { + "UNIT_JEDIKNIGHTREVAN_NAME_V2": "Jedi Knight Revan", + "UNIT_BOSSK_NAME": "Bossk", + } + def test_comments_and_non_unit_lines_skipped(self): from swgoh_comlink.helpers._game_data import create_localized_unit_name_dictionary