def translate(self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None): if default is not None: default = normalize(default) if msgid == default: default = None msgid = Message(msgid, default=default) if domain not in self.catalog: self.catalog[domain] = {} domain = self.catalog[domain] if msgid not in domain: domain[msgid] = [] else: msgids = domain.keys() idx = msgids.index(msgid) existing_msgid = msgids[idx] if msgid.default != existing_msgid.default: references = '\n'.join([location[0]+':'+str(location[1]) for location in domain[msgid]]) print >> sys.stderr, "Warning: msgid '%s' in %s already exists " \ "with a different default (bad: %s, should be: %s)\n" \ "The references for the existent value are:\n%s\n" % \ (msgid, self.file+':'+str(position), msgid.default, existing_msgid.default, references) domain[msgid].append((self.file, position)) return 'x'
def translate( self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None): if default is not None: default = normalize(default) if msgid == default: default = None msgid = Message(msgid, default=default) if domain not in self.catalog: self.catalog[domain] = {} domain = self.catalog[domain] if msgid not in domain: domain[msgid] = [] else: msgids = list(domain) idx = msgids.index(msgid) existing_msgid = msgids[idx] if msgid.default != existing_msgid.default: references = '\n'.join([ location[0] + ':' + str(location[1]) for location in domain[msgid] ]) # Note: a lot of encode calls here are needed so # Python 3 does not break. warnings.warn( "Warning: msgid '%s' in %s already exists " "with a different default (bad: %s, should be: %s)\n" "The references for the existent value are:\n%s\n" % (msgid.encode('utf-8'), self.file.encode('utf-8') + ':'.encode('utf-8') + str(position).encode('utf-8'), msgid.default.encode('utf-8'), existing_msgid.default.encode('utf-8'), references.encode('utf-8'))) domain[msgid].append((self.file, position)) return 'x'
def translate(self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None): # Make the message is a MessageID object, if the default differs # from the value, so that the POT generator can put the default # text into a comment. if default is not None and normalize(default) != msgid: msgid = MessageID(msgid, default=default) if domain not in self.catalog: self.catalog[domain] = {} domain = self.catalog[domain] if msgid not in domain: domain[msgid] = [] domain[msgid].append((self.file, position)) return 'x'
def translate(self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None): if default is not None: default = normalize(default) if msgid == default: default = None msgid = Message(msgid, default=default) if domain not in self.catalog: self.catalog[domain] = {} domain = self.catalog[domain] if msgid not in domain: domain[msgid] = [] else: msgids = list(domain) idx = msgids.index(msgid) existing_msgid = msgids[idx] if msgid.default != existing_msgid.default: references = '\n'.join([location[0]+':'+str(location[1]) for location in domain[msgid]]) # Note: a lot of encode calls here are needed so # Python 3 does not break. warnings.warn( "Warning: msgid '%s' in %s already exists " "with a different default (bad: %s, should be: %s)\n" "The references for the existent value are:\n%s\n" % (msgid.encode('utf-8'), self.file.encode('utf-8') + ':'.encode('utf-8') + str(position).encode('utf-8'), msgid.default.encode('utf-8'), existing_msgid.default.encode('utf-8'), references.encode('utf-8'))) domain[msgid].append((self.file, position)) return 'x'
def translate( self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None): if default is not None: default = normalize(default) if msgid == default: default = None msgid = Message(msgid, default=default) if domain not in self.catalog: self.catalog[domain] = {} domain = self.catalog[domain] if msgid not in domain: domain[msgid] = [] else: msgids = domain.keys() idx = msgids.index(msgid) existing_msgid = msgids[idx] if msgid.default != existing_msgid.default: references = '\n'.join([ location[0] + ':' + str(location[1]) for location in domain[msgid] ]) print >> sys.stderr, (u"Warning: msgid '%s' in %s already exists " \ "with a different default (bad: %s, should be: %s)\n" \ "The references for the existent value are:\n%s\n" % \ (msgid, self.file+':'+str(position), msgid.default.encode('utf-8'), existing_msgid.default.encode('utf-8'), references)).encode('utf-8') domain[msgid].append((self.file, position)) return 'x'