Skip to content

Add offline and online Loco translation modes - #164

Open
HrithikMani wants to merge 1 commit into
mainfrom
feat/loco-translation-modes
Open

Add offline and online Loco translation modes#164
HrithikMani wants to merge 1 commit into
mainfrom
feat/loco-translation-modes

Conversation

@HrithikMani

Copy link
Copy Markdown
Contributor

Summary

Adds configurable Loco translation modes to the eSheet demo. Offline mode is the default and uses approved local translations; Online mode connects to the Loco API for live languages and translations.

Changes

  • Added Offline/Online translation mode selection in Settings.
  • Added all 10 supported project languages with 949 approved entries per language.
  • Added persisted language and translation-mode selection.
  • Removed the floating Ozwell chat widget.
  • Updated the bundled Loco client.
  • Added Playwright E2E coverage for Offline and Online modes.

Testing

  • pnpm --filter @esheet/demo typecheck passed.
  • pnpm --filter @esheet/demo e2e passed: 2 tests.
  • Playwright MCP verified Offline translation with no Loco API requests.
  • Playwright MCP verified Online translation requests to https://loco.os.mieweb.org.
  • git diff --check passed.

Notes

  • Switching translation mode reloads the page.
  • Offline mode uses apps/demo/public/loco-translations.json.
  • Online mode requires network access.
  • Generated .playwright-mcp/ and apps/demo/test-results/ artifacts were excluded.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying esheet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9b66372
Status: ✅  Deploy successful!
Preview URL: https://bb5b92dd.esheet.pages.dev
Branch Preview URL: https://feat-loco-translation-modes.esheet.pages.dev

View logs

@HrithikMani
HrithikMani requested review from lattln and a lite review from Copilot August 21, 2026 22:08

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.

Pull request overview

Adds configurable Loco translation modes (offline/local approved translations vs online/Loco API) to the eSheet demo, with persisted mode selection and Playwright E2E coverage, while removing the Ozwell chat widget integration.

Changes:

  • Add Settings UI for language + offline/online translation mode, persisted via localStorage (reload on mode switch).
  • Update bundled loco.min.js and demo index.html bootstrapping to support file-mode vs API-mode init.
  • Add Playwright configuration + E2E tests for both modes and wire e2e script into the demo package.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds Playwright deps and lockfile updates related to the demo’s E2E setup.
apps/demo/src/ozwell-setup.ts Removes Ozwell widget behavior and adds global window.Loco typing used by the demo.
apps/demo/src/components/Navbar.tsx Adds Settings controls for language and translation mode, and displays online-mode connection details.
apps/demo/public/loco.min.js Replaces bundled Loco client with a newer build supporting offline file mode + additional behaviors.
apps/demo/playwright.config.ts Introduces Playwright configuration for demo E2E runs with a local web server.
apps/demo/package.json Adds e2e script and Playwright devDependency for the demo package.
apps/demo/index.html Initializes Loco in offline vs online mode based on persisted selection.
apps/demo/e2e/loco-mode.spec.ts Adds E2E tests verifying offline default behavior and online API behavior.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +7 to +14
use: {
baseURL: 'http://localhost:3101',
trace: 'on-first-retry',
launchOptions: {
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
},
...devices['Desktop Chrome'],
},
Comment thread apps/demo/index.html
</style>
<script src="/loco.min.js"></script>
<script>
const locoMode = localStorage.getItem('esheet-loco-mode') || 'offline';
Comment on lines +73 to +75
window.Loco.languages().then((availableLanguages) => {
if (active) setLanguages(availableLanguages);
});
Comment on lines +267 to +271
{locoMode === 'online' && (
<div className="rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground">
<div>API URL: {LOCO_API_URL}</div>
<div>API key: {LOCO_API_KEY}</div>
</div>
Comment on lines +39 to +43
await page.getByRole('combobox', { name: 'Translation mode' }).click();
await page.getByRole('option', { name: 'Online (Loco API)' }).click();
await page.waitForFunction(() => localStorage.getItem('esheet-loco-mode') === 'online');
await page.reload();
await page.waitForLoadState('networkidle');
Comment on lines 7 to +8
};
__esheetLocoMode?: 'offline' | 'online';
@lattln

lattln commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

@HrithikMani please take a look at the CI & copilot review

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.

3 participants