Skip to content

Commit

Permalink
fix(i18n): lint, review and clean up a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Goutte committed Nov 4, 2023
1 parent 775014c commit cdb680a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ clean:
rm -rf $(BIN)

i18n_extract:
$(info ******************** extracting translation files ********************)
goi18n extract -outdir translations
goi18n merge -outdir translations translations/*

i18n_merge:
$(info ******************** merging translation files ********************)
goi18n merge -outdir translations translations/*
12 changes: 8 additions & 4 deletions localizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cobra
import (
"embed"
"fmt"
"os"

"github.com/BurntSushi/toml"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
"os"
)

var defaultLanguage = language.English
Expand Down Expand Up @@ -366,10 +367,13 @@ func detectLangs() []string {

func appendLang(langs *[]string, lang language.Tag) {
langString := lang.String()
langBase, _ := lang.Base()
*langs = append(*langs, langString)
*langs = append(*langs, langBase.ISO3())
*langs = append(*langs, langBase.String())

langBase, confidentInBase := lang.Base()
if confidentInBase != language.No {
*langs = append(*langs, langBase.String())
*langs = append(*langs, langBase.ISO3())
}
}

func setupLocalizer() {
Expand Down

0 comments on commit cdb680a

Please sign in to comment.