Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksnyder committed Dec 5, 2023
1 parent b07437f commit f4a6e0a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
9 changes: 0 additions & 9 deletions v2/i18n/localizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ func (e *MessageNotFoundErr) Error() string {
return fmt.Sprintf("message %q not found in language %q", e.MessageID, e.Tag)
}

type pluralizeErr struct {
messageID string
tag language.Tag
}

func (e *pluralizeErr) Error() string {
return fmt.Sprintf("unable to pluralize %q because there no plural rule for %q", e.messageID, e.tag)
}

type messageIDMismatchErr struct {
messageID string
defaultMessageID string
Expand Down
6 changes: 0 additions & 6 deletions v2/internal/plural/codegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ func infof(format string, args ...interface{}) {

var verbose bool

func verbosef(format string, args ...interface{}) {
if verbose {
infof(format, args...)
}
}

func fatalf(format string, args ...interface{}) {
infof("fatal: "+format+"\n", args...)
os.Exit(1)
Expand Down
10 changes: 7 additions & 3 deletions v2/internal/plural/codegen/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"regexp"
"strconv"
"strings"

"golang.org/x/text/cases"
"golang.org/x/text/language"
)

// SupplementalData is the top level struct of plural.xml
Expand All @@ -22,7 +25,7 @@ type PluralGroup struct {

// Name returns a unique name for this plural group.
func (pg *PluralGroup) Name() string {
n := strings.Title(pg.Locales)
n := cases.Title(language.AmericanEnglish).String(pg.Locales)
return strings.Replace(n, " ", "", -1)
}

Expand All @@ -39,7 +42,7 @@ type PluralRule struct {

// CountTitle returns the title case of the PluralRule's count.
func (pr *PluralRule) CountTitle() string {
return strings.Title(pr.Count)
return cases.Title(language.AmericanEnglish).String(pr.Count)
}

// Condition returns the condition where the PluralRule applies.
Expand Down Expand Up @@ -100,7 +103,8 @@ func (pr *PluralRule) GoCondition() string {
if parts == nil {
continue
}
lvar, lmod, op, rhs := strings.Title(parts[1]), parts[2], parts[3], strings.TrimSpace(parts[4])
lvar := cases.Title(language.AmericanEnglish).String(parts[1])
lmod, op, rhs := parts[2], parts[3], strings.TrimSpace(parts[4])
if op == "=" {
op = "=="
}
Expand Down
2 changes: 1 addition & 1 deletion v2/internal/plural/rule_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func TestPt(t *testing.T) {
}
}

func TestCaItPt_PTVec(t *testing.T) {
func TestCaItPt_ptVec(t *testing.T) {
var tests []pluralFormTest

tests = appendIntegerTests(tests, One, []string{"1"})
Expand Down

0 comments on commit f4a6e0a

Please sign in to comment.