Skip to content

A lib to help fetching translations from Localise to a go-i18n pattern

License

Notifications You must be signed in to change notification settings

lucasmdrs/go-loco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-loco

A simple lib to fetch translation files from Localise and save it in a go-i18n compatible format.

Checkout the V2 for multiple projects and automatic assets update.

Usage

package main

import (
	"fmt"

	loco "github.com/lucasmdrs/go-loco"
	"github.com/nicksnyder/go-i18n/i18n"
)

func main() {
	err := loco.FetchTranslations("MY_LOCALISE_KEY", "./", "pt-BR", "en-US")
	if err != nil {
		panic(err)
	}

	i18n.MustLoadTranslationFile("en-US.json")
	i18n.MustLoadTranslationFile("pt-BR.json")

	T, _ := i18n.Tfunc("pt-BR")

	fmt.Println(T("hello"))
}

About

A lib to help fetching translations from Localise to a go-i18n pattern

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages