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/message: Print, Println funcs do not do any language-specific formatting #45471

Closed
vinser opened this issue Apr 9, 2021 · 3 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@vinser
Copy link

vinser commented Apr 9, 2021

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

$ go version
on Playground and in Docker

Does this issue reproduce with the latest release?

I don't know because I didn't use it before

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

go env Output
$ go env
on Playground and in Docker

What did you do?

package main

import (
	"golang.org/x/text/language"
	"golang.org/x/text/message"
	"os"
)

func main() {
	message.SetString(language.Dutch, "soccer", "voetbal")
	p := message.NewPrinter(language.Dutch)
	p.Println("soccer")
	p.Fprintln(os.Stdout, "soccer")
	p.Print("soccer", "\n")
	p.Printf("soccer", "\n")

}

https://play.golang.org/p/LjQ6DfG1CJX

What did you expect to see?

voetbal
voetbal
voetbal
voetbal

What did you see instead?

soccer
soccer
soccer
voetbal

@vinser vinser changed the title golang.org/x/text/message Print, Println funcs do not do any language-specific format golang.org/x/text/message Print, Println funcs do not do any language-specific formatting Apr 9, 2021
@vinser vinser changed the title golang.org/x/text/message Print, Println funcs do not do any language-specific formatting x/text/message: Print, Println funcs do not do any language-specific formatting Apr 9, 2021
@gopherbot gopherbot added this to the Unreleased milestone Apr 9, 2021
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 9, 2021
@seankhliao
Copy link
Member

@gopherbot
Copy link

Change https://golang.org/cl/315109 mentions this issue: message: properly translate when using Print

@mpvl
Copy link
Contributor

mpvl commented Oct 19, 2021

This is working as intended. Basically, only format strings or strings substituted to %m are translated. There are several reasons why this was chosen to be like this.

Changing the behavior now is a backwards incompatible change, not would it be desirable.

@vinser vinser closed this as completed May 27, 2022
@golang golang locked and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants