2022-01-21 14:01:25 +01:00
|
|
|
package query
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/logging"
|
2022-01-21 14:01:25 +01:00
|
|
|
"golang.org/x/text/language"
|
2022-02-14 17:22:30 +01:00
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/i18n"
|
2022-01-21 14:01:25 +01: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
|
|
|
|
}
|