示例#1
0
def do_single(args):
    ios = grep_ios()
    android = grep_android()

    new_tags = generate_auto_tags(ios, android)

    filtered = ios
    filtered.update(android)

    strings_txt = StringsTxt()
    strings_txt.translations = {
        key: dict(strings_txt.translations[key])
        for key in filtered
    }

    strings_txt.comments_and_tags = new_comments_and_tags(
        strings_txt, filtered, new_tags)

    path = args.output if isabs(args.output) else "{0}/{1}".format(
        OMIM_ROOT, args.output)
    strings_txt.write_formatted(languages=args.langs, target_file=path)

    if args.generate:
        exec_shell("{}/unix/generate_localizations.sh".format(OMIM_ROOT),
                   args.output, args.output)
示例#2
0
def write_filtered_strings_txt(filtered, filepath, languages=None):
    logging.info("Writing strings to file {0}".format(filepath))
    strings_txt = StringsTxt()
    strings_dict = {
        key: dict(strings_txt.translations[key])
        for key in filtered
    }
    strings_txt.translations = strings_dict
    strings_txt.comments_and_tags = {}
    strings_txt.write_formatted(filepath, languages=languages)
示例#3
0
def do_missing(args):
    ios = set(grep_ios())
    strings_txt_keys = set(StringsTxt().translations.keys())
    missing = ios - strings_txt_keys

    if missing:
        for m in missing:
            logging.info(m)
        exit(1)
    logging.info("Ok. No missing strings.")
    exit(0)
示例#4
0
    def __init__(self):
        args = self.parse_args()
        self.folder_path = args.folder
        self.all_po_files = self.find_all_po_files()

        if (args.strings_txt):
            self.dest_file = StringsTxt(args.strings_txt)
        elif (args.categories_txt):
            self.dest_file = CategoriesTxt(args.categories_txt)
        else:
            raise RuntimeError("You must specify either -s or -c")