Skip to content
Snippets Groups Projects
Unverified Commit bfafbb33 authored by Howon Lee's avatar Howon Lee Committed by GitHub
Browse files

Capitalize only first letter, don't mess with existing caps for unfriendly field name (#16539)

If you put in fooBarID, previous behavior on `simple` was to change to Foobarid. New behavior is to keep the caps on non-initial letters, turning it into FooBarID. So camelCaps turns into PascalCaps. ALLCAPS is Titlecapsed, tho.
parent 311f50bf
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,10 @@
(defn- capitalize-word [word]
(if (contains? acronyms (str/lower-case word))
(str/upper-case word)
(str/capitalize word)))
;; We are assuming that ALL_UPPER_CASE means we should be Title Casing
(if (= word (str/upper-case word))
(str/capitalize word)
(str (str/capitalize (subs word 0 1)) (subs word 1)))))
;; simple replaces hyphens and underscores with spaces and capitalizes
(defmethod name->human-readable-name :simple
......
......@@ -19,12 +19,13 @@
"url" "URL"
"_agent_invite_migration" "Agent Invite Migration"
"-agent-invite-migration" "Agent Invite Migration"
"fooBar" "Foobar"
"fooBar" "FooBar"
"foo-bar" "Foo Bar"
"foo_bar" "Foo Bar"
"foo bar" "Foo Bar"
"dashboardcardsubscription" "Dashboardcardsubscription"
"foo_id" "Foo ID"
"fooID" "FooID"
"receiver_id" "Receiver ID"
"inbox" "Inbox"
"acquirer" "Acquirer"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment