Skip to content

xgotext fails to extract a Get() argument #108

@bhaible

Description

@bhaible

In the example below, xgotext extracts "Test 1" but fails to extract "Test 2".

package main

import (
	"fmt"
	"github.com/leonelquinteros/gotext"
)

var NL1 = func () *gotext.Locale {
	return gotext.NewLocale(".", "fr_FR")
}

func main () {
	localizer := NL1()
	fmt.Println(localizer.Get("Test 1"))
	fmt.Println(NL1().Get("Test 2"))
}

How to reproduce:

Save the above file as in/foo.go.
Save this file as in/go.mod:

module hello
go 1.11
require github.com/leonelquinteros/gotext v1.6.0

Run

rm -f out/example.pot; ~/go/bin/xgotext -v -default example -in in -out out
cat out/example.pot; echo

Result:

msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"X-Generator: xgotext\n"

#: foo.go:14
msgid "Test 1"
msgstr ""

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions