From d341c21f4bd933ded555442fde65f28ed90f469d Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Tue, 29 Dec 2020 13:46:08 -0800 Subject: [PATCH] Add support for the 'language' setting in the covid module (#1039) Signed-off-by: Chris Cummer --- modules/covid/widget.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/covid/widget.go b/modules/covid/widget.go index 71199bda..9d2f8f8b 100644 --- a/modules/covid/widget.go +++ b/modules/covid/widget.go @@ -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) {