@@ -831,9 +831,11 @@ def load_translations(self):
831831 for uid , (sheet , item ) in self .id_map .items ():
832832 if sheet < len (sheets ) and item in sheets [sheet ]:
833833 translation [uid ] = sheets [sheet ][item ]
834- else :
834+ elif self . opt . debug :
835835 msg = "No {0} translation for sheet {1}, item {2}"
836836 raise SC2ReaderLocalizationError (msg .format (self .opt .lang ,sheet ,item ))
837+ else :
838+ translation [uid ] = "Unknown"
837839
838840 self .lang_sheets [lang ] = sheets
839841 self .translations [lang ] = translation
@@ -899,7 +901,7 @@ def use_property(prop, player=None):
899901
900902 translation = self .translations [self .opt .lang ]
901903 for uid , prop in properties .items ():
902- name = self . translations [ self . opt . lang ][ uid ]
904+ name = translation . get ( uid , "Unknown" )
903905 if prop .is_lobby :
904906 if use_property (prop ):
905907 value = prop .values [settings [uid ]][0 ]
@@ -925,7 +927,7 @@ def load_player_stats(self):
925927 stats_items .append (self .parts [4 ][0 ][0 ])
926928
927929 for item in stats_items :
928- stat_name = translation [ item [0 ][1 ]]
930+ stat_name = translation . get ( item [0 ][1 ], "Unknown" )
929931 for index , value in enumerate (item [1 ]):
930932 if value :
931933 self .player_stats [index ][stat_name ] = value [0 ][0 ]
@@ -963,6 +965,9 @@ def load_player_builds(self):
963965 BuildEntry = namedtuple ('BuildEntry' ,['supply' ,'total_supply' ,'time' ,'order' ,'build_index' ])
964966 for build_item in build_items :
965967 translation_key = build_item [0 ][1 ]
968+ # Here instead of recording unknown entries we just skip them because
969+ # it seems that unknown entries actually don't belong in the build order
970+ # We should revisit this decision in the future.
966971 if translation_key in translation :
967972 order_name = translation [translation_key ]
968973 for pindex , commands in enumerate (build_item [1 ]):
0 commit comments