@matheusbsbs / matheus-bagliano / commits / 2fc5f9f189
Fork 0

i18n: git-grep basic messages

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Feb 22, 2011 at 23:41 UTC 2fc5f9f189512b82f2154658079e9c3889d4c136
1 file changed +16 -16
builtin/grep.c
+16 -16
@@ -245,7 +245,7 @@ static void start_threads(struct grep_opt *opt)
245 err = pthread_create(&threads[i], NULL, run, o);
246
247 if (err)
248 - die("grep: failed to create thread: %s",
248 + die(_("grep: failed to create thread: %s"),
249 strerror(err));
250 }
251 }
@@ -450,7 +450,7 @@ static void *load_sha1(const unsigned char *sha1, unsigned long *size,
450 void *data = lock_and_read_sha1_file(sha1, &type, size);
451
452 if (!data)
453 - error("'%s': unable to read %s", name, sha1_to_hex(sha1));
453 + error(_("'%s': unable to read %s"), name, sha1_to_hex(sha1));
454
455 return data;
456 }
@@ -501,7 +501,7 @@ static void *load_file(const char *filename, size_t *sz)
501 if (lstat(filename, &st) < 0) {
502 err_ret:
503 if (errno != ENOENT)
504 - error("'%s': %s", filename, strerror(errno));
504 + error(_("'%s': %s"), filename, strerror(errno));
505 return 0;
506 }
507 if (!S_ISREG(st.st_mode))
@@ -512,7 +512,7 @@ static void *load_file(const char *filename, size_t *sz)
512 goto err_ret;
513 data = xmalloc(*sz + 1);
514 if (st.st_size != read_in_full(i, data, *sz)) {
515 - error("'%s': short read %s", filename, strerror(errno));
515 + error(_("'%s': short read %s"), filename, strerror(errno));
516 close(i);
517 free(data);
518 return 0;
@@ -574,7 +574,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix)
574 argv[path_list->nr] = NULL;
575
576 if (prefix && chdir(prefix))
577 - die("Failed to chdir: %s", prefix);
577 + die(_("Failed to chdir: %s"), prefix);
578 status = run_command_v_opt(argv, RUN_USING_SHELL);
579 if (status)
580 exit(status);
@@ -664,7 +664,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
664
665 data = lock_and_read_sha1_file(entry.sha1, &type, &size);
666 if (!data)
667 - die("unable to read tree (%s)",
667 + die(_("unable to read tree (%s)"),
668 sha1_to_hex(entry.sha1));
669 init_tree_desc(&sub, data, size);
670 hit |= grep_tree(opt, paths, &sub, tree_name, down);
@@ -690,13 +690,13 @@ static int grep_object(struct grep_opt *opt, const char **paths,
690 data = read_object_with_reference(obj->sha1, tree_type,
691 &size, NULL);
692 if (!data)
693 - die("unable to read tree (%s)", sha1_to_hex(obj->sha1));
693 + die(_("unable to read tree (%s)"), sha1_to_hex(obj->sha1));
694 init_tree_desc(&tree, data, size);
695 hit = grep_tree(opt, paths, &tree, name, "");
696 free(data);
697 return hit;
698 }
699 - die("unable to grep from object of type %s", typename(obj->type));
699 + die(_("unable to grep from object of type %s"), typename(obj->type));
700 }
701
702 static int grep_objects(struct grep_opt *opt, const char **paths,
@@ -748,7 +748,7 @@ static int context_callback(const struct option *opt, const char *arg,
748 }
749 value = strtol(arg, (char **)&endp, 10);
750 if (*endp) {
751 - return error("switch `%c' expects a numerical value",
751 + return error(_("switch `%c' expects a numerical value"),
752 opt->short_name);
753 }
754 grep_opt->pre_context = grep_opt->post_context = value;
@@ -764,7 +764,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
764
765 patterns = fopen(arg, "r");
766 if (!patterns)
767 - die_errno("cannot open '%s'", arg);
767 + die_errno(_("cannot open '%s'"), arg);
768 while (strbuf_getline(&sb, patterns, '\n') == 0) {
769 char *s;
770 size_t len;
@@ -1005,11 +1005,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
1005 }
1006
1007 if (!opt.pattern_list)
1008 - die("no pattern given.");
1008 + die(_("no pattern given."));
1009 if (!opt.fixed && opt.ignore_case)
1010 opt.regflags |= REG_ICASE;
1011 if ((opt.regflags != REG_NEWLINE) && opt.fixed)
1012 - die("cannot mix --fixed-strings and regexp");
1012 + die(_("cannot mix --fixed-strings and regexp"));
1013
1014 #ifndef NO_PTHREADS
1015 if (online_cpus() == 1 || !grep_threads_ok(&opt))
@@ -1034,7 +1034,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
1034 if (!get_sha1(arg, sha1)) {
1035 struct object *object = parse_object(sha1);
1036 if (!object)
1037 - die("bad object %s", arg);
1037 + die(_("bad object %s"), arg);
1038 add_object_array(object, arg, &list);
1039 continue;
1040 }
@@ -1086,9 +1086,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
1086
1087 if (!use_index) {
1088 if (cached)
1089 - die("--cached cannot be used with --no-index.");
1089 + die(_("--cached cannot be used with --no-index."));
1090 if (list.nr)
1091 - die("--no-index cannot be used with revs.");
1091 + die(_("--no-index cannot be used with revs."));
1092 hit = grep_directory(&opt, paths);
1093 } else if (!list.nr) {
1094 if (!cached)
@@ -1097,7 +1097,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
1097 hit = grep_cache(&opt, paths, cached);
1098 } else {
1099 if (cached)
1100 - die("both --cached and trees are given.");
1100 + die(_("both --cached and trees are given."));
1101 hit = grep_objects(&opt, paths, &list);
1102 }
1103