package assetstore

import (
	"code.ur.gs/lupine/ordoor/internal/data"
)

// Internationalisation is completely hidden inside the asset store. Everything
// comes out already converted.
//
// FIXME: Allow the language to be set. Right now, it's hardcoded to USEng
// because that's the only copy of Chaos Gate I have.
func (a *AssetStore) i18n() (*data.I18n, error) {
	if a.strings != nil {
		return a.strings, nil
	}

	filename, err := a.lookup(data.I18nFile, "", "Data")
	if err != nil {
		return nil, err
	}

	i18n, err := data.LoadI18n(filename)
	if err != nil {
		return nil, err
	}

	a.strings = i18n
	return i18n, nil
}
