Repository: internetarchive/openlibrary

Issue:
My Books header title localization broken for some pages
<!-- IMPORTANT: Before posting, be sure to redact or remove sensitive data, such as passwords, secret keys, session cookies, etc. -->
<!-- What problem are we solving? What does the experience look like today? What are the symptoms? -->

### Evidence / Screenshot (if possible)
When visiting any reading log page or the list overview page with a language other than English selected, the header title is an empty string.

![image](https://github.com/internetarchive/openlibrary/assets/28732543/eb36ab1d-4852-47ea-bf17-442b3f36001f)

### Relevant url?
<!-- `https://openlibrary.org/...` -->

### Steps to Reproduce
<!-- What steps caused you to find the bug? -->
1. Go to any reading log overview page (or list overview page).
2. Select Spanish from the language dropper.

<!-- What actually happened after these steps? What did you expect to happen? -->
* Actual: Breadcrumb selector is empty
* Expected: Breadcrumb selector tells me which page I'm looking at.

### Details

- **Logged in (Y/N)?** Y
- **Browser type/version?** Any
- **Operating system?** Any
- **Environment (prod/dev/local)?** prod
<!-- If not sure, put prod -->

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->

### Stakeholders
<!-- @ tag stakeholders of this bug -->



Discussion:

Resolving patch:
diff --git a/openlibrary/plugins/openlibrary/lists.py b/openlibrary/plugins/openlibrary/lists.py
--- a/openlibrary/plugins/openlibrary/lists.py
+++ b/openlibrary/plugins/openlibrary/lists.py
@@ -224,7 +224,10 @@ def GET(self, path):
             template = render_template(
                 "lists/lists.html", mb.user, mb.user.get_lists(), show_header=False
             )
-            return mb.render(template=template, header_title=_("Lists"))
+            return mb.render(
+                template=template,
+                header_title=_("Lists (%(count)d)", count=len(mb.lists)),
+            )
         else:
             doc = self.get_doc(path)
             if not doc:
diff --git a/openlibrary/plugins/upstream/mybooks.py b/openlibrary/plugins/upstream/mybooks.py
--- a/openlibrary/plugins/upstream/mybooks.py
+++ b/openlibrary/plugins/upstream/mybooks.py
@@ -223,12 +223,18 @@ class mybooks_readinglog(delegate.page):
     path = r'/people/([^/]+)/books/(want-to-read|currently-reading|already-read)'
 
     def GET(self, username, key='want-to-read'):
+        mb = MyBooksTemplate(username, key)
         KEYS_TITLES = {
-            'currently-reading': _("Currently Reading"),
-            'want-to-read': _("Want to Read"),
-            'already-read': _("Already Read"),
+            'currently-reading': _(
+                "Want to Read (%(count)d)", count=mb.counts['want-to-read']
+            ),
+            'want-to-read': _(
+                "Currently Reading (%(count)d)", count=mb.counts['currently-reading']
+            ),
+            'already-read': _(
+                "Already Read (%(count)d)", count=mb.counts['already-read']
+            ),
         }
-        mb = MyBooksTemplate(username, key)
         if mb.is_my_page or mb.is_public:
             template = self.render_template(mb)
             return mb.render(header_title=KEYS_TITLES[key], template=template)


Test patch: