diff options
-rw-r--r-- | src/gotext.go | 14 | ||||
-rw-r--r-- | tests/gotext.go | 48 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/gotext.go b/src/gotext.go index 480a812..b92d339 100644 --- a/src/gotext.go +++ b/src/gotext.go @@ -51,7 +51,7 @@ var ( -type msgID struct{ +type msgIDT struct{ msgidPlural string comment string fname string @@ -148,7 +148,7 @@ func constructValue(val interface{}) string { func inspectNodeForTranslations( args argsT, - msgIDs map[string][]msgID, + msgIDs map[string][]msgIDT, fset *token.FileSet, f *ast.File, n ast.Node, @@ -217,7 +217,7 @@ func inspectNodeForTranslations( msgidStr := formatI18nStr(i18nStr) posCall := fset.Position(n.Pos()) - msgIDs[msgidStr] = append(msgIDs[msgidStr], msgID{ + msgIDs[msgidStr] = append(msgIDs[msgidStr], msgIDT{ formatHint: formatHint, msgidPlural: formatI18nStr(i18nStrPlural), fname: posCall.Filename, @@ -247,9 +247,9 @@ func formatI18nStr(s string) string { return s } -func processFiles(args argsT) (map[string][]msgID, error) { +func processFiles(args argsT) (map[string][]msgIDT, error) { // go over the input files - msgIDs := map[string][]msgID{} + msgIDs := map[string][]msgIDT{} fset := token.NewFileSet() for _, fname := range args.subArgs { @@ -264,7 +264,7 @@ func processFiles(args argsT) (map[string][]msgID, error) { func processSingleGoSource( args argsT, - msgIDs map[string][]msgID, + msgIDs map[string][]msgIDT, fset *token.FileSet, fname string, ) error { @@ -300,7 +300,7 @@ func formatOutput(in string) string { } } -func writePotFile(out io.Writer, msgIDs map[string][]msgID) { +func writePotFile(out io.Writer, msgIDs map[string][]msgIDT) { header := g.Heredoc(` #, fuzzy msgid "" diff --git a/tests/gotext.go b/tests/gotext.go index 25f0f3a..dfcbc99 100644 --- a/tests/gotext.go +++ b/tests/gotext.go @@ -57,9 +57,9 @@ func test_processFiles() { keyword: "i18n.G", })) - g.TAssertEqual(msgIDs, map[string][]msgID{ - "foo": []msgID{ - msgID{ + g.TAssertEqual(msgIDs, map[string][]msgIDT{ + "foo": []msgIDT{ + msgIDT{ comment: "#. TRANSLATORS: a comment\n", fname: fname, line: 5, @@ -86,8 +86,8 @@ func test_processFiles() { keyword: "i18n.G", })) - g.TAssertEqual(msgIDs, map[string][]msgID{ - "foo": []msgID{ + g.TAssertEqual(msgIDs, map[string][]msgIDT{ + "foo": []msgIDT{ { comment: "#. TRANSLATORS: comment 1\n", fname: fname, @@ -116,8 +116,8 @@ func test_processFiles() { keyword: "i18n.G", })) - g.TAssertEqual(msgIDs, map[string][]msgID{ - "foo\\nbar\\nbaz": []msgID{ + g.TAssertEqual(msgIDs, map[string][]msgIDT{ + "foo\\nbar\\nbaz": []msgIDT{ { comment: "#. TRANSLATORS: a comment\n", fname: fname, @@ -166,8 +166,8 @@ func test_writePotFile() { g.TestStart("writePotFile()") g.Testing("write simple file", func() { - msgIDs := map[string][]msgID{ - "foo": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo": []msgIDT{ { fname: "fname", line: 2, @@ -197,8 +197,8 @@ func test_writePotFile() { }) g.Testing("write template with 2 entries", func() { - msgIDs := map[string][]msgID{ - "foo": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo": []msgIDT{ { fname: "fname", line: 2, @@ -234,8 +234,8 @@ func test_writePotFile() { }) g.Testing("template without comment", func() { - msgIDs := map[string][]msgID{ - "foo": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo": []msgIDT{ { fname: "fname", line: 2, @@ -263,8 +263,8 @@ func test_writePotFile() { }) g.Testing("output without location", func() { - msgIDs := map[string][]msgID{ - "foo": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo": []msgIDT{ { fname: "fname", line: 2, @@ -293,8 +293,8 @@ func test_writePotFile() { }) g.Testing("output with hint", func() { - msgIDs := map[string][]msgID{ - "foo": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo": []msgIDT{ { fname: "fname", line: 2, @@ -325,8 +325,8 @@ func test_writePotFile() { }) g.Testing("output with plural", func() { - msgIDs := map[string][]msgID{ - "foo": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo": []msgIDT{ { msgidPlural: "plural", fname: "fname", @@ -358,8 +358,8 @@ func test_writePotFile() { }) g.Testing("multiline output", func() { - msgIDs := map[string][]msgID{ - "foo\\nbar\\nbaz": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo\\nbar\\nbaz": []msgIDT{ { fname: "fname", line: 2, @@ -391,14 +391,14 @@ func test_writePotFile() { }) g.Testing("output tidy output", func() { - msgIDs := map[string][]msgID{ - "foo\\nbar\\nbaz": []msgID{ + msgIDs := map[string][]msgIDT{ + "foo\\nbar\\nbaz": []msgIDT{ { fname: "fname", line: 2, }, }, - "zzz\\n": []msgID{ + "zzz\\n": []msgIDT{ { fname: "fname", line: 4, |