-
-
Notifications
You must be signed in to change notification settings - Fork 141
extract text to translation ready files -- Bill Detail Page #1860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract text to translation ready files -- Bill Detail Page #1860
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
isplay when there is only one co-sponsor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on! A few comments:
how to display bills with no primary sponsor?
Let's check in with Matt Victor - I'm not actually sure what it means for a bill to have no primary sponsor, so it might be a data error. Your fallback seems reasonable if we don't have a better answer for why this would happen.
right spot for a translation util? (but it's nbd) Intuitively, the new translation utils would've gone in the existing components/translations.tsx file, but this file is actually a server-side rendering utility, so instead I've created a new file components/i18n.ts. Ideally, components/translations.tsx is renamed/moved elsewhere to better indicate its responsibility in SSR.
Seems sensible to me.
right spot for translations not super clear (but it's nbd) Whether or not the new translations should go under the existing common.json or a new json file is kind of an arbitrary decision. common.json has some bill stuff, but then other bill stuff have their own file (e.g. billSearch.json). Overall, not super important either way. I just went with dumping them in common.json.
As a general rule: Anything that's part of omnipresent or shared UI elements (e.g. the header/footer) belongs in common.json
. Anything that lives on a specific page (e.g. the text on the "Submit Testimony" page) should go in a ***.json
related to that page.
That said, we're not as strict about that as maybe we should be (partly because this process has involved updating a bunch of old code where it's not always easy to tell all the places where certain components are getting used).
@Mephistic ok I've removed
Talking to @mvictor55 today, he implied that there ought to always be a primary sponsor, falling back to the executive when there isn't a legisltive one, but that making sure we get this detail right in the data scrape is not a worthwhile endeavor right now. so since that is the case and since the codebase itself declares |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
useTranslation
(fromnext-i18next
) to better handle localized date formatting (fromdate-fns
)*Why? multiple areas require formatting dates according to the locale. this compartmentalizes the logic to a single spot.
Checklist
Screenshots
Note: You should notice no changes!
🖱️ Click to see screenshots
Known issues
how to display bills with no primary sponsor?
right spot for a translation util? (but it's nbd)
components/translations.tsx
file, but this file is actually a server-side rendering utility, so instead I've created a new filecomponents/i18n.ts
. Ideally,components/translations.tsx
is renamed/moved elsewhere to better indicate its responsibility in SSR.right spot for translations not super clear (but it's nbd)
common.json
or a new json file is kind of an arbitrary decision.common.json
has some bill stuff, but then other bill stuff have their own file (e.g.billSearch.json
). Overall, not super important either way. I just went with dumping them incommon.json
.Steps to test/reproduce