Skip to content

Fix Auto language for Traditional Chinese and Brazilian Portuguese - #83

Merged
arnowelzel merged 3 commits into
arnowelzel:mainfrom
louis378:fix-regional-language-codes
Nov 5, 2026
Merged

arnowelzel merged 3 commits into
arnowelzel:mainfrom
louis378:fix-regional-language-codes

Conversation

@louis378

@louis378 louis378 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

When the language is set to "Auto", the Nextcloud locale is truncated at the underscore
(e.g. zh_TW -> zh, pt_BR -> pt). In draw.io, zh is Simplified Chinese and pt
is European Portuguese, so Traditional Chinese and Brazilian users get the wrong UI language.

This maps zh_TW, zh_HK, zh_MO, zh_Hant to zh-tw and pt_BR to pt-br
(both are listed in the language selector), and keeps the existing behavior for other locales.

Steps to reproduce: set Diagramming language to Auto, set the Nextcloud user language to
"Chinese (Traditional)", open a .drawio file -> the editor shows Simplified Chinese.

Related issues

None (no existing issue found).

Testing

  • Tested against the test checklist (relevant sections)
  • Ran npm run build successfully

PHP-only change in EditorController.php (no JS changes, so no rebuild needed).
The same mapping is running on our production Nextcloud.

@arnowelzel arnowelzel left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please fix the failing unit test at tests/unit/Controller/EditorControllerTest.php, line 616:

        $this->assertSame('pt', $params['drawioLang']);

Due to your changes this should be:

        $this->assertSame('pt-br', $params['drawioLang']);

@louis378

louis378 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I've updated the unit test to expect pt-br.

@arnowelzel
arnowelzel self-requested a review November 5, 2026 14:15
@arnowelzel
arnowelzel merged commit df3c156 into arnowelzel:main Nov 5, 2026
8 checks passed
@arnowelzel

Copy link
Copy Markdown
Owner

Thanks! I've updated the unit test to expect pt-br.

Thanks for the update. I will prepare an official update as soon as possible.

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