Skip to content

Interpolate "Login.gov" everywhere (LG-4886)#5498

Merged
zachmargolis merged 38 commits intomainfrom
margolis-lg-4886-interpolate-logingov
Oct 14, 2021
Merged

Interpolate "Login.gov" everywhere (LG-4886)#5498
zachmargolis merged 38 commits intomainfrom
margolis-lg-4886-interpolate-logingov

Conversation

@zachmargolis
Copy link
Contributor

Before: Sometimes we hardcode "Login.gov" and sometimes we use our APP_NAME constant

Now: Use APP_NAME/%{app_name} everywhere

I have a few notes, will make them inline

import useFocusFallbackRef from '../hooks/use-focus-fallback-ref';
import './selfie-capture.scss';

const APP_NAME = 'Login.gov';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question: which file should this live in? Maybe we wait for #5496 to land and then just move it inside there

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question: which file should this live in? Maybe we wait for #5496 to land and then just move it inside there

For me, I think the ideal implementation would be one where we bootstrap this with data attributes and make it available through a context provider, very similar to what we do already with service provider.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gave it a shot: fdf066d

@@ -1,5 +1,5 @@
<p class="lead">
<%= t('user_mailer.account_reset_complete.intro', app: link_to(APP_NAME, IdentityConfig.store.mailer_domain_name, class: 'gray')) %>
<%= t('user_mailer.account_reset_complete.intro_html', app_name: link_to(APP_NAME, IdentityConfig.store.mailer_domain_name, class: 'gray')) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this previously escaping the link? 🤔 (noting difference of the _html suffix)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick search reveals a couple other suspect ones, maybe out of scope to deal with here:

<%= t('user_mailer.account_reset_cancel.intro', app_name: link_to(APP_NAME, IdentityConfig.store.mailer_domain_name, class: 'gray')) %>

<%= t('.info', link: link_to(APP_NAME, root_url)) %>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one got on my radar because the specs for it broke... will leave the others for the time being

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to spot-check these, so I implemented #5502 and you were right... account_reset_cancel definitely needed a fix 1bbee5e

Copy link
Contributor Author

@zachmargolis zachmargolis Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for sps_over_quota_limit ... something is very wrong and I'm gonna declare it out of scope of this... none of the translation strings have interpolation values... it's a very blank email:

sps_over_quota_limit:
help: ''
info: There are SPs that have gone over their quota limit.
subject: Some SPs have reached their quota limit

@zachmargolis zachmargolis requested a review from aduth October 14, 2021 18:31
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admittedly a bit tough to review in great detail, but overall looks good from what I could tell!

Of my comments, only blocker is adding app_name to the other 'idv.messages.sessions.review_message' string.

local_assigns[:contact_support_option] && {
url: MarketingSite.contact_url,
text: t('idv.troubleshooting.options.contact_support', app: APP_NAME),
text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it was busted before, but this spec should be passing in the argument too:

expect(rendered).not_to have_link(
t('idv.troubleshooting.options.contact_support'),
href: MarketingSite.contact_url,
)

MarketingSite.help_url,
),
app: link_to(
app_name: link_to(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Looks like the string doesn't use app_name ?

help: If you need help, visit %{link}

(Kinda wonder how hard it'd be to make a test that verifies that all strings use all the variables we pass to it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could monkeypatch i18n.t and compare the given interp arguments with a string scan in tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyways, removed in c601b7c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took a stab at monkeypatching in d9aa159, fixed some errors in 1138ff0, will see what else pops up in CI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so that spec was too sensitive, but probably worth returning to later

  • the checks for missing i18n caught a bunch but there were some false positives for FormPasswordValidator#strong_password I couldn't sort out
  • the checks for extra i18n args were tricky because the i18n interface has a bunch of extra keys (scope, default, count) that get mixed in with the args for translating

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for trying it, I liked the idea!

@zachmargolis zachmargolis force-pushed the margolis-lg-4886-interpolate-logingov branch from 3792c52 to a825382 Compare October 14, 2021 22:04
- ex missing arg "feedback" in form password specs :/
@zachmargolis zachmargolis merged commit 27446da into main Oct 14, 2021
@zachmargolis zachmargolis deleted the margolis-lg-4886-interpolate-logingov branch October 14, 2021 22:30
@aduth aduth mentioned this pull request May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants