Repository navigation
tiny_teamsmeeting: fix result.php always rendering in English, add missing language strings - #3518
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
There was a problem hiding this comment.
🟡 Changes recommended
There is a verified PHP warning bug in validate_lang() for invalid tokens and the new unit test hard-codes a likely-nonexistent language code (xx), making CI failures likely.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR updates the tiny_teamsmeeting TinyMCE plugin callback flow so that the result.php success/details screen renders in the same language the user saw when opening the dialog (despite NO_MOODLE_COOKIES), and expands/aligns plugin language packs to avoid mixed-language UI between Moodle and the Microsoft meetings app.
Changes:
- Embed
current_language()into the signed callback token and apply it inresult.phpviaforce_current_language(). - Add
validate_lang()and corresponding PHPUnit coverage for language-carrying (and legacy) tokens. - Add/refresh multiple
lang/<code>/tiny_teamsmeeting.phppacks (and update Polish strings) to match the English key set.
File summaries
| File | Description |
|---|---|
| lib/editor/tiny/plugins/teamsmeeting/classes/token.php | Adds language segment to token payload and exposes validate_lang() / shared verify(). |
| lib/editor/tiny/plugins/teamsmeeting/result.php | Forces current language from the signed token when rendering the callback UI. |
| lib/editor/tiny/plugins/teamsmeeting/tests/token_test.php | Adds tests for language-bearing tokens and legacy/invalid token behavior. |
| lib/editor/tiny/plugins/teamsmeeting/lang/ar/tiny_teamsmeeting.php | Adds Arabic language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/bg/tiny_teamsmeeting.php | Adds Bulgarian language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/cs/tiny_teamsmeeting.php | Adds Czech language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/cy/tiny_teamsmeeting.php | Adds Welsh language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/da/tiny_teamsmeeting.php | Adds Danish language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/de/tiny_teamsmeeting.php | Adds German language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/es/tiny_teamsmeeting.php | Adds Spanish language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/es_mx/tiny_teamsmeeting.php | Adds Spanish (Mexico) language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/fi/tiny_teamsmeeting.php | Adds Finnish language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/fr/tiny_teamsmeeting.php | Adds French language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/fr_ca/tiny_teamsmeeting.php | Adds French (Canada) language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/he/tiny_teamsmeeting.php | Adds Hebrew language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/is/tiny_teamsmeeting.php | Adds Icelandic language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/it/tiny_teamsmeeting.php | Adds Italian language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/ja/tiny_teamsmeeting.php | Adds Japanese language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/ko/tiny_teamsmeeting.php | Adds Korean language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/nb/tiny_teamsmeeting.php | Adds Norwegian Bokmål language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/nl/tiny_teamsmeeting.php | Adds Dutch language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/nn/tiny_teamsmeeting.php | Adds Norwegian Nynorsk language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/pl/tiny_teamsmeeting.php | Updates Polish strings (adds missing keys, removes obsolete ones). |
| lib/editor/tiny/plugins/teamsmeeting/lang/pt/tiny_teamsmeeting.php | Adds Portuguese language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/pt_br/tiny_teamsmeeting.php | Adds Portuguese (Brazil) language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/ru/tiny_teamsmeeting.php | Adds Russian language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/sv/tiny_teamsmeeting.php | Adds Swedish language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/th/tiny_teamsmeeting.php | Adds Thai language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/tr/tiny_teamsmeeting.php | Adds Turkish language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/zh_cn/tiny_teamsmeeting.php | Adds Simplified Chinese language strings matching English keys. |
| lib/editor/tiny/plugins/teamsmeeting/lang/zh_tw/tiny_teamsmeeting.php | Adds Traditional Chinese language strings matching English keys. |
Review details
- Files reviewed: 31/31 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Lai Wei (weilai-irl)
force-pushed
the
wip-138069-m405
branch
from
October 20, 2026 08:18
56805c7 to
aff1b84
Compare
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.
…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.
Lai Wei (weilai-irl)
force-pushed
the
wip-138069-m405
branch
from
October 20, 2026 11:59
aff1b84 to
86e3f43
Compare
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.