Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text/cmd/gotext: support ... patterns #51866

Open
thediveo opened this issue Mar 22, 2022 · 2 comments
Open

x/text/cmd/gotext: support ... patterns #51866

thediveo opened this issue Mar 22, 2022 · 2 comments
Labels
FeatureRequest NeedsInvestigation
Milestone

Comments

@thediveo
Copy link

@thediveo thediveo commented Mar 22, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18 linux/amd64

Does this issue reproduce with the latest release?

Yes, go1.18 is the latest release as the time of filing this issue ticket.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/harald/.cache/go-build"
GOENV="/home/harald/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/harald/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/harald/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/current"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/current/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/harald/github/lxkns/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build665793402=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Inside a Go module I've created a file internal/translations/translations.go:

package translations

//go:generate gotext -srclang=en-US update -out=catalog.go -lang=en-US github.com/thediveo/lxkns/...

Then executing:

go generate ./internal/translations/

What did you expect to see?

A correctly populated file internal/translations/locales/en-US/out.gotext.json:

{
    "language": "en-US",
    "messages": [
        {
            "id": "discovered {Arg_1} composer projects",
            "message": "discovered {Arg_1} composer projects",
            "translation": "discovered {Arg_1} composer projects",
            "translatorComment": "Copied from source.",
            "placeholders": [
                {
                    "id": "Arg_1",
                    "string": "%[1]s",
                    "type": "",
                    "underlyingType": "string",
                    "argNum": 1
                }
            ],
            "fuzzy": true
        }
    ]
}

What did you see instead?

internal/translations/locales/en-US/out.gotext.json lacking any messages:

{
    "language": "en-US",
    "messages": null
}

Notes

gotext does neither work correctly with ./... nor github.com/thediveo/lxkns/...

@gopherbot gopherbot added this to the Unreleased milestone Mar 22, 2022
@thediveo thediveo changed the title x/text/cmd/gotext: x/text/cmd/gotext when specifying ./... "package" x/text/cmd/gotext: x/text/cmd/gotext failing when specifying ./... "package" Mar 22, 2022
@mknyszek
Copy link
Contributor

@mknyszek mknyszek commented Mar 22, 2022

I'm pretty sure that the ./... pattern is specific to the go command, not something generally supported across all tools? In which case, I think this is more of a feature request.

@mknyszek mknyszek changed the title x/text/cmd/gotext: x/text/cmd/gotext failing when specifying ./... "package" x/text/cmd/gotext: support ... patterns Mar 22, 2022
@mknyszek mknyszek added NeedsInvestigation FeatureRequest labels Mar 22, 2022
@thediveo
Copy link
Author

@thediveo thediveo commented Mar 22, 2022

I'm wondering how larger Go modules handle their //go:generate gotext invocations with lots of (sub) packages without ...? Go-ing meta and go-generating the //go:generate gotext invocation? Or using scripts and optionally make? It would be really useful if there would be more best practice documentation for gotext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

3 participants