568eb7d26c
New URL. Include upstream patches since 0.3.7 was released.
110 lines
3.2 KiB
Diff
110 lines
3.2 KiB
Diff
From 35d2d7381c7101bb73d0b7f00fea06442c7b2ab8 Mon Sep 17 00:00:00 2001
|
|
From: Pino Toscano <ptoscano@redhat.com>
|
|
Date: Tue, 29 Aug 2017 18:29:34 +0200
|
|
Subject: [PATCH 1/3] pr_gettext: stop tracking (and printing) untranslated
|
|
strings
|
|
|
|
Do not collect anymore the information of untranslated strings, since it
|
|
is only used to print all of them at the end of the message extraction.
|
|
|
|
While I understand the reason why this was done (i.e. to discover
|
|
potentially untranslated user strings), this is something that just
|
|
causes lots of output in complex projects, since strings are basically
|
|
used for many non-UI tasks (say Str, Sys.command, etc), so the actual
|
|
result is that there are lots of false positive. Also, this is not
|
|
something xgettext (from GNU gettext) does.
|
|
---
|
|
libgettext-ocaml/pr_gettext.ml | 44 ------------------------------------------
|
|
1 file changed, 44 deletions(-)
|
|
|
|
diff --git a/libgettext-ocaml/pr_gettext.ml b/libgettext-ocaml/pr_gettext.ml
|
|
index c44933f..d78cf21 100644
|
|
--- a/libgettext-ocaml/pr_gettext.ml
|
|
+++ b/libgettext-ocaml/pr_gettext.ml
|
|
@@ -71,17 +71,10 @@ struct
|
|
module Loc = Syntax.Loc
|
|
module Ast = Syntax.Ast
|
|
|
|
- type untranslated_t =
|
|
- {
|
|
- str: string; (* Real string, not OCaml one *)
|
|
- locations: (string * int) list; (* Location in the file *)
|
|
- }
|
|
-
|
|
type t =
|
|
{
|
|
po_content: po_content;
|
|
translated: SetString.t;
|
|
- untranslated: untranslated_t MapString.t;
|
|
}
|
|
|
|
let string_of_ocaml_string str =
|
|
@@ -91,29 +84,6 @@ struct
|
|
"%S"
|
|
(fun s -> s)
|
|
|
|
- let string_not_translated t ocaml_str =
|
|
- not (SetString.mem ocaml_str t.translated)
|
|
-
|
|
- let add_untranslated t loc ocaml_str =
|
|
- let cur =
|
|
- try
|
|
- MapString.find ocaml_str t.untranslated
|
|
- with Not_found ->
|
|
- {
|
|
- str = string_of_ocaml_string ocaml_str;
|
|
- locations = [];
|
|
- }
|
|
- in
|
|
- let untranslated =
|
|
- MapString.add
|
|
- ocaml_str
|
|
- {cur with
|
|
- locations =
|
|
- (Loc.file_name loc, Loc.start_line loc) :: cur.locations}
|
|
- t.untranslated
|
|
- in
|
|
- {t with untranslated = untranslated}
|
|
-
|
|
|
|
let add_translation t loc ocaml_singular plural_opt domain =
|
|
let filepos =
|
|
@@ -164,15 +134,6 @@ struct
|
|
| Some f -> open_out f
|
|
| None -> stdout
|
|
in
|
|
- MapString.iter
|
|
- (fun _ {str = str; locations = locs} ->
|
|
- List.iter
|
|
- (fun (fn, lineno) ->
|
|
- Printf.eprintf
|
|
- "%s:%d String %S not translated\n%!"
|
|
- fn lineno str)
|
|
- locs)
|
|
- t.untranslated;
|
|
Marshal.to_channel fd t.po_content []
|
|
|
|
(* Check if the given node belong to the given functions *)
|
|
@@ -197,7 +158,6 @@ struct
|
|
val t =
|
|
{
|
|
po_content = empty_po;
|
|
- untranslated = MapString.empty;
|
|
translated = SetString.empty;
|
|
}
|
|
|
|
@@ -234,10 +194,6 @@ struct
|
|
(* Add a plural / defined domain string *)
|
|
{< t = add_translation t loc singular (Some plural) (Some domain) >}
|
|
|
|
- | <:expr@loc<$str:str$>> when
|
|
- string_not_translated t str ->
|
|
- {< t = add_untranslated t loc str >}
|
|
-
|
|
| e -> super#expr e
|
|
|
|
end
|
|
--
|
|
2.13.2
|
|
|