def find_movable_strings()

in library/scripts/find_movable_strings.py [0:0]


def find_movable_strings(sp_config, print_reverse=False):
    xml_files = subprocess.check_output(
        sp_config.find_resource_files_command, shell=True, encoding="ASCII"
    ).split("\n")

    not_movable = generate_non_movable_set(sp_config, xml_files)

    strings_to_move = set()
    for source_file in sp_config.get_default_string_files():
        with open(source_file) as english_sources:
            for match in NAME_CATCHER_RE.findall(english_sources.read()):
                msg_name = match[1]
                if msg_name in not_movable:
                    if print_reverse:
                        print(msg_name)
                    continue
                strings_to_move.add(match)

    # Don't output IDs if we are interested in the unmovable strings.
    if not print_reverse:
        output_string_ids_map(sp_config, strings_to_move)