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:
parent
b434e79b9b
commit
d341c21f4b
@ -5,9 +5,6 @@ import (
|
|||||||
|
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
"github.com/wtfutil/wtf/view"
|
"github.com/wtfutil/wtf/view"
|
||||||
|
|
||||||
"golang.org/x/text/language"
|
|
||||||
"golang.org/x/text/message"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Widget is the struct that defines this module widget
|
// 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
|
// Display stats based on the user's locale
|
||||||
func (widget *Widget) displayStats(cases int) string {
|
func (widget *Widget) displayStats(cases int) string {
|
||||||
prntr := message.NewPrinter(language.English)
|
prntr, err := widget.settings.LocalizedPrinter()
|
||||||
str := fmt.Sprintf("%s", prntr.Sprintf("%d", cases))
|
if err != nil {
|
||||||
|
return err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
return str
|
return prntr.Sprintf("%d", cases)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user