package html import i18n "dappco.re/go/core/i18n" // Context carries rendering state through the node tree. type Context struct { Identity string Locale string Entitlements func(feature string) bool Data map[string]any service *i18n.Service } // NewContext creates a new rendering context with sensible defaults. // An optional locale may be provided as the first argument. func NewContext(locale ...string) *Context { ctx := &Context{ Data: make(map[string]any), } if len(locale) > 0 { ctx.Locale = locale[0] } return ctx } // NewContextWithService creates a rendering context backed by a specific i18n service. // An optional locale may be provided as the second argument. func NewContextWithService(svc *i18n.Service, locale ...string) *Context { ctx := &Context{ Data: make(map[string]any), service: svc, } if len(locale) > 0 { ctx.Locale = locale[0] } return ctx }