def update_catalogs(resources=None, languages=None):
    """
    Update the en/LC_MESSAGES/django.po (all) files with
    new/updated translatable strings.
    """
    cmd = makemessages.Command()
    opts = {
        "locale": ["en"],
        "exclude": [],
        "extensions": ["py", "jinja"],

        # Default values
        "domain": "django",
        "all": False,
        "symlinks": False,
        "ignore_patterns": [],
        "use_default_ignore_patterns": True,
        "no_wrap": False,
        "no_location": False,
        "no_obsolete": False,
        "keep_pot": False,
        "verbosity": 0,
    }

    if resources is not None:
        print("`update_catalogs` will always process all resources.")

    os.chdir(os.getcwd())
    print("Updating en catalogs for all taiga-back resourcess...")
    cmd.handle(**opts)

    # Output changed stats
    contrib_dirs = _get_locale_dirs(None)
    for name, dir_ in contrib_dirs:
        _check_diff(name, dir_)
Esempio n. 2
0
def update_catalogs(resources=None, languages=None):
    """
    Update the en/LC_MESSAGES/django.po (all) files with
    new/updated translatable strings.
    """
    os.chdir(os.getcwd())

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.common')
    from django.conf import settings

    settings.configure()
    django.setup()

    cmd = makemessages.Command()
    opts = {
        "locale": [SOURCE_LANG],
        "exclude": [],
        "extensions": ["py", "jinja"],

        # Default values
        "domain": "django",
        "all": False,
        "symlinks": False,
        "ignore_patterns": [],
        "use_default_ignore_patterns": True,
        "no_wrap": False,
        "no_location": False,
        "no_obsolete": False,
        "keep_pot": False,
        "verbosity": 0,
        "add_location": None,
    }

    if resources is not None:
        print("`update_catalogs` will always process all resources.")

    print("Updating en catalogs for all taiga-back resourcess...")
    call_command(cmd, **opts)

    ## Output changed stats
    contrib_dirs = _get_locale_dirs(None)
    for name, dir_ in contrib_dirs:
        _check_diff(name, dir_)