From 4bd72126fd9a5c54845eb375ddbcc84e8f00b84d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 14 May 2025 16:58:32 -0300 Subject: Remove gobang as a dependency --- src/gotext.go | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/gotext.go') diff --git a/src/gotext.go b/src/gotext.go index c236b4b..54e05c3 100644 --- a/src/gotext.go +++ b/src/gotext.go @@ -13,8 +13,6 @@ import ( "strings" "time" "unsafe" - - g "gobang" ) @@ -84,6 +82,12 @@ func (e *translatableErrorT) Error() string { return Gettext(e.err) } +func Error(err string) error { + return &translatableErrorT{ + err: err, + } +} + func formatComment(com string) string { out := "" for _, rawline := range strings.Split(com, "\n") { @@ -309,16 +313,14 @@ func formatOutput(in string) string { } func writePotFile(out io.Writer, msgIDs map[string][]msgIDT) { - header := g.Heredoc(` - #, fuzzy - msgid "" - msgstr "" - "Language: \n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" - - `) + const header = `msgid "" +msgstr "" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +` fmt.Fprintf(out, "%s", header) // FIXME: sort by location, not by key @@ -569,9 +571,10 @@ func Init(name string, localedir string) { func Main() { - g.Init() args, rc := getopt(os.Args, os.Stderr) - g.ExitIf(rc) + if rc != 0 { + os.Exit(0) + } os.Exit(run(envT{ args: args, in: os.Stdin, -- cgit v1.2.3