func loadTranslations(trPath string) error {
	files, _ := filepath.Glob(trPath + "/*.json")
	if len(files) == 0 {
		return errors.New("no translations found")
	}
	for _, file := range files {
		err := loadFileToMap(file)
		if err != nil {
			return err
		}
	}
	return nil
}
loadTranslations - load translations files from the folder
package gotrans
import (
	"encoding/json"
	"errors"
	"io/ioutil"
	"path/filepath"
	"strings"
)
type translation struct {
	locales       []string
	translations  map[string]map[string]string
	defaultLocale string
}
var trans *translation
func InitLocales(trPath string) error {
	trans = &translation{translations: make(map[string]map[string]string)}
	return loadTranslations(trPath)
}
func Tr(locale string, trKey string) string {
	if trans == nil {
		return ""
	}
	trValue, ok := trans.translations[locale][trKey]
	if ok {
		return trValue
	}
	trValue, ok = trans.translations["en"][trKey]
	if ok {
		return trValue
	}
	return trKey
}
func SetDefaultLocale(newLocale string) error {
	if trans == nil {
		return errors.New("translations are not initialized")
	}
	if checkLocale(newLocale) {
		trans.defaultLocale = newLocale
		return nil
	}
	return errors.New("locale is not found")
}
func GetDefaultLocale() string {
	if trans == nil {
		return ""
	}
	return trans.defaultLocale
}
func T(trKey string) string {
	if trans == nil {
		return ""
	}
	return Tr(trans.defaultLocale, trKey)
}
func DetectLanguage(acceptLanguage string) string {
	langList := strings.Split(acceptLanguage, ",")
	for _, langStr := range langList {
		lang := strings.Split(strings.Trim(langStr, " "), ";")
		if checkLocale(lang[0]) {
			return lang[0]
		}
	}
	return "en"
}