You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a simple web application in Go and need to provide internationalized error descriptions. I attempted to use the x/text package along with its gotext command-line tool to achieve this.
What I'm trying to achieve:
I have multiple instances of the same error message, and I aim to avoid code duplication by using a function. Below is the relevant code snippet:
I hoped that the gotext tool could assist me in extracting text, but it seems to only work for err2 and not for err1. The extracted JSON for err2 is as follows:
{
"language": "en",
"messages": [
{
"id": "Internal Server Error2",
"message": "Internal Server Error2",
"translation": "Internal Server Error2",
"translatorComment": "Copied from source.",
"placeholders": [
{
"id": "A",
"string": "%[1]v",
"type": "[]any",
"underlyingType": "[]any",
"argNum": 1,
"expr": "a"
}
],
"fuzzy": true
}
]
}
Feature request
It would be immensely helpful if gotext could automatically extract text from functions. Since err1 and err2 appear similar, both being of type i18nFactory, having gotext recognize and extract text from such functions would be a valuable addition.
The text was updated successfully, but these errors were encountered:
Proposal Details
I am developing a simple web application in Go and need to provide internationalized error descriptions. I attempted to use the x/text package along with its gotext command-line tool to achieve this.
What I'm trying to achieve:
I have multiple instances of the same error message, and I aim to avoid code duplication by using a function. Below is the relevant code snippet:
I hoped that the gotext tool could assist me in extracting text, but it seems to only work for err2 and not for err1. The extracted JSON for err2 is as follows:
Feature request
It would be immensely helpful if gotext could automatically extract text from functions. Since err1 and err2 appear similar, both being of type i18nFactory, having gotext recognize and extract text from such functions would be a valuable addition.
The text was updated successfully, but these errors were encountered: