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

Theme: Add a stylesheet to be used for rosetta site overrides #380

Merged
merged 5 commits into from
Jan 16, 2024

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Jan 15, 2024

This adds a place for polyglots teams to add page & section-specific overrides for their sites. Anything more global should go in the parent theme, see the related PR: WordPress/wporg-parent-2021#120.

Specifically in this PR, I've added some code to shrink the headings on the About page, as they're defined in the CSS, not theme.json settings.

See #266, WordPress/wporg-parent-2021#120.

Screenshots

Locale Before After
Albanian about-sq-before about-sq-after
Japanese about-ja-before about-ja-after

How to test the changes in this Pull Request:

You can test localized sites by following the instructions on wporg-main-2022.

  • Follow those instructions, then set your site's language to German, Japanese, or Albanian.
  • View the About page. The titles should be smaller so they are not cut off.

I also tested this on my sandbox with the top completed languages for wporg.

Some locales have translated this which generates warnings. The warnings are good, but the translators themselves are highly unlikely to ever see them (since they only appear in dev environments).
@@ -95,6 +99,15 @@ function enqueue_assets() {
global_fonts_preload( 'EB Garamond italic', $subsets );
}
}

if ( is_rosetta_site() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is always false for me locally, I set it to true to test and the styles work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I think I was working solely on my sandbox when I got to this part of the work. As a follow up, I'll see about adding a locale check to is_rosetta_site here to make it work locally.

Copy link
Contributor

@adamwoodnz adamwoodnz left a comment

Choose a reason for hiding this comment

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

Tested with German, Japanese and Arabic. Works for me apart from the is_rosetta_site() bit, it seems my global $rosetta is null.

@ryelle ryelle merged commit cf60dc3 into trunk Jan 16, 2024
2 checks passed
@ryelle ryelle deleted the try/rosetta-customizations branch January 16, 2024 21:22
ryelle added a commit that referenced this pull request Jan 18, 2024
This enables the stylesheet to be loaded on a local environment by switching the test site's locale.

See #380 (comment)
BreadGuy007 added a commit to BreadGuy007/WP_org that referenced this pull request Apr 15, 2024
This enables the stylesheet to be loaded on a local environment by switching the test site's locale.

See WordPress/wporg-main-2022#380 (comment)
adamwoodnz added a commit that referenced this pull request May 23, 2024
Hyphenation was added to fix https://meta.trac.wordpress.org/ticket/7398, but we have a better way of handling resizing fonts for rosetta sites now, see #380

Fixes #442
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