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

Fix i18n dashboard language strings and allow customizing of permalink slugs #2593

Merged
merged 36 commits into from Apr 16, 2024

Conversation

brianhogg
Copy link
Contributor

@brianhogg brianhogg commented Feb 8, 2024

Description

Various i18n fixes:

  • Menu options in the WordPress admin should now show in the user's language
  • Loads the text domain later to allow Loco Translate to change where translations are loaded from
  • Set the slugs for courses, memberships and other core taxonomies to the current site language, and provide options to change them from Settings > Permalinks. This avoids slugs inadvertently changing if a user with access to flush the permalinks has a different language set than the site language.
  • LifterLMS blocks in the Course editor and elsewhere now load translations, and are translatable via Loco Translate

Fixes #2324
Fixes #2429
Fixes #2525

How has this been tested?

Manually. The current E2E doesn't permit tests before LifterLMS has been loaded, and switching languages was flaky.

Screenshots

Captura de pantalla 2024-02-16 a las 5 11 35 p  m Block translations showing Captura de pantalla 2024-02-16 a las 5 12 56 p  m Menu options and notices showing in the user language rather than the site language (French in this case) Captura de pantalla 2024-02-16 a las 5 21 54 p  m Settings > Permalink options to modify LifterLMS permalink slugs. Shows field added via `lifterlms-assignments` add-on.

Checklist:

  • This PR requires and contains at least one changelog file.
  • My code has been tested.
  • My code passes all existing automated tests.
  • My code follows the LifterLMS Coding & Documentation Standards.

…eview prompt. Will test undoing these one by one to know what the bare minimum change is.
…slugs, to avoid issues when visiting Settings > Permalink as a user with a different language than the site
…point the defaults have already been loaded, so it has no effect.
… registration hook was fixed as part of this, as it did not run on activation.
@@ -89,9 +82,9 @@ private function __construct() {
$this->query = new LLMS_Query();

// Hooks.
register_activation_hook( __FILE__, array( 'LLMS_Install', 'install' ) );
Copy link
Contributor Author

@brianhogg brianhogg Feb 8, 2024

Choose a reason for hiding this comment

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

The register_activation_hook needs the main plugin filename. Since the class filename is being used here, this would never run. It's been moved into the main plugin file instead so the verify_permalinks runs on activation.

Copy link
Contributor

github-actions bot commented Feb 9, 2024

Coverage report

Caution

An unexpected error occurred. For more details, check console

Error: The process '/usr/bin/git' failed with exit code 128
St.
Category Percentage Covered / Total
🟡 Statements 77.18% 328/425
🟡 Branches 68.45% 141/206
🟢 Functions 82.93% 68/82
🟡 Lines 76.68% 319/416

Test suite run success

169 tests passing in 22 suites.

Report generated by 🧪jest coverage report action from e023c83

@brianhogg brianhogg marked this pull request as ready for review February 16, 2024 16:47
@brianhogg brianhogg changed the title [Draft] Fix i18n dashboard language and allow customizing of permalink slugs Fix i18n dashboard language strings and allow customizing of permalink slugs Feb 16, 2024
@ideadude ideadude added this to the Next Available Release milestone Apr 15, 2024
@ideadude ideadude merged commit 008274e into dev Apr 16, 2024
28 of 30 checks passed
@ideadude ideadude deleted the fix/i18n-dashboard-language-and-slugs branch April 16, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants