@@ -831,9 +831,11 @@ def load_translations(self):
831
831
for uid , (sheet , item ) in self .id_map .items ():
832
832
if sheet < len (sheets ) and item in sheets [sheet ]:
833
833
translation [uid ] = sheets [sheet ][item ]
834
- else :
834
+ elif self . opt . debug :
835
835
msg = "No {0} translation for sheet {1}, item {2}"
836
836
raise SC2ReaderLocalizationError (msg .format (self .opt .lang ,sheet ,item ))
837
+ else :
838
+ translation [uid ] = "Unknown"
837
839
838
840
self .lang_sheets [lang ] = sheets
839
841
self .translations [lang ] = translation
@@ -899,7 +901,7 @@ def use_property(prop, player=None):
899
901
900
902
translation = self .translations [self .opt .lang ]
901
903
for uid , prop in properties .items ():
902
- name = self . translations [ self . opt . lang ][ uid ]
904
+ name = translation . get ( uid , "Unknown" )
903
905
if prop .is_lobby :
904
906
if use_property (prop ):
905
907
value = prop .values [settings [uid ]][0 ]
@@ -925,7 +927,7 @@ def load_player_stats(self):
925
927
stats_items .append (self .parts [4 ][0 ][0 ])
926
928
927
929
for item in stats_items :
928
- stat_name = translation [ item [0 ][1 ]]
930
+ stat_name = translation . get ( item [0 ][1 ], "Unknown" )
929
931
for index , value in enumerate (item [1 ]):
930
932
if value :
931
933
self .player_stats [index ][stat_name ] = value [0 ][0 ]
@@ -963,6 +965,9 @@ def load_player_builds(self):
963
965
BuildEntry = namedtuple ('BuildEntry' ,['supply' ,'total_supply' ,'time' ,'order' ,'build_index' ])
964
966
for build_item in build_items :
965
967
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.
966
971
if translation_key in translation :
967
972
order_name = translation [translation_key ]
968
973
for pindex , commands in enumerate (build_item [1 ]):
0 commit comments