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: p.Sprint outputs key + fallback #26519
Comments
@mvrhov, can you please elaborate a bit on this:
Is it possible you're not using the Print/Sprint functions as intended?
Result:
Note the differences: Print/Sprint vs Printf/Sprintf. So for your code: Please let me know if I'm mistaken. /cc @mpvl |
Yeah. I've seen that the function signature is different I'd say that it's still a bit unexpected. |
Okay, but can you please be more specific on what you are proposing. What API change/addition would you like to happen or what documentation would you like to change or what bug should be fixed?
This is still a bit vague to me. Can you please help me understand by elaborating more? |
The API could figure out itself if based on the first parameter which behavior it should use. e.g if the message with fallback is passed then it uses one path otherwise there is no fallback it uses the 2nd path. Unless this really slows things down. For the 2nd part. Please disregard it. The reason for the 2nd part is because I've been using different languages for the past 20years+ and have thought that the behavior is as following.. Functions ending with |
I too was confused by all of this and lost quite a bit of time trying to understand why It would be great if each argument in |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.11b2
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
What did you expect to see?
Password
What did you see instead?
{login.form.label.password Password}
T.Sprintf(message.Key("login.form.label.password", "Password"))
returns the expected output, however it's use is not necessary in many such cases, where there is no parameters for the string even the lint tool is showing warnings in such cases.The text was updated successfully, but these errors were encountered: