2022-01-21 13:01:25 +00:00
|
|
|
package query
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/logging"
|
2022-01-21 13:01:25 +00:00
|
|
|
"golang.org/x/text/language"
|
2022-02-14 16:22:30 +00:00
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/i18n"
|
2022-01-21 13:01:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (q *Queries) Languages(ctx context.Context) ([]language.Tag, error) {
|
|
|
|
if len(q.supportedLangs) == 0 {
|
|
|
|
langs, err := i18n.SupportedLanguages(q.LoginDir)
|
|
|
|
if err != nil {
|
|
|
|
logging.Log("ADMIN-tiMWs").WithError(err).Debug("unable to parse language")
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
q.supportedLangs = langs
|
|
|
|
}
|
|
|
|
return q.supportedLangs, nil
|
|
|
|
}
|