diff --git a/internal/utils/tags.go b/internal/utils/tags.go index 216481d..9e2235f 100644 --- a/internal/utils/tags.go +++ b/internal/utils/tags.go @@ -4,14 +4,8 @@ import ( "sort" "strings" "unicode" - - "golang.org/x/text/cases" - "golang.org/x/text/language" ) -// titleCaser is a global caser for titlecase conversion -var titleCaser = cases.Title(language.Und) - // titlecase converts a string to title case while preserving hyphenation and apostrophes // Example: "science fiction" → "Science Fiction", "non-fiction" → "Non-Fiction", "o'reilly" → "O'Reilly" func titlecase(s string) string { @@ -34,7 +28,12 @@ func titlecase(s string) string { } words[i] = result.String() } else { - words[i] = titleCaser.String(word) + runes := []rune(word) + runes[0] = unicode.ToUpper(runes[0]) + for j := 1; j < len(runes); j++ { + runes[j] = unicode.ToLower(runes[j]) + } + words[i] = string(runes) } } return strings.Join(words, " ")