mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 20:37:23 +00:00
fix: return default language file, if requested lang does not exist for default login texts (#1988)
* fix: return default language file, if requested lang doesnt exists * feat: read default translation file * feat: docs
This commit is contained in:
parent
10cae58505
commit
c950d6d272
@ -793,7 +793,7 @@ The Following Variables can be used:
|
||||
> **rpc** GetDefaultLoginTexts([GetDefaultLoginTextsRequest](#getdefaultlogintextsrequest))
|
||||
[GetDefaultLoginTextsResponse](#getdefaultlogintextsresponse)
|
||||
|
||||
Returns the default custom texts for login ui
|
||||
Returns the default custom texts for login ui (translation file)
|
||||
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@ -414,6 +415,9 @@ func (repo *IAMRepository) GetDefaultLoginTexts(ctx context.Context, lang string
|
||||
contents, ok := repo.TranslationFileContents[lang]
|
||||
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", repo.SystemDefaults.DefaultLanguage.String()))
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -629,6 +630,9 @@ func (repo *OrgRepository) GetDefaultLoginTexts(ctx context.Context, lang string
|
||||
contents, ok := repo.TranslationFileContents[lang]
|
||||
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", repo.SystemDefaults.DefaultLanguage.String()))
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1641,7 +1641,7 @@ service AdminService {
|
||||
};
|
||||
}
|
||||
|
||||
//Returns the default custom texts for login ui
|
||||
//Returns the default custom texts for login ui (translation file)
|
||||
rpc GetDefaultLoginTexts(GetDefaultLoginTextsRequest) returns (GetDefaultLoginTextsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/text/default/login/{language}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user