<commit_before># Copyright Collab 2015-2016
# See LICENSE for details.

"""
Extract and compile localization strings for the require.js i18n plugin.
"""

import os
from optparse import make_option

from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import get_language_info, check_for_language

from require_i18n.core import UpdateCatalog


class Command(BaseCommand):
    help = 'Compile gettext catalogs used in the require.js i18n plugin.'

    option_list = BaseCommand.option_list + (
        make_option("-l", "--locale",
            dest="locale",
            help="Locale(s) to process (e.g. nl). Default is to process" +
                " all. Can be used multiple times.",
            default="all",
            metavar="LOCALE"
        ),
        make_option("-d", "--domain",
            dest="domain",
            help="The domain of the message files. Default: %default",
            default="site",
            metavar="DOMAIN"
        ),
        make_option("--dry-run",
            action="store_true",
            dest="dry_run",
            default=False,
            help="Simulate without updating files. Default: %default"
        ),
        make_option("--no-empty",
            action="store_true",
            dest="no_empty",
            default=False,
            help="Empty compiled translation files are not allowed and will " +
                "be deleted if detected. Default: %default"
        ),
        make_option("-t", "--output-type",
            dest="output_type",
            help="The type for the translated output files, either 'json' " +
                "for JSON format or 'script' for Javascript files. " +
                "Default: %default",
            default="script",
            metavar="TYPE"
        )
    )

    def handle(self, *args, **options):
        self.locale_dir = settings.LOCALE_PATHS[0]

        # parse options
        self.dry_run = options['dry_run']
        self.domain = options['domain']<commit_msg>make compile_js command compatible with django 1.10<commit_after># Copyright Collab 2015-2016
# See LICENSE for details.

"""
Extract and compile localization strings for the require.js i18n plugin.
"""

import os

from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import get_language_info, check_for_language

from require_i18n.core import UpdateCatalog


class Command(BaseCommand):
    help = 'Compile gettext catalogs used in the require.js i18n plugin.'

    def add_arguments(self, parser):
        parser.add_argument("-l", "--locale",
            dest="locale",
            help="Locale(s) to process (e.g. nl). Default is to process" +
                " all. Can be used multiple times.",
            default="all",
            metavar="LOCALE"
        )
        parser.add_argument("-d", "--domain",
            dest="domain",
            help="The domain of the message files. Default: %default",
            default="site",
            metavar="DOMAIN"
        )
        parser.add_argument("--dry-run",
            action="store_true",
            dest="dry_run",
            default=False,
            help="Simulate without updating files. Default: %default"
        )
        parser.add_argument("--no-empty",
            action="store_true",
            dest="no_empty",
            default=False,
            help="Empty compiled translation files are not allowed and will " +
                "be deleted if detected. Default: %default"
        )
        parser.add_argument("-t", "--output-type",
            dest="output_type",
            help="The type for the translated output files, either 'json' " +
                "for JSON format or 'script' for Javascript files. " +
                "Default: %default",
            default="script",
            metavar="TYPE"
        )

    def handle(self, *args, **options):
        self.locale_dir = settings.LOCALE_PATHS[0]

        # parse options
        self.dry_run = options['dry_run']
        self.domain = options['domain']
{'fraction_non_alphanumeric': 0.108140085186938, 'fraction_numerical': 0.007808802650260294, 'mean_word_length': 2.1615557217651458, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7312287', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1102, 'n_words': 318}