def _locales_generic(names, config_file, command):

    supported = supported_locales()
    _check_for_unsupported_locales(names, supported)

    # Regenerate locales if config file changes
    with watch(config_file, use_sudo=True) as config:

        # Add valid locale names to the config file
        charset_from_name = dict(supported)
        for name in names:
            charset = charset_from_name[name]
            locale = "%s %s" % (name, charset)
            uncomment(config_file, escape(locale), use_sudo=True, shell=True)
            append(config_file, locale, use_sudo=True, partial=True, shell=True)

    if config.changed:
        run_as_root(command)
dataset/ETHPy150Open ronnix/fabtools/fabtools/require/system.py/_locales_generic/original