Skip to content

fix: translate hardcoded Japanese strings in Mermaid component - #612

Open
ieCecchetti wants to merge 1 commit into
AsyncFuncAI:mainfrom
ieCecchetti:fix/mermaid-error-i18n
Open

ieCecchetti wants to merge 1 commit into
AsyncFuncAI:mainfrom
ieCecchetti:fix/mermaid-error-i18n

Conversation

@ieCecchetti

Copy link
Copy Markdown

What

src/components/Mermaid.tsx had four UI strings hardcoded in Japanese (diagram view title, render error, syntax error message, loading text). They now come from the message files through useLanguage(), with English fallbacks, like Ask.tsx does. New diagram keys are added to en.json and ja.json; ja.json keeps the current Japanese text. Other languages fall back to English until translated.

Why

With the UI in English (or any other language), a diagram with a syntax error showed 図表レンダリングエラー / 図表に構文エラーがあり、レンダリングできません。, which most users can't read.

Testing

npm run build (via the Dockerfile) passes; both JSON files parse.

The diagram view title, render error, syntax error and loading text in
Mermaid.tsx were hardcoded in Japanese, so every UI language showed them
in Japanese. Read them from the message files like other components, with
English fallbacks, and add the keys to en.json and ja.json (ja keeps the
existing text).

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

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