Skip to content

Commit

Permalink
set LANG to en_US.UTF-8 if not set
Browse files Browse the repository at this point in the history
Mac os desktop app seems to not set the LANG and it causes issues when
invoking ledger/hledger commands

refer #68 and #93
  • Loading branch information
ananthakumaran committed Nov 11, 2023
1 parent 8937ca1 commit 376455c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ func InitLogger(desktop bool, hook log.Hook) {
}

func InitConfig() {
lang := os.Getenv("LANG")
if lang == "" {
lang = "en_US.UTF-8"
err := os.Setenv("LANG", lang)
if err != nil {
log.Warnf("Failed to set LANG: %s", err.Error())
} else {
log.Infof("Set LANG to %s", lang)
}
}

xdgDocumentDir := filepath.Join(xdg.UserDirs.Documents, "paisa")
xdgDocumentPath := filepath.Join(xdgDocumentDir, "paisa.yaml")
if envConfigFile := os.Getenv("PAISA_CONFIG"); envConfigFile != "" {
Expand Down

1 comment on commit 376455c

@gitting
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to have fixed #68. Thanks!

Please sign in to comment.