Repository navigation
tiny_teamsmeeting: fix result.php always rendering in English, add missing language strings - #3520
Open
Lai Wei (weilai-irl) wants to merge 4 commits into
Open
Lai Wei (weilai-irl) wants to merge 4 commits into
Lai Wei (weilai-irl) wants to merge 4 commits into
Conversation
result.php runs with NO_MOODLE_COOKIES so it never has a real session, and $USER is never populated with the callback token's user. Every get_string() call in the success/details screen therefore fell back to the site's default language regardless of what the user had selected when they opened the dialog. Embed the resolved current_language() in the signed callback token (generate()) and use it to force_current_language() in result.php, rather than relying on the user's mdl_user.lang profile default, which is routinely overridden per-session (e.g. by the language menu) and does not reflect what the user actually saw.
…app-supported languages The Polish translation was missing several strings added since the plugin's dialog was rewritten (iframe_add_link, iframe_meeting_details, iframe_new_window_label, teamsmeeting:add, tiny_edit_modal_title, and the privacy:metadata:tiny_teamsmeeting block), had iframe_go_to_meeting left untranslated, and carried six obsolete keys from the old dialog-based UI that no longer exist in the English source. Also add lang/<code>/tiny_teamsmeeting.php for every language the Microsoft Teams meetings app (msteams-app-lms-meetings) supports, so the plugin's own UI and the app's UI are never showing two different languages: ar, bg, cs, cy, da, de, es, es_mx, fi, fr, fr_ca, he, is, it, ja, ko, nb, nl, nn, pt, pt_br, ru, sv, th, tr, zh_cn, zh_tw. Each file has exact key parity with the English source.
There was a problem hiding this comment.
🟡 Changes recommended
The added unit test asserts a hard-coded language code (xx) that may not exist in typical Moodle test environments, making CI potentially flaky.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR fixes the TinyMCE Teams Meeting plugin’s callback/result screen always rendering in the site default language by embedding the resolved current_language() into the signed callback token and applying it in result.php. It also expands/updates language string coverage to keep the plugin UI aligned with the Microsoft Teams meetings app language set.
Changes:
- Embed the issuing user’s effective language in the callback token payload and add
token::validate_lang()to retrieve it. - Force the callback page language in
result.php(NO_MOODLE_COOKIES context) based on the signed token. - Add/update many
lang/<code>/tiny_teamsmeeting.phpfiles (including Polish fixes and new language packs) for consistent UI localization.
File summaries
| File | Description |
|---|---|
| lib/editor/tiny/plugins/teamsmeeting/classes/token.php | Extend token payload to include language; add validate_lang() and shared verification logic. |
| lib/editor/tiny/plugins/teamsmeeting/result.php | Force current language from the signed token to avoid fallback to site default language. |
| lib/editor/tiny/plugins/teamsmeeting/tests/token_test.php | Add unit tests for validate_lang() and backwards compatibility behavior. |
| lib/editor/tiny/plugins/teamsmeeting/lang/pl/tiny_teamsmeeting.php | Update Polish strings (add missing keys, remove obsolete ones). |
| lib/editor/tiny/plugins/teamsmeeting/lang/ar/tiny_teamsmeeting.php | Add Arabic language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/bg/tiny_teamsmeeting.php | Add Bulgarian language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/cs/tiny_teamsmeeting.php | Add Czech language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/cy/tiny_teamsmeeting.php | Add Welsh language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/da/tiny_teamsmeeting.php | Add Danish language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/de/tiny_teamsmeeting.php | Add German language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/es/tiny_teamsmeeting.php | Add Spanish language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/es_mx/tiny_teamsmeeting.php | Add Spanish (Mexico) language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/fi/tiny_teamsmeeting.php | Add Finnish language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/fr/tiny_teamsmeeting.php | Add French language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/fr_ca/tiny_teamsmeeting.php | Add French (Canada) language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/he/tiny_teamsmeeting.php | Add Hebrew language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/is/tiny_teamsmeeting.php | Add Icelandic language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/it/tiny_teamsmeeting.php | Add Italian language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/ja/tiny_teamsmeeting.php | Add Japanese language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/ko/tiny_teamsmeeting.php | Add Korean language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/nb/tiny_teamsmeeting.php | Add Norwegian Bokmål language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/nl/tiny_teamsmeeting.php | Add Dutch language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/nn/tiny_teamsmeeting.php | Add Norwegian Nynorsk language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/pt/tiny_teamsmeeting.php | Add Portuguese language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/pt_br/tiny_teamsmeeting.php | Add Portuguese (Brazil) language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/ru/tiny_teamsmeeting.php | Add Russian language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/sv/tiny_teamsmeeting.php | Add Swedish language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/th/tiny_teamsmeeting.php | Add Thai language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/tr/tiny_teamsmeeting.php | Add Turkish language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/zh_cn/tiny_teamsmeeting.php | Add Simplified Chinese language strings file (key parity with English source). |
| lib/editor/tiny/plugins/teamsmeeting/lang/zh_tw/tiny_teamsmeeting.php | Add Traditional Chinese language strings file (key parity with English source). |
Review details
- Files reviewed: 31/31 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…decoding test_validate_lang_returns_the_language_active_when_the_token_was_issued set the test user's lang via create_user(), which runs it through PARAM_LANG cleaning and silently falls back to the site default for any pack not installed on the test site - failing in CI. Set it directly on $USER after setUser() instead, bypassing both that and the equivalent cleaning in \core\session\manager::set_user(). token::verify() also accepted an unbounded-length token and ran ctype_xdigit()/hex2bin()/preg_match() - all proportional to input size - on it before any authentication check (result.php runs with NO_MOODLE_COOKIES). Add a generous MAX_LENGTH guard, checked via strlen() first, to reject oversized input cheaply; real tokens never approach it.
… and edit flow The meeting dialog's own locale param (sent to the external Teams app) was computed from $SESSION->lang/$USER->lang only, never consulting a course-forced language. Use current_language() instead, which already resolves that correctly on the real course page. The edit-existing-meeting AJAX endpoint generates a fresh callback token via token::generate(), which also calls current_language() - but that endpoint runs inside Moodle's generic AJAX dispatcher, where $PAGE->course is always the frontpage course, so a course-forced language can never be seen there regardless of which course the meeting actually belongs to. token::generate() now accepts an optional language override, and get_meeting_details::execute() resolves the correct language explicitly against the meeting's own stored context and passes it through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/tiny_teamsmeeting.php for every language the Microsoft Teams meetings app (msteams-app-lms-meetings) supports, so the plugin's own UI and the app's UI are never showing two different languages: ar, bg, cs, cy, da, de, es, es_mx, fi, fr, fr_ca, he, is, it, ja, ko, nb, nl, nn, pt, pt_br, ru, sv, th, tr, zh_cn, zh_tw. Each file has exact key parity with the English source.