feat: site languages, setup and site URL settings
This commit is contained in:
1 parent
0806733d5c
commit
d9158025d4
106 files changed
+10184
-56
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package localization
|
||||
|
||||
import (
|
||||
"RenewCMS/internal/domain/language"
|
||||
"RenewCMS/internal/domain/site"
|
||||
)
|
||||
|
||||
type SetupSuggestion struct {
|
||||
Lang string `json:"lang"`
|
||||
Substituted bool `json:"substituted"`
|
||||
}
|
||||
|
||||
type PendingSite struct {
|
||||
Key string `json:"key"`
|
||||
Name string `json:"name"`
|
||||
Locale *string `json:"locale"`
|
||||
ArticleCount int `json:"article_count"`
|
||||
Suggestion *SetupSuggestion `json:"suggestion"`
|
||||
}
|
||||
|
||||
type SetupView struct {
|
||||
Sites []PendingSite `json:"sites"`
|
||||
Available []Option `json:"available"`
|
||||
}
|
||||
|
||||
type SetupChoice struct {
|
||||
Key string
|
||||
Lang string
|
||||
}
|
||||
|
||||
type SetupAssignment struct {
|
||||
Key string `json:"key"`
|
||||
Lang string `json:"lang"`
|
||||
Assigned int `json:"assigned"`
|
||||
}
|
||||
|
||||
type SetupResult struct {
|
||||
Assigned int `json:"assigned"`
|
||||
Sites []SetupAssignment `json:"sites"`
|
||||
Skipped []string `json:"skipped"`
|
||||
}
|
||||
|
||||
func NewPendingSite(s site.Site) PendingSite {
|
||||
pending := PendingSite{Key: s.Key, Name: s.Name, Locale: s.Locale, ArticleCount: s.ArticleCount}
|
||||
if suggestion := language.Suggest(s.Locale); suggestion.Found {
|
||||
pending.Suggestion = &SetupSuggestion{Lang: suggestion.Tag, Substituted: suggestion.Substituted}
|
||||
}
|
||||
return pending
|
||||
}
|
||||
Reference in new issue
Block a user