@@ -798,9 +798,11 @@ def load_translations(self):
798798 for uid , (sheet , item ) in self .id_map .items ():
799799 if sheet < len (sheets ) and item in sheets [sheet ]:
800800 translation [uid ] = sheets [sheet ][item ]
801- else :
801+ elif self . opt . debug :
802802 msg = "No {0} translation for sheet {1}, item {2}"
803803 raise SC2ReaderLocalizationError (msg .format (self .opt .lang ,sheet ,item ))
804+ else :
805+ translation [uid ] = "Unknown"
804806
805807 self .lang_sheets [lang ] = sheets
806808 self .translations [lang ] = translation
@@ -866,7 +868,7 @@ def use_property(prop, player=None):
866868
867869 translation = self .translations [self .opt .lang ]
868870 for uid , prop in properties .items ():
869- name = self . translations [ self . opt . lang ][ uid ]
871+ name = translation . get ( uid , "Unknown" )
870872 if prop .is_lobby :
871873 if use_property (prop ):
872874 value = prop .values [settings [uid ]][0 ]
@@ -892,7 +894,7 @@ def load_player_stats(self):
892894 stats_items .append (self .parts [4 ][0 ][0 ])
893895
894896 for item in stats_items :
895- stat_name = translation [ item [0 ][1 ]]
897+ stat_name = translation . get ( item [0 ][1 ], "Unknown" )
896898 for index , value in enumerate (item [1 ]):
897899 if value :
898900 self .player_stats [index ][stat_name ] = value [0 ][0 ]
@@ -930,6 +932,9 @@ def load_player_builds(self):
930932 BuildEntry = namedtuple ('BuildEntry' ,['supply' ,'total_supply' ,'time' ,'order' ,'build_index' ])
931933 for build_item in build_items :
932934 translation_key = build_item [0 ][1 ]
935+ # Here instead of recording unknown entries we just skip them because
936+ # it seems that unknown entries actually don't belong in the build order
937+ # We should revisit this decision in the future.
933938 if translation_key in translation :
934939 order_name = translation [translation_key ]
935940 for pindex , commands in enumerate (build_item [1 ]):
0 commit comments