Exemplo n.º 1
0
def _extract_mapping(parser_name, files, strings_to_ignore):
    reference_mapping = StringMapping()
    if len(files) > 0:
        cls = _class_from_string(parser_name)
        parser = cls()
        reference_mapping = parser.extract_string_mapping_from_files(
            files, strings_to_ignore)

    return reference_mapping
Exemplo n.º 2
0
def extract_mapping(conf, strings_to_ignore):
    """Extracts a mapping of strings to native-language translations"""
    reference_mapping = StringMapping()
    extensions_by_parser = _get_extensions_by_parser(conf)

    logger = logging.getLogger(logger_name)
    logger.info("Extracting string mapping")

    for parser_name in extensions_by_parser:
        files = []
        for extension in extensions_by_parser[parser_name]:
            regex = re.compile("\." + extension + "$")
            candidate_files = find_files_for_extension(conf, regex)
            for file in candidate_files:
                if _is_mapping_file(file, conf):
                    files.append(file)

        reference_mapping.combine_with(
            _extract_mapping(parser_name, files, strings_to_ignore))

    return reference_mapping
Exemplo n.º 3
0
def extract_mapping(conf, strings_to_ignore):
    """Extracts a mapping of strings to native-language translations"""
    reference_mapping = StringMapping()
    extensions_by_parser = _get_extensions_by_parser(conf)

    logger = logging.getLogger(logger_name)
    logger.info("Extracting string mapping")

    for parser_name in extensions_by_parser:
        files = []
        for extension in extensions_by_parser[parser_name]:
            regex = re.compile("\." + extension + "$")
            candidate_files = find_files_for_extension(conf, regex)
            for file in candidate_files:
                if _is_mapping_file(file, conf):
                    files.append(file)

        reference_mapping.combine_with(
            _extract_mapping(parser_name, files, strings_to_ignore)
        )

    return reference_mapping