Skip to content

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
wip-137556-m500from
wip-138069-m500
Open

Lai Wei (weilai-irl) wants to merge 4 commits into
wip-137556-m500from
wip-138069-m500

Conversation

@weilai-irl

Copy link
Copy Markdown
Collaborator
  • 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.
  • 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//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.

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.
Copilot AI lite review requested due to automatic review settings September 15, 2026 15:25
@weilai-irl Lai Wei (weilai-irl) self-assigned this Sep 15, 2026
@weilai-irl Lai Wei (weilai-irl) added this to the 2026-04 milestone Sep 15, 2026
@weilai-irl
Lai Wei (weilai-irl) added this pull request to stack #3521 September 15, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.php files (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.

Comment thread lib/editor/tiny/plugins/teamsmeeting/tests/token_test.php
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants