Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Replace template strings with translatable patterns #182

Merged
merged 11 commits into from
Nov 2, 2021
Merged

Conversation

jffng
Copy link
Collaborator

@jffng jffng commented Oct 29, 2021

Description

This PR adds a 404 pattern to the general category, and implements it patterns inside the 404 template. It also replaces the contents of footer.html with the footer-default pattern.

This is done so that the strings can be marked for translation.

Closes #30.

Screenshots

There should be no visual change.

Testing Instructions

Go to a 404 page and verify the contents appear as expected.

<h2 class="has-text-align-center" style="font-size:clamp(4rem, 40vw, 20rem);font-weight:200;line-height:1;margin-top:0;margin-bottom:0;">404</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . esc_html( 'This page could not be found. Maybe try a search?', 'twentytwentytwo' ) . '</p>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Implemented the suggestion from here #154 (comment)

inc/patterns/general-404.php Outdated Show resolved Hide resolved
@kjellr
Copy link
Collaborator

kjellr commented Oct 29, 2021

@jffng rather than implement a separate credit line block, can we just make the entirety of the footer.html template be a pattern block that points to the footer-default pattern?

https://github.com/WordPress/twentytwentytwo/blob/trunk/inc/patterns/footer-default.php

@jffng
Copy link
Collaborator Author

jffng commented Oct 29, 2021

I just tried that and it causes a layout issue because of the additional wrapping div introduced by the pattern block:

Screen Shot 2021-10-29 at 2 44 07 PM

@jffng
Copy link
Collaborator Author

jffng commented Oct 29, 2021

I have an idea for a fix in Gutenberg which would remove this wrapping div entirely.

@kjellr
Copy link
Collaborator

kjellr commented Oct 29, 2021

I have an idea for a fix in Gutenberg which would remove this wrapping div entirely.

Cool — ideally these should be entirely seamless replacements.

@kjellr
Copy link
Collaborator

kjellr commented Oct 29, 2021

Assuming WordPress/gutenberg#36090 lands, this PR seems to be in good shape. 👍

Co-authored-by: Kjell Reigstad <kjell.reigstad@automattic.com>
@jffng
Copy link
Collaborator Author

jffng commented Nov 2, 2021

Merging since the above Gutenberg PR landed.

@jffng jffng merged commit d44824e into trunk Nov 2, 2021
@jffng jffng deleted the add/i18n-patterns branch November 2, 2021 13:14
@jffng jffng mentioned this pull request Nov 2, 2021
jeffpaul added a commit to jeffpaul/twentytwentytwo that referenced this pull request Nov 16, 2021
Note that some of the references below are not the only contributions (commits, PR review, helpful issue input, etc.) from these folks, but merely the first ones I encountered while reviewing items committed to `trunk` since the initial branch commit.

@westonruter via  WordPress#51
@ntwb via WordPress#73
@juricav via WordPress#113
@Sandstromer via WordPress#69
@jasmussen via WordPress#74
@melchoyce via WordPress#16
@Riyadh1734 via WordPress#182
@desrosj via WordPress#223
@beafialho via WordPress#172
@clucasrowlands via WordPress#171
@Otto42 via WordPress#28
@luminuu via WordPress#107
@felixarntz via WordPress#240
kjellr added a commit that referenced this pull request Nov 17, 2021
* add missing props to CONTRIBUTORS.md

Note that some of the references below are not the only contributions (commits, PR review, helpful issue input, etc.) from these folks, but merely the first ones I encountered while reviewing items committed to `trunk` since the initial branch commit.

@westonruter via  #51
@ntwb via #73
@juricav via #113
@Sandstromer via #69
@jasmussen via #74
@melchoyce via #16
@Riyadh1734 via #182
@desrosj via #223
@beafialho via #172
@clucasrowlands via #171
@Otto42 via #28
@luminuu via #107
@felixarntz via #240

* add dotorg handles to CONTRIBUTORS.md

* Fix Rich's WP.org username.

Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String translation in templates
2 participants