Exemple #1
0
def about(request):
    '''
    Shows about page with version information.
    '''
    context = {}
    totals = Profile.objects.aggregate(
        Sum('translated'), Sum('suggested'), Count('id')
    )
    total_strings = 0
    total_words = 0
    for project in SubProject.objects.iterator():
        try:
            translation = project.translation_set.all()[0]
            total_strings += translation.total
            total_words += translation.total_words
        except Translation.DoesNotExist:
            pass
    context['title'] = _('About Weblate')
    context['total_translations'] = totals['translated__sum']
    context['total_suggestions'] = totals['suggested__sum']
    context['total_users'] = totals['id__count']
    context['total_strings'] = total_strings
    context['total_words'] = total_words
    context['total_languages'] = Language.objects.filter(
        translation__total__gt=0
    ).distinct().count()
    context['total_checks'] = Check.objects.count()
    context['ignored_checks'] = Check.objects.filter(ignore=True).count()
    context['versions'] = get_versions() + get_optional_versions()

    return render_to_response('about.html', RequestContext(request, context))
Exemple #2
0
def about(request):
    """
    Shows about page with version information.
    """
    context = {}
    totals = Profile.objects.aggregate(Sum("translated"), Sum("suggested"), Count("id"))
    total_strings = 0
    total_words = 0
    for project in SubProject.objects.iterator():
        try:
            translation = project.translation_set.all()[0]
            total_strings += translation.total
            total_words += translation.total_words
        except Translation.DoesNotExist:
            pass
    context["title"] = _("About Weblate")
    context["total_translations"] = totals["translated__sum"]
    context["total_suggestions"] = totals["suggested__sum"]
    context["total_users"] = totals["id__count"]
    context["total_strings"] = total_strings
    context["total_words"] = total_words
    context["total_languages"] = Language.objects.filter(translation__total__gt=0).distinct().count()
    context["total_checks"] = Check.objects.count()
    context["ignored_checks"] = Check.objects.filter(ignore=True).count()
    context["versions"] = get_versions() + get_optional_versions()

    return render_to_response("about.html", RequestContext(request, context))
Exemple #3
0
 def handle(self, *args, **options):
     '''
     Prints versions of dependencies.
     '''
     print ' * Weblate %s' % GIT_VERSION
     for version in get_versions():
         print ' * %s %s' % (
             version[0],
             version[2],
         )
Exemple #4
0
def check_versions(sender, app, **kwargs):
    '''
    Check required versions.
    '''
    appname = 'trans.models'
    if app == 'trans' or getattr(app, '__name__', '') == appname:
        from trans.requirements import get_versions, check_version
        versions = get_versions()
        failure = False

        for version in versions:
            failure |= check_version(*version)

        if failure:
            raise Exception('Some of required modules are missing or too old! '
                            'Check above output for details.')
Exemple #5
0
def check_versions(sender, app, **kwargs):
    '''
    Check required versions.
    '''
    appname = 'trans.models'
    if app == 'trans' or getattr(app, '__name__', '') == appname:
        from trans.requirements import get_versions, check_version
        versions = get_versions()
        failure = False

        for version in versions:
            failure |= check_version(*version)

        if failure:
            raise Exception(
                'Some of required modules are missing or too old! '
                'Check above output for details.'
            )
Exemple #6
0
def about(request):
    context = {}
    versions = get_versions()
    totals = Profile.objects.aggregate(Sum('translated'), Sum('suggested'))
    total_strings = 0
    for project in SubProject.objects.iterator():
        try:
            total_strings += project.translation_set.all()[0].total
        except Translation.DoesNotExist:
            pass
    context['title'] = _('About Weblate')
    context['total_translations'] = totals['translated__sum']
    context['total_suggestions'] = totals['suggested__sum']
    context['total_users'] = Profile.objects.count()
    context['total_strings'] = total_strings
    context['total_languages'] = Language.objects.filter(
        translation__total__gt=0
    ).distinct().count()
    context['total_checks'] = Check.objects.count()
    context['ignored_checks'] = Check.objects.filter(ignore=True).count()
    context['versions'] = versions

    return render_to_response('about.html', RequestContext(request, context))
Exemple #7
0
def about(request):
    '''
    Shows about page with version information.
    '''
    context = {}
    totals = Profile.objects.aggregate(Sum('translated'), Sum('suggested'))
    total_strings = 0
    for project in SubProject.objects.iterator():
        try:
            total_strings += project.translation_set.all()[0].total
        except Translation.DoesNotExist:
            pass
    context['title'] = _('About Weblate')
    context['total_translations'] = totals['translated__sum']
    context['total_suggestions'] = totals['suggested__sum']
    context['total_users'] = Profile.objects.count()
    context['total_strings'] = total_strings
    context['total_languages'] = Language.objects.filter(
        translation__total__gt=0).distinct().count()
    context['total_checks'] = Check.objects.count()
    context['ignored_checks'] = Check.objects.filter(ignore=True).count()
    context['versions'] = get_versions() + get_optional_versions()

    return render_to_response('about.html', RequestContext(request, context))
 def handle(self, *args, **options):
     """
     Prints versions of dependencies.
     """
     for version in get_versions():
         print " * %s %s" % (version[0], version[2])