| 12345678910111213141516171819202122232425262728 | 
							- package main
 
- import (
 
- 	"fmt"
 
- 	"log"
 
- 	"os"
 
- 	"path/filepath"
 
- 	"github.com/leonelquinteros/gotext"
 
- )
 
- const (
 
- 	Domain          = "demo"
 
- 	TranslationsDir = "../translations"
 
- )
 
- func main() {
 
- 	pwd, err := os.Getwd()
 
- 	if err != nil {
 
- 		log.Fatalf("failed getting working directory: %v", err)
 
- 	}
 
- 	td := filepath.Join(pwd, TranslationsDir)
 
- 	if _, err := os.Stat(td); err != nil {
 
- 		log.Fatalf("cannot access translations directory %s: %V", td, err)
 
- 	}
 
- 	gotext.Configure(td, "fr_FR", "demo")
 
- 	fmt.Println(gotext.GetD(Domain, "The weather is balmy"))
 
- }
 
 
  |