def get_label(self): # get the right symbol sym = self.SUPPORTED_SYM[self.result] # we add a trailing if self.last_item: label_text = self.LABEL_LAST_ITEM else: label_text = self.LABEL short_descr = get_hw_short_description(self.tag) return _(label_text) % { "sym": sym, # we need unicode() here instead of utf8 or str because # the %s in "label_text" will cause str() to be called on the # encoded string, but it will not know what encoding to use "hardware": unicode(short_descr, "utf8", "ignore") }
def get_label(self): # get the right symbol sym = self.SUPPORTED_SYM[self.result] # we add a trailing if self.last_item: label_text = self.LABEL_LAST_ITEM else: label_text = self.LABEL short_descr = get_hw_short_description(self.tag) # this needs to be unicode as the translation for zh_CN contains # special chars for the "," (LP: #967036) label_text = unicode(_(label_text), "utf8", "ignore") % { "sym": sym, # we need unicode() here instead of utf8 or str because # the %s in "label_text" will cause str() to be called on the # encoded string, but it will not know what encoding to use "hardware": unicode(short_descr, "utf8", "ignore") } return label_text