Пример #1
0
    def get_source_checks(self):
        """Returns list of failing source checks on current subproject."""
        result = TranslationChecklist()
        result.add(
            'all',
            _('All strings'),
            self.total,
            'success',
        )

        # All checks
        result.add_if(
            'sourcechecks',
            _('Strings with any failing checks'),
            self.unit_set.count_type('sourcechecks', self),
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.source:
                continue
            result.add_if(
                check,
                check_obj.description,
                self.unit_set.count_type(check, self),
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            'sourcecomments',
            _('Strings with comments'),
            self.unit_set.count_type('sourcecomments', self),
            'info',
        )

        return result
Пример #2
0
    def get_source_checks(self):
        """Returns list of failing source checks on current subproject."""
        result = TranslationChecklist()
        result.add(
            'all',
            _('All strings'),
            self.total,
            'success',
        )

        # All checks
        result.add_if(
            'sourcechecks',
            _('Strings with any failing checks'),
            self.unit_set.count_type('sourcechecks', self),
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.source:
                continue
            result.add_if(
                check,
                check_obj.description,
                self.unit_set.count_type(check, self),
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            'sourcecomments',
            _('Strings with comments'),
            self.unit_set.count_type('sourcecomments', self),
            'info',
        )

        return result
Пример #3
0
    def get_source_checks(self):
        """Return list of failing source checks on current component."""
        result = TranslationChecklist()
        result.add(
            self.stats,
            'all',
            _('All strings'),
            'success',
        )

        # All checks
        result.add_if(
            self.stats,
            'sourcechecks',
            _('Strings with any failing checks'),
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.source:
                continue
            result.add_if(
                self.stats,
                check_obj.url_id,
                check_obj.description,
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            self.stats,
            'sourcecomments',
            _('Strings with comments'),
            'info',
        )

        return result
Пример #4
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
Пример #5
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
Пример #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
Пример #7
0
    def list_translation_checks(self):
        """Return list of failing checks on current translation."""
        result = TranslationChecklist()

        # All strings
        result.add(self.stats, "all", "")

        result.add_if(self.stats, "readonly", "default")

        if not self.is_readonly:
            if self.enable_review:
                result.add_if(self.stats, "approved", "info")

            # Count of translated strings
            result.add_if(self.stats, "translated", "success")

            # To approve
            if self.enable_review:
                result.add_if(self.stats, "unapproved", "dark")

                # Approved with suggestions
                result.add_if(self.stats, "approved_suggestions", "info")

            # Untranslated strings
            result.add_if(self.stats, "todo", "danger")

            # Not translated strings
            result.add_if(self.stats, "nottranslated", "danger")

            # Fuzzy strings
            result.add_if(self.stats, "fuzzy", "danger")

            # Translations with suggestions
            result.add_if(self.stats, "suggestions", "dark")
            result.add_if(self.stats, "nosuggestions", "dark")

        # All checks
        result.add_if(self.stats, "allchecks", "warning")

        # Translated strings with checks
        if not self.is_source:
            result.add_if(self.stats, "translated_checks", "warning")

        # Dismissed checks
        result.add_if(self.stats, "dismissed_checks", "warning")

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            result.add_if(self.stats, check_obj.url_id, "warning")

        # Grab comments
        result.add_if(self.stats, "comments", "dark")

        # Include labels
        labels = self.component.project.label_set.order_by("name")
        if labels:
            for label in labels:
                result.add_if(
                    self.stats,
                    f"label:{label.name}",
                    f"label label-{label.color}",
                )
            result.add_if(self.stats, "unlabeled", "")

        return result
Пример #8
0
    def get_translation_checks(self):
        """Returns list of failing checks on current translation."""
        result = TranslationChecklist()

        # All strings
        result.add('all', _('All strings'), self.total, 'success',
                   self.total_words)

        # Count of translated strings
        result.add_if(
            'translated',
            _('Translated strings'),
            self.translated,
            'success',
            self.translated_words,
        )

        # Untranslated strings
        result.add_if(
            'todo',
            _('Strings needing action'),
            self.total - self.translated,
            'danger',
            self.total_words - self.translated_words,
        )

        # Not translated strings
        result.add_if(
            'nottranslated',
            _('Not translated strings'),
            self.total - self.translated - self.fuzzy,
            'danger',
            self.total_words - self.translated_words - self.fuzzy_words,
        )

        # Fuzzy strings
        result.add_if(
            'fuzzy',
            _('Strings marked for review'),
            self.fuzzy,
            'danger',
            self.fuzzy_words,
        )

        # Translations with suggestions
        result.add_if(
            'suggestions',
            _('Strings with suggestions'),
            self.have_suggestion,
            'info',
        )

        # All checks
        result.add_if(
            'allchecks',
            _('Strings with any failing checks'),
            self.failing_checks,
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.target:
                continue
            result.add_if(
                check,
                check_obj.description,
                self.unit_set.count_type(check, self),
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            'comments',
            _('Strings with comments'),
            self.have_comment,
            'info',
        )

        return result
Пример #9
0
    def get_target_checks(self):
        """Return list of failing checks on current component."""
        result = TranslationChecklist()

        # All strings
        result.add(self.stats, "all", "success")
        result.add_if(self.stats, "approved", "success")

        # Count of translated strings
        result.add_if(self.stats, "translated", "success")

        # To approve
        if self.enable_review:
            result.add_if(self.stats, "unapproved", "warning")

        # Approved with suggestions
        result.add_if(self.stats, "approved_suggestions", "danger")

        # Untranslated strings
        result.add_if(self.stats, "todo", "danger")

        # Not translated strings
        result.add_if(self.stats, "nottranslated", "danger")

        # Fuzzy strings
        result.add_if(self.stats, "fuzzy", "danger")

        # Translations with suggestions
        result.add_if(self.stats, "suggestions", "info")
        result.add_if(self.stats, "nosuggestions", "info")

        # All checks
        result.add_if(self.stats, "allchecks", "danger")

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.target:
                continue
            result.add_if(self.stats, check_obj.url_id, "warning")

        # Grab comments
        result.add_if(self.stats, "comments", "info")

        return result
Пример #10
0
    def get_translation_checks(self):
        """Returns list of failing checks on current translation."""
        result = TranslationChecklist()

        # All strings
        result.add(
            'all',
            _('All strings'),
            self.total,
            'success',
            self.total_words
        )

        # Count of translated strings
        result.add_if(
            'translated',
            _('Translated strings'),
            self.translated,
            'success',
            self.translated_words,
        )

        # Untranslated strings
        result.add_if(
            'todo',
            _('Strings needing action'),
            self.total - self.translated,
            'danger',
            self.total_words - self.translated_words,
        )

        # Not translated strings
        result.add_if(
            'nottranslated',
            _('Not translated strings'),
            self.total - self.translated - self.fuzzy,
            'danger',
            self.total_words - self.translated_words - self.fuzzy_words,
        )

        # Fuzzy strings
        result.add_if(
            'fuzzy',
            _('Strings marked for review'),
            self.fuzzy,
            'danger',
            self.fuzzy_words,
        )

        # Translations with suggestions
        result.add_if(
            'suggestions',
            _('Strings with suggestions'),
            self.have_suggestion,
            'info',
        )

        # All checks
        result.add_if(
            'allchecks',
            _('Strings with any failing checks'),
            self.failing_checks,
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.target:
                continue
            result.add_if(
                check,
                check_obj.description,
                self.unit_set.count_type(check, self),
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            'comments',
            _('Strings with comments'),
            self.have_comment,
            'info',
        )

        return result
Пример #11
0
    def list_translation_checks(self):
        """Return list of failing checks on current translation."""
        result = TranslationChecklist()

        # All strings
        result.add(
            self.stats,
            'all',
            _('All strings'),
            'success',
        )

        result.add_if(
            self.stats,
            'approved',
            _('Approved strings'),
            'success',
        )

        # Count of translated strings
        result.add_if(
            self.stats,
            'translated',
            _('Translated strings'),
            'success',
        )

        # To approve
        if self.component.project.enable_review:
            result.add_if(
                self.stats,
                'unapproved',
                _('Strings waiting for review'),
                'warning',
            )

        # Approved with suggestions
        result.add_if(
            self.stats,
            'approved_suggestions',
            _('Approved strings with suggestions'),
            'danger',
        )

        # Untranslated strings
        result.add_if(
            self.stats,
            'todo',
            _('Strings needing action'),
            'danger',
        )

        # Not translated strings
        result.add_if(
            self.stats,
            'nottranslated',
            _('Not translated strings'),
            'danger',
        )

        # Fuzzy strings
        result.add_if(
            self.stats,
            'fuzzy',
            _('Strings marked as needing edit'),
            'danger',
        )

        # Translations with suggestions
        result.add_if(
            self.stats,
            'suggestions',
            _('Strings with suggestions'),
            'info',
        )
        result.add_if(
            self.stats,
            'nosuggestions',
            _('Strings needing action without suggestions'),
            'info',
        )

        # All checks
        result.add_if(
            self.stats,
            'allchecks',
            _('Strings with any failing checks'),
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.target:
                continue
            result.add_if(
                self.stats,
                check_obj.url_id,
                check_obj.description,
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            self.stats,
            'comments',
            _('Strings with comments'),
            'info',
        )

        return result
Пример #12
0
    def list_translation_checks(self):
        """Return list of failing checks on current translation."""
        result = TranslationChecklist()

        # All strings
        result.add(self.stats, "all", "success")

        if not self.is_readonly:
            if self.enable_review:
                result.add_if(self.stats, "approved", "success")

            # Count of translated strings
            result.add_if(self.stats, "translated", "success")

            # To approve
            if self.enable_review:
                result.add_if(self.stats, "unapproved", "warning")

                # Approved with suggestions
                result.add_if(self.stats, "approved_suggestions", "danger")

            # Untranslated strings
            result.add_if(self.stats, "todo", "danger")

            # Not translated strings
            result.add_if(self.stats, "nottranslated", "danger")

            # Fuzzy strings
            result.add_if(self.stats, "fuzzy", "danger")

            # Translations with suggestions
            result.add_if(self.stats, "suggestions", "info")
            result.add_if(self.stats, "nosuggestions", "info")

        # All checks
        result.add_if(self.stats, "allchecks", "danger")

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            result.add_if(self.stats, check_obj.url_id, "warning")

        # Grab comments
        result.add_if(self.stats, "comments", "info")

        # Include labels
        for label in self.component.project.label_set.all():
            result.add_if(self.stats, "label:{}".format(label.name), "info")

        return result
Пример #13
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
Пример #14
0
    def list_translation_checks(self):
        """Return list of failing checks on current translation."""
        result = TranslationChecklist()

        # All strings
        result.add(
            self.stats,
            'all',
            _('All strings'),
            'success',
        )

        result.add_if(
            self.stats,
            'approved',
            _('Approved strings'),
            'success',
        )

        # Count of translated strings
        result.add_if(
            self.stats,
            'translated',
            _('Translated strings'),
            'success',
        )

        # To approve
        if self.component.project.enable_review:
            result.add_if(
                self.stats,
                'unapproved',
                _('Strings waiting for review'),
                'warning',
            )

        # Approved with suggestions
        result.add_if(
            self.stats,
            'approved_suggestions',
            _('Approved strings with suggestions'),
            'danger',
        )

        # Untranslated strings
        result.add_if(
            self.stats,
            'todo',
            _('Strings needing action'),
            'danger',
        )

        # Not translated strings
        result.add_if(
            self.stats,
            'nottranslated',
            _('Not translated strings'),
            'danger',
        )

        # Fuzzy strings
        result.add_if(
            self.stats,
            'fuzzy',
            _('Strings marked as needing edit'),
            'danger',
        )

        # Translations with suggestions
        result.add_if(
            self.stats,
            'suggestions',
            _('Strings with suggestions'),
            'info',
        )
        result.add_if(
            self.stats,
            'nosuggestions',
            _('Strings without suggestions'),
            'info',
        )

        # All checks
        result.add_if(
            self.stats,
            'allchecks',
            _('Strings with any failing checks'),
            'danger',
        )

        # Process specific checks
        for check in CHECKS:
            check_obj = CHECKS[check]
            if not check_obj.target:
                continue
            result.add_if(
                self.stats,
                check_obj.url_id,
                check_obj.description,
                check_obj.severity,
            )

        # Grab comments
        result.add_if(
            self.stats,
            'comments',
            _('Strings with comments'),
            'info',
        )

        return result