Skip to content

fix: show shared onlyoffice document in the recipient's language#3911

Draft
rezk2ll wants to merge 1 commit into
masterfrom
fix/onlyoffice-recipient-language
Draft

fix: show shared onlyoffice document in the recipient's language#3911
rezk2ll wants to merge 1 commit into
masterfrom
fix/onlyoffice-recipient-language

Conversation

@rezk2ll

@rezk2ll rezk2ll commented Jun 12, 2026

Copy link
Copy Markdown
Member

Problem

A recipient opening a shared OnlyOffice document (shared drive or cozy-to-cozy folder) saw the editor in the owner's language instead of their own. Opening a shared document redirects the viewer to the owner's public route, so the editor config is built on the owner's instance and the editor language (and the surrounding public page) come from the owner's instance locale. The recipient's own locale, known on their instance before the redirect, was never carried across.

Solution

Forward the viewer's locale through the redirect as a lang query param, then use it to set the OnlyOffice editor language and to resolve the public page locale (when it names a supported language). The editor language is not part of the signed editor token, so overriding it client side is safe. A reader now opens the document in their own language, while opening your own document keeps using your locale.

Summary by CodeRabbit

  • New Features
    • Added language preference support via query parameter on public shared documents, enabling recipients to view shared content in their preferred language.
    • Improved locale consistency in the OnlyOffice viewer for shared document access.

A recipient opening a shared OnlyOffice document is redirected to the
owner's public route, so the editor was built on the owner's instance and
inherited the owner's locale. Carry the viewer's locale through the
redirect and use it for the editor and the public page so the document
opens in the reader's language instead of the owner's.
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d71ab5b-9d67-4488-b58f-6a0d9cca3953

📥 Commits

Reviewing files that changed from the base of the PR and between 1069a81 and bb0687d.

📒 Files selected for processing (3)
  • src/modules/views/OnlyOffice/useConfig.jsx
  • src/targets/public/localeHelper.js
  • src/targets/public/localeHelper.spec.js

Walkthrough

This PR adds locale (language) support for shared document viewing across two code paths. The public sharing page now resolves locale from a lang query parameter with highest precedence, falling back to browser locale or instance locale. The OnlyOffice editor integration retrieves the viewer's locale from useI18n and injects it into both the redirect parameters (for inter-instance sharing) and the editor configuration (to override backend locale for document recipients). Tests verify the query parameter precedence rules.

Possibly related PRs

  • linagora/twake-drive#3872: Both PRs modify src/modules/views/OnlyOffice/useConfig.jsx to configure the OnlyOffice editor—this PR adds locale support while the referenced PR adjusts editor/mode configuration.

Suggested reviewers

  • doubleface
  • Crash--
  • lethemanh
  • JF-Cozy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: enabling recipients to view shared OnlyOffice documents in their own language via a lang query parameter propagated through redirect.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/onlyoffice-recipient-language

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed due to a network error.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codescene-delta-analysis codescene-delta-analysis Bot 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.

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@bundlemon

bundlemon Bot commented Jun 12, 2026

Copy link
Copy Markdown

BundleMon

Files updated (2)
Status Path Size Limits
public/static/js/public.(hash).js
150.65KB (+57B +0.04%) -
static/js/main.(hash).js
177.85KB (+17B +0.01%) -
Unchanged files (19)
Status Path Size Limits
static/js/(chunkId).(hash).js
1.74MB -
public/static/js/(chunkId).(hash).js
1.4MB -
static/js/cozy.(hash).js
919.56KB -
public/static/js/cozy.(hash).js
779.75KB -
(hash).js
336.11KB -
public/(hash).js
336.11KB -
services/qualificationMigration.js
283.23KB -
services/dacc.js
262.97KB -
public/static/js/lib-react.(hash).js
43.88KB -
static/js/lib-react.(hash).js
43.88KB -
public/static/css/cozy.(hash).css
31.42KB -
static/css/cozy.(hash).css
31.42KB -
public/static/js/lib-router.(hash).js
21.86KB -
static/js/lib-router.(hash).js
21.86KB -
static/css/main.(hash).css
11.06KB -
public/static/css/public.(hash).css
6.76KB -
manifest.webapp
3.08KB -
index.html
715B -
assets/manifest.json
185B -

Total files change +72B 0%

Groups updated (1)
Status Path Size Limits
**/*.js
12.6MB (+91B 0%) -
Unchanged groups (2)
Status Path Size Limits
**/*.{png,svg,ico}
2.19MB -
**/*.css
163.42KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@rezk2ll
rezk2ll marked this pull request as draft June 17, 2026 06:33
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.

1 participant