Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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()
Exemplo n.º 5
0
 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()
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
    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
Exemplo n.º 9
0
def get_filter_name(name):
    names = dict(get_filter_choice())
    return names[name]
Exemplo n.º 10
0
def get_filter_name(name):
    names = dict(get_filter_choice(True))
    return names[name]