int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { cups_array_t *cat; /* Message catalog */ if (argc != 3) { fputs("Usage: translate cups_language.po language\n", stderr); return (1); } if (access(argv[1], 0)) cat = _cupsMessageLoad("cups.pot", 1); else cat = _cupsMessageLoad(argv[1], 1); if (!cat) { puts("Unable to load message catalog."); return (1); } if (!translate_messages(cat, argv[2])) { puts("Unable to translate message catalog."); return (1); } if (!save_messages(cat, argv[1])) { puts("Unable to save message catalog."); return (1); } return (0); }
int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { int i; /* Looping var */ if (argc < 3 || (strcmp(argv[2], "scan") && strcmp(argv[2], "prune") && strcmp(argv[2], "compile") && strcmp(argv[2], "translate"))) { puts("Usage:"); puts(""); puts(" espmsg filename.po compile"); puts(" espmsg filename.po prune filename1 filename2 ... filenameN"); puts(" espmsg filename.po scan filename1 filename2 ... filenameN"); puts(" espmsg filename.po translate {de,es,fr,it,pt}"); return (1); } load_messages(argv[1]); if (!strcmp(argv[2], "compile")) { /* * Compile the message catalog... */ compile_messages(argv[1]); } else if (!strcmp(argv[2], "translate")) { /* * Translate using google... */ if (argc != 4) { puts("Usage: espmsg filename.po translate {de,es,fr,it,pt}"); return (1); } #ifdef HAVE_LIBCUPS translate_messages(argv[3]); save_messages(argv[1]); #else puts("Sorry, the translate command was not compiled into espmsg!"); return (1); #endif /* HAVE_LIBCUPS */ } else { /* * Scan or prune... */ for (i = 3; i < argc; i ++) scan_file(argv[i]); if (strcmp(argv[2], "prune") == 0) prune_messages(); save_messages(argv[1]); } return (0); }