Add language dependant paths

This commit is contained in:
Achim Rohn
2025-08-13 10:19:53 +02:00
parent 7bcd89d5a5
commit e3e0a8520b
2 changed files with 13 additions and 12 deletions
+6 -4
View File
@@ -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 {