1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add support for the 'language' setting in the covid module (#1039)

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer 2020-12-29 13:46:08 -08:00 committed by GitHub
parent b434e79b9b
commit d341c21f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,6 @@ import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
// Widget is the struct that defines this module widget
@ -47,10 +44,12 @@ func (widget *Widget) Render() {
// Display stats based on the user's locale
func (widget *Widget) displayStats(cases int) string {
prntr := message.NewPrinter(language.English)
str := fmt.Sprintf("%s", prntr.Sprintf("%d", cases))
prntr, err := widget.settings.LocalizedPrinter()
if err != nil {
return err.Error()
}
return str
return prntr.Sprintf("%d", cases)
}
func (widget *Widget) content() (string, string, bool) {