internal,static/frontend: change identifier to symbol

All references to identifier are changed to symbol.

A capitalize method is added to the frontend template
functions, which runs strings.Title. This is used to
capitalize the string "symbol" in templates so that we
can use basePage.SearchModeSymbol, instead of a hardcoded
string, in case this changes again in the future.

For golang/go#44142

Change-Id: Ia72c7bd31213c508050cd8756b5eae099736d3ba
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/341869
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Julie Qiu <julie@golang.org>
diff --git a/internal/frontend/search.go b/internal/frontend/search.go
index b5bcbdf..4bb1151 100644
--- a/internal/frontend/search.go
+++ b/internal/frontend/search.go
@@ -257,7 +257,7 @@
 
 	// searchModeSymbol is the keyword prefix and query param for searching
 	// by symbols.
-	searchModeSymbol = "identifier"
+	searchModeSymbol = "symbol"
 )
 
 // serveSearch applies database data to the search template. Handles endpoint
diff --git a/internal/frontend/server.go b/internal/frontend/server.go
index 1cbb637..8e75c7c 100644
--- a/internal/frontend/server.go
+++ b/internal/frontend/server.go
@@ -542,6 +542,7 @@
 		return strings.Join(s, ", ")
 	},
 	"stripscheme": stripScheme,
+	"capitalize":  strings.Title,
 }
 
 func stripScheme(url string) string {
diff --git a/static/frontend/homepage/homepage.tmpl b/static/frontend/homepage/homepage.tmpl
index 1fabc16..93a889a 100644
--- a/static/frontend/homepage/homepage.tmpl
+++ b/static/frontend/homepage/homepage.tmpl
@@ -20,7 +20,7 @@
         {{if .Experiments.IsActive "symbol-search"}}
           <select name="m" class="go-Select">
             <option value="packages">Packages</option>
-            <option value="identifiers">Identifiers</option>
+            <option value="{{.SearchModeSymbol}}s">{{capitalize .SearchModeSymbol}}s</option>
           </select>
         {{end}}
         <input
diff --git a/static/frontend/search/search.tmpl b/static/frontend/search/search.tmpl
index eaf1065..e7fbc91 100644
--- a/static/frontend/search/search.tmpl
+++ b/static/frontend/search/search.tmpl
@@ -16,7 +16,7 @@
   <main class="go-Container">
     <div class="go-Content SearchResults">
       {{if eq .SearchMode .SearchModeSymbol }}
-        {{template "search_identifier" .}}
+        {{template "search_symbol" .}}
       {{else}}
         {{template "search_package" .}}
       {{end}}
@@ -27,13 +27,13 @@
   </main>
 {{end}}
 
-{{define "search_identifier"}}
-  <h1>Identifiers matching “{{.Query}}”</h1>
+{{define "search_symbol"}}
+  <h1>{{capitalize .SearchModeSymbol}}s matching “{{.Query}}”</h1>
   {{if gt (len .Results) 0}}
     <div class="SearchResults-summary">
       <div>
         <div>
-          Showing <strong>{{len $.Results}}</strong> matching identifiers.
+          Showing <strong>{{len $.Results}}</strong> matching {{.SearchModeSymbol}}s.
           <a href="/search-help">Search help</a>
         </div>
       </div>
@@ -46,11 +46,11 @@
       Try searching for a package by visiting <a href="https://pkg.go.dev/search?q={{.Query}}">pkg.go.dev/search?q={{.Query}}</a>.
     </p>
   {{else}}
-    {{template "search_identifier_results" .}}
+    {{template "search_symbol_results" .}}
   {{end}}
 {{end}}
 
-{{define "search_identifier_results"}}
+{{define "search_symbol_results"}}
   <div>
     {{$query := .Query}}
     {{range $i, $r := .Results}}
diff --git a/static/shared/header/header.tmpl b/static/shared/header/header.tmpl
index e23bf39..d090205 100644
--- a/static/shared/header/header.tmpl
+++ b/static/shared/header/header.tmpl
@@ -81,7 +81,7 @@
     {{if .Experiments.IsActive "symbol-search"}}
       <select name="m" class="go-Select js-searchModeSelect">
         <option value="{{.SearchModePackage}}">Packages</option>
-        <option {{if eq .SearchMode .SearchModeSymbol}}selected{{end}} value="{{.SearchModeSymbol}}">Identifiers</option>
+        <option {{if eq .SearchMode .SearchModeSymbol}}selected{{end}} value="{{.SearchModeSymbol}}">{{capitalize .SearchModeSymbol}}s</option>
       </select>
     {{end}}
     <input name="q" class="go-Input js-searchFocus" aria-label="Search for a package" type="search"