Add offline and online Loco translation modes - #164
Open
HrithikMani wants to merge 1 commit into
Open
Conversation
Deploying esheet with
|
| Latest commit: |
9b66372
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bb5b92dd.esheet.pages.dev |
| Branch Preview URL: | https://feat-loco-translation-modes.esheet.pages.dev |
There was a problem hiding this comment.
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.jsand demoindex.htmlbootstrapping to support file-mode vs API-mode init. - Add Playwright configuration + E2E tests for both modes and wire
e2escript 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'], | ||
| }, |
| </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'; |
Collaborator
|
@HrithikMani please take a look at the CI & copilot review |
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.
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
Testing
pnpm --filter @esheet/demo typecheckpassed.pnpm --filter @esheet/demo e2epassed: 2 tests.https://loco.os.mieweb.org.git diff --checkpassed.Notes
apps/demo/public/loco-translations.json..playwright-mcp/andapps/demo/test-results/artifacts were excluded.