Skip to content

i18n: replace hardcoded Chinese strings in multi-canvas dashboard with English - #1

Open
dimafa wants to merge 2 commits into
BetterAndBetterII:multi-canvasfrom
dimafa:i18n-english-dashboard-strings
Open

i18n: replace hardcoded Chinese strings in multi-canvas dashboard with English#1
dimafa wants to merge 2 commits into
BetterAndBetterII:multi-canvasfrom
dimafa:i18n-english-dashboard-strings

Conversation

@dimafa

@dimafa dimafa commented Jun 6, 2026

Copy link
Copy Markdown

What

Replaces the hardcoded Chinese strings in the multi-canvas dashboard with English, so non-Chinese self-hosters get a readable UI. There is currently no i18n or browser-locale path for these (they're baked into the compiled frontend).

Addresses BetterAndBetterII/excalidraw-full#20.

Changes

  • excalidraw-app/utils/time.ts — relative timestamps: just now, N second(s)/minute(s)/hour(s)/day(s) ago (with simple pluralization).
  • excalidraw-app/components/MyCreationsTab.tsx — empty thumbnail placeholder → No preview.
  • excalidraw-app/hooks/useCanvasManagement.ts — the 4 AuthError toasts (delete / create / rename / save-as) → English. These now match the English non-auth fallback messages already present in the same catch blocks (e.g. "Could not delete the canvas.").

Notes

  • Minimal, literal-only change (10 lines) — no behavior change, no new deps.
  • Left the Chinese text-to-diagram system prompt in components/AI.tsx out of scope (it's an internal LLM prompt, not user-facing chrome) — happy to follow up if you'd like it Englished or i18n'd too.
  • Ideally these would go through Excalidraw's t() i18n with locale files; this PR is the minimal first step toward an English-default. Glad to rework it into proper i18n keys if you prefer that approach.

…h English

The custom multi-canvas dashboard rendered several hardcoded Chinese
strings with no i18n or locale detection, so non-Chinese users saw
untranslatable text regardless of browser language:

- utils/time.ts: relative timestamps (just now / N seconds|minutes|hours|days ago)
- components/MyCreationsTab.tsx: empty thumbnail placeholder ("No preview")
- hooks/useCanvasManagement.ts: 4 auth-required error toasts

English wording matches the existing non-auth fallback messages already
present in the same handlers (e.g. "Could not delete the canvas.").

Refs BetterAndBetterII/excalidraw-full#20

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request localizes several user-facing strings from Chinese to English across the application, including placeholder text, error messages, and relative time-ago descriptions. In "time.ts", the pluralization check for seconds is redundant because the value is guaranteed to be at least 10 when reached; simplifying this to always use the plural form is recommended.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread excalidraw-app/utils/time.ts Outdated
}
if (diffInSeconds < 60) {
return `${diffInSeconds} 秒前`;
return `${diffInSeconds} second${diffInSeconds === 1 ? "" : "s"} ago`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since diffInSeconds is guaranteed to be at least 10 when this block is reached (due to the diffInSeconds < 10 check above), diffInSeconds can never be 1. The pluralization ternary diffInSeconds === 1 ? "" : "s" is redundant and will always evaluate to "s". We can simplify this string to always use the plural form.

Suggested change
return `${diffInSeconds} second${diffInSeconds === 1 ? "" : "s"} ago`;
return `${diffInSeconds} seconds ago`;

The seconds branch is only reached when diffInSeconds >= 10 (the < 10 case
returns "just now"), so the value can never be 1 and the ternary always
yields "s". Simplify to a plain plural, per review feedback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dimafa

dimafa commented Jun 6, 2026

Copy link
Copy Markdown
Author

Good catch — applied. The seconds branch can't reach a singular value (it's only hit at >= 10s), so I simplified it to a plain plural. Kept the ternary on the minutes/hours/days branches since those can legitimately be 1.

openapphub pushed a commit to openapphub/excalidraw that referenced this pull request Aug 13, 2026
* fix(arrow): Overlap arrow behavior

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Lint

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat(editor): reduce binding gap (excalidraw#10739)

* feat(editor): reduce binding gap to 7px

* feat(editor): reduce binding gap to 5px

* feat(editor): reduce binding gap to 3px

* go back to 5px

* update tests

* feat: Simplified update bind points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Remove non-needed export

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix. Possessed arrows BetterAndBetterII#1

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Focus point projection stabilization

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Remove arrow stability hack

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Unbound other endpoint

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat(editor): visualize binding midpoints + support for simple arrows (excalidraw#10611)

* feat: Force exact center focus point

When the projected point is close to center snap it to the exact center.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snap to center around side mid point.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* Trigger CI

* fix: Midpoint outline focus point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Dragging existing arrow reset focus point on outline

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Midpoint indicator

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Rotated mid points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: No hole

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Cache hits and scene lookups

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove debug

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Consider hit threshold and inside override too

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Increase outline midpoint sticky distance

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Don't show midpoint indicator when no snapping is possible

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Indicate lock-in

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove Map caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: incorrect threshold

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: threshold setting

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Hit caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Simple arrow mid point selection inconsistency

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: cache override

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Precise know dragging with midpoint refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fear: Frame support

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Crossing arrow won't trigger mid point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Arrow creation point highlight

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Restore types & tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Restore restore.ts

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: restore.ts

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Elbow arrows reliably highlight center point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Highlight point ordering

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Bind with focus point across shape

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Lint

* fix: Midpoint and binding alignment

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Indicator color

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: More knob tuning

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Radius

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* simplify point indicators

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snapshots

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Target point selection

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove non-needed change

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Try again removing non-needed modification

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Inside-inside binding arrow endpoint drag trigger focus point editor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Area based edge case

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Overlapping new arrow jump

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
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