Add language dependant paths
This commit is contained in:
@@ -72,20 +72,22 @@ func (t I18nText) GetKey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type LanguagePaths map[Language]string
|
||||
|
||||
type ActivePath struct {
|
||||
I18nText
|
||||
Path string
|
||||
Paths LanguagePaths
|
||||
}
|
||||
|
||||
func NewActivePath(path string, langMap map[Language]string) ActivePath {
|
||||
func NewActivePath(langMap map[Language]string, paths LanguagePaths) ActivePath {
|
||||
return ActivePath{
|
||||
I18nText: NewI18nText(langMap),
|
||||
Path: path,
|
||||
Paths: paths,
|
||||
}
|
||||
}
|
||||
|
||||
func (a ActivePath) GetPath(language Language) string {
|
||||
return "/" + string(language) + a.Path
|
||||
return "/" + string(language) + a.Paths[language]
|
||||
}
|
||||
|
||||
func (a ActivePath) IsActive(c HtmxContext) bool {
|
||||
|
||||
Reference in New Issue
Block a user