'Adds, edits, or removes names to match the passed in new_names dict.
Will not remove the translation of the default_locale.
`new_names` is a dictionary mapping of locales to names.
Returns a message that can be used in logs showing what names were
added or updated.
Note: This method doesn\'t save the changes made to the addon object.
Don\'t forget to call save() in your calling method.'

def update_names(self, new_names):

    updated_locales = {}
    qs = Translation.objects.filter(id=self.name_id)
    locales = {to_language(locale): localized for (locale, localized) in qs.values_list('locale', 'localized_string')}
    msg_c = []
    msg_d = []
    msg_u = []
    names = {}
    for (locale, name) in new_names.iteritems():
        loc = find_language(locale)
        if (loc and (loc not in names)):
            names[loc] = name
    for locale in (set(locales) - set(names)):
        names[locale] = None
    for (locale, name) in names.iteritems():
        if (locale in locales):
            if ((not name) and (locale.lower() == self.default_locale.lower())):
                pass
            elif (not name):
                updated_locales[locale] = None
                msg_d.append((u'"%s"    (%s).' % (locales.get(locale), locale)))
            elif (name != locales[locale]):
                updated_locales[locale] = name
                msg_u.append((u'"%s"    ->    "%s"    (%s).' % (locales[locale], name, locale)))
        else:
            updated_locales[locale] = names.get(locale)
            msg_c.append((u'"%s"    (%s).' % (name, locale)))
    if (locales != updated_locales):
        self.name = updated_locales
    return {'added': '    '.join(msg_c), 'deleted': '    '.join(msg_d), 'updated': '    '.join(msg_u)}
