mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 01:37:24 +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))
|
> **rpc** GetDefaultLoginTexts([GetDefaultLoginTextsRequest](#getdefaultlogintextsrequest))
|
||||||
[GetDefaultLoginTextsResponse](#getdefaultlogintextsresponse)
|
[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"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -414,6 +415,9 @@ func (repo *IAMRepository) GetDefaultLoginTexts(ctx context.Context, lang string
|
|||||||
contents, ok := repo.TranslationFileContents[lang]
|
contents, ok := repo.TranslationFileContents[lang]
|
||||||
if !ok {
|
if !ok {
|
||||||
contents, err := repo.readTranslationFile(fmt.Sprintf("/i18n/%s.yaml", lang))
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -629,6 +630,9 @@ func (repo *OrgRepository) GetDefaultLoginTexts(ctx context.Context, lang string
|
|||||||
contents, ok := repo.TranslationFileContents[lang]
|
contents, ok := repo.TranslationFileContents[lang]
|
||||||
if !ok {
|
if !ok {
|
||||||
contents, err := repo.readTranslationFile(fmt.Sprintf("/i18n/%s.yaml", lang))
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
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) {
|
rpc GetDefaultLoginTexts(GetDefaultLoginTextsRequest) returns (GetDefaultLoginTextsResponse) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/text/default/login/{language}";
|
get: "/text/default/login/{language}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user