コード例 #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(request, 'about.html', context)
コード例 #2
0
ファイル: basic.py プロジェクト: ujdhesa/weblate
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(
        request,
        'about.html',
        context
    )
コード例 #3
0
ファイル: __init__.py プロジェクト: phewcentral/weblate
def check_versions(sender, app, **kwargs):
    '''
    Check required versions.
    '''
    if (app == 'trans'
            or getattr(app, '__name__', '') == 'weblate.trans.models'):
        from weblate.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.')
コード例 #4
0
ファイル: __init__.py プロジェクト: ujdhesa/weblate
def check_versions(sender, app, **kwargs):
    '''
    Check required versions.
    '''
    if (app == 'trans'
            or getattr(app, '__name__', '') == 'weblate.trans.models'):
        from weblate.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.'
            )