func (tm TranslatorMap) Get(lang string) Translator {
	return tm[lang]
}
Get returns a translator by language.
package i18n
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"path/filepath"
	"strings"
	"text/template"
	"github.com/cuigh/auxo/config"
	"github.com/cuigh/auxo/encoding/yaml"
	"github.com/cuigh/auxo/ext/files"
)
var mgr = new(Manager)
func Get(lang string) (Translator, error) {
	return mgr.Get(lang)
}
func Find(langs ...string) (t Translator, err error) {
	for _, lang := range langs {
		t, err = mgr.Find(lang)
		if t != nil || err != nil {
			return
		}
	}
	return
}
func All() (TranslatorMap, error) {
	return mgr.All()
}
type Manager struct {
	dirs []string
}
func New(dirs ...string) *Manager {
	return &Manager{
		dirs: dirs,
	}
}
func (m *Manager) Find(lang string) (t Translator, err error) {
	t, err = m.Get(lang)
	if t != nil || err != nil {
		return
	}
	for i := strings.LastIndexByte(lang, '-'); i != -1; i = strings.LastIndexByte(lang, '-') {
		t, err = m.Get(lang[:i])
		if t != nil || err != nil {
			return
		}
	}
	return
}
func (m *Manager) Get(lang string) (t Translator, err error) {
	dirs := m.getDirs()
	for _, dir := range dirs {
		filename := filepath.Join(dir, lang+".yml")
		if files.Exist(filename) {
			return NewTranslator(lang, filename)
		}
	}
	return
}
func (m *Manager) All() (TranslatorMap, error) {
	tm := TranslatorMap{}
	dirs := m.getDirs()
	for _, dir := range dirs {
		matches, err := filepath.Glob(filepath.Join(dir, "*.yml"))
		if err != nil {
			return nil, err
		}
		for _, f := range matches {
			lang := strings.TrimSuffix(filepath.Base(f), ".yml")
			t, err := NewTranslator(lang, f)
			if err != nil {
				return nil, err
			}
			tm[lang] = t
		}
	}
	return tm, nil
}
func (m *Manager) getDirs() []string {
	if len(m.dirs) == 0 {
		m.dirs = config.FindFolders("i18n")
	}
	return m.dirs
}
type TranslatorMap map[string]Translator