def get_source_checks(self): """Return list of failing source checks on current component.""" result = TranslationChecklist() choices = dict(get_filter_choice(True)) result.add(self.stats, choices, 'all', 'success') # All checks result.add_if(self.stats, choices, 'sourcechecks', 'danger') # Process specific checks for check in CHECKS: check_obj = CHECKS[check] if not check_obj.source: continue result.add_if( self.stats, choices, check_obj.url_id, check_obj.severity, ) # Grab comments result.add_if(self.stats, choices, 'sourcecomments', 'info') return result
def __init__(self, *args, **kwargs): kwargs['label'] = _('Search filter') kwargs['required'] = False kwargs['choices'] = get_filter_choice() kwargs['error_messages'] = { 'invalid_choice': _('Please select a valid filter type.'), } super(FilterField, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): kwargs['label'] = _('Search filter') if 'required' not in kwargs: kwargs['required'] = False kwargs['choices'] = get_filter_choice() kwargs['error_messages'] = { 'invalid_choice': _('Please choose a valid filter type.'), } super(FilterField, self).__init__(*args, **kwargs)
def ensure_all(self): """Ensure we have complete set.""" # Prefetch basic stats at once save = self.ensure_basic(save=False) # Fetch remaining ones for item, _unused in get_filter_choice(self.obj.component.project): if item not in self._data: self.calculate_item(item) save = True if save: self.save()
def ensure_all(self): """Ensure we have complete set.""" # Prefetch basic stats at once save = self.ensure_basic(save=False) # Fetch remaining ones for item, dummy in get_filter_choice(): if item not in self._data: self.calculate_item(item) save = True if save: self.save()
def list_translation_checks(self): """Return list of failing checks on current translation.""" result = TranslationChecklist() choices = dict(get_filter_choice()) # All strings result.add(self.stats, choices, 'all', 'success') result.add_if(self.stats, choices, 'approved', 'success') # Count of translated strings result.add_if(self.stats, choices, 'translated', 'success') # To approve if self.component.project.enable_review: result.add_if(self.stats, choices, 'unapproved', 'warning') # Approved with suggestions result.add_if(self.stats, choices, 'approved_suggestions', 'danger') # Untranslated strings result.add_if(self.stats, choices, 'todo', 'danger') # Not translated strings result.add_if(self.stats, choices, 'nottranslated', 'danger') # Fuzzy strings result.add_if(self.stats, choices, 'fuzzy', 'danger') # Translations with suggestions result.add_if(self.stats, choices, 'suggestions', 'info') result.add_if(self.stats, choices, 'nosuggestions', 'info') # All checks result.add_if(self.stats, choices, 'allchecks', 'danger') # Process specific checks for check in CHECKS: check_obj = CHECKS[check] if not check_obj.target: continue result.add_if( self.stats, choices, check_obj.url_id, check_obj.severity, ) # Grab comments result.add_if(self.stats, choices, 'comments', 'info') return result
def list_translation_checks(self): """Return list of failing checks on current translation.""" result = TranslationChecklist() choices = dict(get_filter_choice()) # All strings result.add(self.stats, choices, 'all', 'success') result.add_if(self.stats, choices, 'approved', 'success') # Count of translated strings result.add_if(self.stats, choices, 'translated', 'success') # To approve if self.component.project.enable_review: result.add_if(self.stats, choices, 'unapproved', 'warning') # Approved with suggestions result.add_if(self.stats, choices, 'approved_suggestions', 'danger') # Untranslated strings result.add_if(self.stats, choices, 'todo', 'danger') # Not translated strings result.add_if(self.stats, choices, 'nottranslated', 'danger') # Fuzzy strings result.add_if(self.stats, choices, 'fuzzy', 'danger') # Translations with suggestions result.add_if(self.stats, choices, 'suggestions', 'info') result.add_if(self.stats, choices, 'nosuggestions', 'info') # All checks result.add_if(self.stats, choices, 'allchecks', 'danger') # Process specific checks for check in CHECKS: check_obj = CHECKS[check] if not check_obj.target: continue result.add_if( self.stats, choices, check_obj.url_id, check_obj.severity, ) # Grab comments result.add_if(self.stats, choices, 'comments', 'info') return result
def get_source_checks(self): """Return list of failing source checks on current component.""" result = TranslationChecklist() choices = dict(get_filter_choice(True)) result.add(self.stats, choices, 'all', 'success') # All checks result.add_if(self.stats, choices, 'sourcechecks', 'danger') # Process specific checks for check in CHECKS: check_obj = CHECKS[check] if not check_obj.source: continue result.add_if( self.stats, choices, check_obj.url_id, check_obj.severity, ) # Grab comments result.add_if(self.stats, choices, 'sourcecomments', 'info') return result
def get_filter_name(name): names = dict(get_filter_choice()) return names[name]
def get_filter_name(name): names = dict(get_filter_choice(True)) return names[name]