mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-16 10:41:34 +00:00
fix: translation file read (#2009)
* feat: translation file read * feat: readme
This commit is contained in:
@@ -628,9 +628,10 @@ func (repo *OrgRepository) GetDefaultLoginTexts(ctx context.Context, lang string
|
||||
repo.mutex.Lock()
|
||||
defer repo.mutex.Unlock()
|
||||
contents, ok := repo.TranslationFileContents[lang]
|
||||
var err error
|
||||
if !ok {
|
||||
contents, err := repo.readTranslationFile(fmt.Sprintf("/i18n/%s.yaml", lang))
|
||||
if os.IsNotExist(err) {
|
||||
contents, err = repo.readTranslationFile(fmt.Sprintf("/i18n/%s.yaml", lang))
|
||||
if errors.IsNotFound(err) {
|
||||
contents, err = repo.readTranslationFile(fmt.Sprintf("/i18n/%s.yaml", repo.SystemDefaults.DefaultLanguage.String()))
|
||||
}
|
||||
if err != nil {
|
||||
@@ -771,6 +772,9 @@ func (repo *OrgRepository) getIAMEvents(ctx context.Context, sequence uint64) ([
|
||||
|
||||
func (repo *OrgRepository) readTranslationFile(filename string) ([]byte, error) {
|
||||
r, err := repo.LoginDir.Open(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return nil, errors.ThrowNotFound(err, "TEXT-93nfl", "Errors.TranslationFile.NotFound")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "TEXT-3n8fs", "Errors.TranslationFile.ReadError")
|
||||
}
|
||||
|
Reference in New Issue
Block a user