x/text: support error and fmt.Stringer values #29400
Labels
FeatureRequest
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, this is the latest release
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
err
are extracted and translations running displays the error in french.What did you see instead?
Diagnostic
This happens because
message.lookupAndFormat()
can only handle plain strings and message.key (unexported type) as translation keys. It would make it easier to have translatable errors and other higher-level data if the switch handlederror
andfmt.Stringer
values.error
could be converted to strings using theirError()
method, and thereafter handled as strings (id, mgs = v, v
)fmt.Stringer
could be converted to strings using theirString()
method, and handled the same way.The text was updated successfully, but these errors were encountered: