Skip to content
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

Initial support for Pocket l10n using Fluent strings in Bedrock #11541

Merged
merged 27 commits into from
May 3, 2022

Conversation

stevejalim
Copy link
Collaborator

@stevejalim stevejalim commented Apr 26, 2022

One-line summary

This changeset lays in a skeleton l10n directory and subdirs, giving us somewhere to put Fluent files as we mark up Pocket templates for l10n.

It also marks up the pocket/about.html page (and the related nav, mobile nav and footer template partials) with Fluent strings.

This marking up of the about page also shows we can pull in brand names from the default mozorg l10n files.

In general, strings in pocket pages are namespaced with pocket- and don't clash with existing strings

Issue / Bugzilla link

#11519

Testing

  • Pull this branch
  • Start the site in Pocket Mode - either npm run in-pocket-mode or make run-pocket
  • Go to /about/ and confirm that
  • the page shows only English strings, with no Fluent placeholders visible.
  • all hyperlinks work as you'd expect
  • the mobile and desktop navs work as you'd expect
    (You can compare with https://getpocket.com/en/about/)

@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #11541 (17b8136) into main (7eda526) will decrease coverage by 0.03%.
The diff coverage is 42.85%.

❗ Current head 17b8136 differs from pull request most recent head 6cddf6f. Consider uploading reports for the commit 6cddf6f to get more accurate results

@@            Coverage Diff             @@
##             main   #11541      +/-   ##
==========================================
- Coverage   77.13%   77.09%   -0.04%     
==========================================
  Files         144      144              
  Lines        7578     7584       +6     
==========================================
+ Hits         5845     5847       +2     
- Misses       1733     1737       +4     
Impacted Files Coverage Δ
bedrock/pocket/urls.py 0.00% <ø> (ø)
bedrock/settings/base.py 92.68% <ø> (ø)
lib/l10n_utils/fluent.py 95.62% <ø> (ø)
bedrock/settings/__init__.py 73.68% <42.85%> (-7.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7eda526...6cddf6f. Read the comment docs.

@pmac
Copy link
Member

pmac commented Apr 27, 2022

Just needs a rebase now I think

@stevejalim stevejalim force-pushed the 11519-mark-up-pocket-pages-with-fluent-syntax branch from f87f317 to 72e2437 Compare April 27, 2022 19:34
@pmac
Copy link
Member

pmac commented Apr 27, 2022

Looking good now. Don't need the .gitkeep file anymore. Otherwise I think this is an excellent start. I'll let people more used to marking up for FTL do the real review though.

@stevejalim stevejalim force-pushed the 11519-mark-up-pocket-pages-with-fluent-syntax branch from 72e2437 to 33dd465 Compare April 27, 2022 21:18
@stevejalim stevejalim changed the title Skeleton structure for Pocket l10n / Fluent strings in bedrock Initial support for Pocket l10n using Fluent strings in Bedrock Apr 28, 2022
@stevejalim stevejalim marked this pull request as draft April 28, 2022 11:02
Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

I know this is only a draft still, but I thought it might be worth making sure we're setting off on the right foot for the FTL strings. Making sure things are good early on will likely make future updates smoother 👍

l10n-pocket/en/footer.ftl Outdated Show resolved Hide resolved
l10n-pocket/en/nav.ftl Outdated Show resolved Hide resolved
l10n-pocket/en/pocket/about.ftl Outdated Show resolved Hide resolved
l10n-pocket/en/pocket/about.ftl Outdated Show resolved Hide resolved
l10n-pocket/en/pocket/about.ftl Outdated Show resolved Hide resolved
l10n/en/brands.ftl Outdated Show resolved Hide resolved
@stevejalim stevejalim marked this pull request as ready for review April 28, 2022 12:13
@stevejalim stevejalim marked this pull request as draft April 28, 2022 12:23
@stevejalim stevejalim marked this pull request as ready for review April 28, 2022 13:15
Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of small nits / suggestions to fix up

bedrock/pocket/templates/pocket/about.html Outdated Show resolved Hide resolved
bedrock/pocket/templates/pocket/includes/footer.html Outdated Show resolved Hide resolved
bedrock/pocket/templates/pocket/includes/footer.html Outdated Show resolved Hide resolved
l10n-pocket/en/pocket/about.ftl Outdated Show resolved Hide resolved
@stevejalim stevejalim requested a review from alexgibson April 28, 2022 15:48
Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

Update looks good, just one outlier spotted r+wc

Although it sounds like we may want a separate brands.ftl file for Pocket now too?

l10n-pocket/en/pocket/about.ftl Outdated Show resolved Hide resolved
@stevejalim stevejalim force-pushed the 11519-mark-up-pocket-pages-with-fluent-syntax branch from 797e4b4 to 75cc1a2 Compare May 3, 2022 12:48
@stevejalim stevejalim requested a review from alexgibson May 3, 2022 12:53
stevejalim added 2 commits May 3, 2022 14:06
Setting the SITE_MODE env var to Mozorg or Pocket will now switch the site
into serving only the URLs for that particular mode.

When in Pocket mode, its pages are served from the root path, not from
the 'externalpages' namespace/module name

The default behaviour, for now, remains as is: all URLs will be served, and
Pocket URLs are served as 'external/pocket/*`
stevejalim added 15 commits May 3, 2022 14:06
There's more work to be done to wire it all up - the views aren't aware of the
Fluent side, yet
Note how we get the brands.ftl from main l10n to _always_ be used in Pocket
mode, regardless of locale.
…; need to go via the template-specific FTL file
…reaase scope to tune them without triggering new translations
The -brand-name-read-it-later-inc string is moved from l10n/en/brands.ftl
into the new Pocket-specific one, and can be used as proof that the new brands
file is being loaded, because the correct Read It Later, Inc string appears
at the bottom of the about page.

Also improve some of the brand-meets-product phrasing, to help with translation
- eg Pocket Premium, Pocket for Firefox
@stevejalim stevejalim force-pushed the 11519-mark-up-pocket-pages-with-fluent-syntax branch from 75cc1a2 to 5928f36 Compare May 3, 2022 13:08
lib/l10n_utils/fluent.py Outdated Show resolved Hide resolved
l10n-pocket/en/brands.ftl Outdated Show resolved Hide resolved
Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

r++

This means we can do without the override that forces the loading of brands
when in Pocket mode. We still need it for non-en locales, but at least now
it behaves the same as for Mozorg mode
@stevejalim
Copy link
Collaborator Author

@pmac over to you for a final review, then we can merge this and unblock the rest of #11519 🎉

bedrock/settings/__init__.py Outdated Show resolved Hide resolved
bedrock/settings/__init__.py Outdated Show resolved Hide resolved
Copy link
Member

@pmac pmac left a comment

Choose a reason for hiding this comment

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

Just a couple more suggestions, but ready to go I think. r+wc
🦀

@stevejalim stevejalim merged commit 1df8b3d into main May 3, 2022
@stevejalim stevejalim deleted the 11519-mark-up-pocket-pages-with-fluent-syntax branch May 3, 2022 17:41
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.

3 participants