@@ -102,23 +102,21 @@ def check_msgid_and_symbol(self, msgid: str, symbol: str) -> None:
102102 @staticmethod
103103 def _raise_duplicate_symbol (msgid : str , symbol : str , other_symbol : str ) -> NoReturn :
104104 """Raise an error when a symbol is duplicated."""
105- symbols = [symbol , other_symbol ]
106- symbols . sort ()
107- error_message = f"Message id '{ msgid } ' cannot have both "
108- error_message += f"'{ symbols [ 0 ] } ' and '{ symbols [ 1 ] } ' as symbolic name."
109- raise InvalidMessageError ( error_message )
105+ symbol_a , symbol_b = sorted ( [symbol , other_symbol ])
106+ raise InvalidMessageError (
107+ f"Message id '{ msgid } ' cannot have both "
108+ f"'{ symbol_a } ' and '{ symbol_b } ' as symbolic name."
109+ )
110110
111111 @staticmethod
112112 def _raise_duplicate_msgid (symbol : str , msgid : str , other_msgid : str ) -> NoReturn :
113113 """Raise an error when a msgid is duplicated."""
114- msgids = [msgid , other_msgid ]
115- msgids .sort ()
116- error_message = (
114+ msgid_a , msgid_b = sorted ([msgid , other_msgid ])
115+ raise InvalidMessageError (
117116 f"Message symbol '{ symbol } ' cannot be used for "
118- f"'{ msgids [ 0 ] } ' and '{ msgids [ 1 ] } ' at the same time."
117+ f"'{ msgid_a } ' and '{ msgid_b } ' at the same time."
119118 f" If you're creating an 'old_names' use 'old-{ symbol } ' as the old symbol."
120119 )
121- raise InvalidMessageError (error_message )
122120
123121 def get_active_msgids (self , msgid_or_symbol : str ) -> list [str ]:
124122 """Return msgids but the input can be a symbol.
0 commit comments