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

feat: update translation strings #1435

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

laurelfulford
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

Right now, translations aren't being pulled into the Newspack Newsletter editor. While we dig into the cause of this odd issue, this PR moves three strings -- Continue reading..., and the By and and from the byline into a PHP file, so they can be swapped out.

See: 1200550061930446-as-1205587112319820

How to test the changes in this Pull Request:

This one's a little odd to test because the translations come from WordPress.org, and won't be updated there until the plugin itself is updated. The testing steps below attempt to work around that, but don't create a 1:1 experience with what reality will be:

  1. Apply the PR and run npm run build.
  2. Uncompress and add the attached /languages directory to the plugin. It should contain one .mo file with Spanish translations. languages.zip
  3. Edit the /newspack-newsletters.php file, and add the following function - this makes the site load the local .mo file rather than trying to load the translations from WP.org:
function newspack_newsletters_load_custom_translation_file( $mofile, $domain ) {
	if ( 'newspack-newsletters' === $domain ) {
		if( 'es_ES' === get_locale() ) {
			$mofile = NEWSPACK_NEWSLETTERS_PLUGIN_FILE . '/languages/newspack-newsletters-es_ES.mo';
		}
	}
	return $mofile;
}
add_filter( 'load_textdomain_mofile', 'newspack_newsletters_load_custom_translation_file', 10, 2 );
  1. Switch your site to Spanish.
  2. Create a new newsletter.
  3. Add the Posts Inserter block, and enable both the byline and 'Continue reading...' text.
  4. Confirm that both are "translated" -- by which I mean, both have the text "translated" appended to them -- this is coming from the .mo file.

image

  1. Send yourself a test email, and confirm that the "translations" carry over.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@laurelfulford
Copy link
Contributor Author

Thanks for reviewing this oddball, @chickenn00dle!

@laurelfulford laurelfulford merged commit 822c7e1 into trunk Feb 27, 2024
7 checks passed
@laurelfulford laurelfulford deleted the feat/temp-js-transations-from-php branch February 27, 2024 22:41
matticbot pushed a commit that referenced this pull request Mar 7, 2024
# [2.12.0-alpha.1](v2.11.1...v2.12.0-alpha.1) (2024-03-07)

### Bug Fixes

* handle inactive woocommerce ([#1437](#1437)) ([b369d54](b369d54))
* **mc:** log add_user_to_lists errors ([#1444](#1444)) ([c53b02a](c53b02a))

### Features

* update translation strings  ([#1435](#1435)) ([822c7e1](822c7e1))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.12.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Mar 25, 2024
# [2.12.0](v2.11.2...v2.12.0) (2024-03-25)

### Bug Fixes

* handle inactive woocommerce ([#1437](#1437)) ([b369d54](b369d54))
* **mc:** log add_user_to_lists errors ([#1444](#1444)) ([c53b02a](c53b02a))

### Features

* update translation strings  ([#1435](#1435)) ([822c7e1](822c7e1))

### Reverts

* chore(release): 2.12.0-alpha.1 to avoid conflicts [skip ci] ([4ba5000](4ba5000))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants