This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 582
I18n (internationalisation) support #249
Comments
will this help? i think it needs to have the files in config/locales/* in watch it seems to be not so good, because i need to detect language from header, anyone have any suggestion? |
@u007 Hum, if you look at the comments in the code: // Use Tfunc or MustTfunc to fetch a TranslateFunc that will return the translated string for a specific language.
// func handleRequest(w http.ResponseWriter, r *http.Request) {
// cookieLang := r.Cookie("lang")
// acceptLang := r.Header.Get("Accept-Language")
// defaultLang = "en-US" // known valid language
// T, err := i18n.Tfunc(cookieLang, acceptLang, defaultLang)
// fmt.Println(T("Hello world"))
// } I think it just have to be called like this in a custom middleware. |
We also need to think about, make sure, that translation files get bundled into the binary that is built. |
ive done fix in the gist, made a middleware to setup velvet with context |
markbates
added a commit
that referenced
this issue
Apr 4, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As a plugin / module, I think we can provide a way to manage translations.
Common solutions:
The text was updated successfully, but these errors were encountered: