Skip to content

Add Japanese translation#650

Open
tkymmm wants to merge 4 commits intoalam00000:mainfrom
tkymmm:main
Open

Add Japanese translation#650
tkymmm wants to merge 4 commits intoalam00000:mainfrom
tkymmm:main

Conversation

@tkymmm
Copy link
Copy Markdown

@tkymmm tkymmm commented Apr 10, 2026

Description

Add Japanese translation

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

🧪 How Has This Been Tested?

I confirmed it using Docker on my own server.

Checklist:

  • Verified output manually
  • Tested with relevant sample documents or data
  • Wrote Vite Test Case (if applicable)

Expected Results:

All Japanese translations

Actual Results:

There were no items to translate in faq.html.

Checklist:

  • I have signed the Contributor License Agreement (CLA) or my organization has signed the Corporate CLA
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features
    • Full Japanese localization added across the app: navigation, hero/marketing, settings, compliance, FAQ, support, footer, and onboarding copy.
    • Japanese translations for all PDF tools and workflows (compression, merge, convert, compare, signatures, builder, etc.) plus UI labels, messages, and templated strings.
    • Japanese is now selectable as a language option in the application.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7efa2f29-9875-41bb-a533-a04d634357b1

📥 Commits

Reviewing files that changed from the base of the PR and between e72df17 and dc87af9.

📒 Files selected for processing (1)
  • public/locales/ja/tools.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • public/locales/ja/tools.json

📝 Walkthrough

Walkthrough

This PR adds Japanese language support by introducing two new locale JSON files (public/locales/ja/common.json, public/locales/ja/tools.json) and updating i18n and build/routing config to recognize and route /ja language-prefixed URLs.

Changes

Cohort / File(s) Summary
Japanese Localization Files
public/locales/ja/common.json, public/locales/ja/tools.json
Add comprehensive Japanese translation strings for UI sections and many tool-specific workflows (navigation, hero, features, tools, upload, compression, OCR, signatures, compare, visual workflow builder, etc.) with templated placeholders for runtime interpolation.
i18n Configuration
src/js/i18n/i18n.ts
Add 'ja' to supportedLanguages, add ja: '日本語' to display names, and extend URL parsing / link-rewriting regexes to detect and handle the /ja prefix.
Build / Routing Config
vite.config.ts
Include 'ja' in SUPPORTED_LANGUAGES and expand LANG_REGEX so requests under /ja/... are recognized by language routing middleware.

Sequence Diagram(s)

(omitted — changes are localization additions and minor routing/i18n updates that do not introduce new multi-component control flow requiring a sequence diagram)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • alam00000

Poem

🐰 I hopped through keys and strings today,
小さな翻訳を運んで来たよ、明るい道で 🌸
Buttons now say hello in 日本語,
Pages hum softly with new script and cheer,
The rabbit nods — the UI speaks another ear.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Japanese translation' clearly summarizes the main change: introducing Japanese localization to the project.
Description check ✅ Passed The description covers the key required sections: identifies the change as a new feature, includes testing confirmation, and marks most checklist items. However, it lacks specific issue reference and testing detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/js/i18n/i18n.ts (1)

62-64: Consider generating regex from supportedLanguages to reduce maintenance burden.

The language list is hardcoded in three separate regex patterns (lines 63, 153, 246) in addition to the supportedLanguages array. Adding a new language requires updating four locations, which is error-prone.

♻️ Suggested refactor to DRY up language matching
+// Build regex pattern from supportedLanguages array
+const langPattern = supportedLanguages.join('|');
+
 export const getLanguageFromUrl = (): SupportedLanguage => {
   // ...
   const langMatch = path.match(
-    /^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko|sv|ru|ja)(?:\/|$)/
+    new RegExp(`^\\/(${langPattern})(?:\\/|$)`)
   );

Apply the same pattern to the regexes in changeLanguage (line 153) and rewriteLinks (line 246).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/js/i18n/i18n.ts` around lines 62 - 64, Replace the hardcoded language
alternation in the regex used to detect language prefixes with a regex built
from the existing supportedLanguages array; specifically, generate an escaped
alternation string from supportedLanguages and use it to build the regex used
for langMatch (the path.match call), and reuse the same generated regex (or a
helper function that returns it) in changeLanguage and rewriteLinks so all three
places derive their pattern from supportedLanguages instead of duplicated
literals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@public/locales/ja/tools.json`:
- Around line 463-464: The translation for the JSON key "rightDocument" is
incorrect: it currently reads "正しい文書" (meaning "correct document") but should
indicate the right-side panel; update the value for "rightDocument" (paired with
"leftDocument") to a phrase like "右の文書" or "右側の文書" so it clearly means "right
side document" in the side-by-side PDF comparison UI.

---

Nitpick comments:
In `@src/js/i18n/i18n.ts`:
- Around line 62-64: Replace the hardcoded language alternation in the regex
used to detect language prefixes with a regex built from the existing
supportedLanguages array; specifically, generate an escaped alternation string
from supportedLanguages and use it to build the regex used for langMatch (the
path.match call), and reuse the same generated regex (or a helper function that
returns it) in changeLanguage and rewriteLinks so all three places derive their
pattern from supportedLanguages instead of duplicated literals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b51a632-344d-4c26-92c8-61b6454df428

📥 Commits

Reviewing files that changed from the base of the PR and between 095d68d and e72df17.

📒 Files selected for processing (4)
  • public/locales/ja/common.json
  • public/locales/ja/tools.json
  • src/js/i18n/i18n.ts
  • vite.config.ts

@tkymmm
Copy link
Copy Markdown
Author

tkymmm commented Apr 10, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 10, 2026
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