12345678910111213141516171819202122 |
- package i18n
- import (
- "fmt"
- "net/http"
- )
- func HelloHandlerFunc(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Hello, world")
- }
- // helloHandler implements http.Handler.
- type helloHandler struct{}
- func (h helloHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Hello, world")
- }
- func ExampleWithPrinter() {
- http.Handle("/h", WithLocalizer(helloHandler{}))
- http.Handle("/hf", WithLocalizer(http.HandlerFunc(HelloHandlerFunc)))
- }
|