def checkComplete(self, component=''): supportedLocales = [] exitCode = 0 locales = pslocale.getStandardLocales() for loc in self.getTargetedLocales(component): if not (loc in locales): locales.append(loc) for loc in self.byLocale.keys(): if not (loc in locales): locales.append(loc) if not ('ma' in locales): locales.append('ma') self.byLocale['ma'] = self.generateMartian() missing = {} for loc in locales: if loc != 'en': if (not loc in self.byLocale.keys()): if loc in self.getTargetedLocales(component): missing[loc] = self.byLocale['en'].keys() continue for id in self.byLocale['en'].keys(): if not id in self.byLocale[loc].keys(): if missing.get(loc, 0) == 0: missing[loc] = [id] else: missing[loc].append(id) if missing.get(loc, 0) == 0: supportedLocales.append(loc) print('Supported locales: %s' % supportedLocales) #print('Targeted locales: %s' % self.conf.targetedLocales) complete = True for x in self.getTargetedLocales(component): if x != 'en': if not (x in supportedLocales): complete = False if not complete: exitCode = 1 '''print ('Missing Translations') for key in self.conf.targetedLocales: print ('%s is missing: %s' % (key, missing[key]))''' print('Missing translations for '), miss = [] for key in missing.keys(): if key in self.getTargetedLocales(component): miss.append(key) print(miss) strWithWarnings, needsSync = self.check(component) return exitCode, strWithWarnings, needsSync
def checkComplete(self, component=""): supportedLocales = [] exitCode = 0 locales = pslocale.getStandardLocales() for loc in self.getTargetedLocales(component): if not (loc in locales): locales.append(loc) for loc in self.byLocale.keys(): if not (loc in locales): locales.append(loc) if not ("ma" in locales): locales.append("ma") self.byLocale["ma"] = self.generateMartian() missing = {} for loc in locales: if loc != "en": if not loc in self.byLocale.keys(): if loc in self.getTargetedLocales(component): missing[loc] = self.byLocale["en"].keys() continue for id in self.byLocale["en"].keys(): if not id in self.byLocale[loc].keys(): if missing.get(loc, 0) == 0: missing[loc] = [id] else: missing[loc].append(id) if missing.get(loc, 0) == 0: supportedLocales.append(loc) print ("Supported locales: %s" % supportedLocales) # print('Targeted locales: %s' % self.conf.targetedLocales) complete = True for x in self.getTargetedLocales(component): if x != "en": if not (x in supportedLocales): complete = False if not complete: exitCode = 1 """print ('Missing Translations') for key in self.conf.targetedLocales: print ('%s is missing: %s' % (key, missing[key]))""" print ("Missing translations for "), miss = [] for key in missing.keys(): if key in self.getTargetedLocales(component): miss.append(key) print (miss) strWithWarnings, needsSync = self.check(component) return exitCode, strWithWarnings, needsSync
def getTargetedLocales(self, component): x = self.conf.getTargetedLocales(component) if not x: x = pslocale.getStandardLocales() return x