def setup(self, update): ''' Creates basic set of languages based on languages defined in ttkit and on our list of extra languages. ''' # Languages from ttkit for code, props in languages.items(): if code in data.SKIP_TRANSLATE_TOOLKIT: continue lang, created = self.get_or_create(code=code) # Should we update existing? if not update and not created: continue # Set language name lang.name = props[0].split(';')[0] lang.fixup_name() # Set number of plurals and equation lang.nplurals = props[1] lang.pluralequation = props[2].strip(';') lang.fixup_plurals() # Set language direction lang.set_direction() # Get plural type lang.plural_type = get_plural_type( lang.code, lang.pluralequation ) # Save language lang.save() # Create Weblate extra languages for props in data.EXTRALANGS: lang, created = self.get_or_create(code=props[0]) # Should we update existing? if not update and not created: continue lang.name = props[1] lang.nplurals = props[2] lang.pluralequation = props[3] if props[0] in data.RTL_LANGS: lang.direction = 'rtl' else: lang.direction = 'ltr' # Get plural type lang.plural_type = get_plural_type( lang.code, lang.pluralequation ) lang.save()