You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i want to build multi-language support in my application.
Table is one of the widgets that uses the "label" tag of a struct field in the collection element type, which now is a constant.
The idea is to have an optional function that can do the lookup ; in the example below it is called "SetLabelFunc"
Relevant code
typelanguagestruct {
Namestring`label:"lang_name"`Ratingint`display:"-"`
}
tab:=core.NewTable(b)
tab.SetLabelFunc(func(columnIndexint, fieldName, labelTagstring) string {
// do translation lookup here, might want to use fallback labelTag or fieldNamereturn"Name"
})
tab.SetSlice(&[]language{{"Go", 10}, {"Python", 5}})
The text was updated successfully, but these errors were encountered:
@emicklei Thank you for suggesting this. I will add support for something similar to this when I have the time; it makes sense to have a generic function that gives you the actual header button and allows you set the text, icon, tooltip, etc to whatever you want. I will likely make that an interface similar to the one I will add in #1204, and I will make one for forms as well. I will probably work on this in conjunction with #1204 when I have the time.
Please also note that we will add built-in support for multiple languages in #9, but this is useful functionality regardless.
Describe the feature
i want to build multi-language support in my application.
Table is one of the widgets that uses the "label" tag of a struct field in the collection element type, which now is a constant.
The idea is to have an optional function that can do the lookup ; in the example below it is called "SetLabelFunc"
Relevant code
The text was updated successfully, but these errors were encountered: