Skip to content

Added Ukrainian translation#628

Open
SerhiiZahuba wants to merge 1 commit intoalam00000:mainfrom
SerhiiZahuba:main
Open

Added Ukrainian translation#628
SerhiiZahuba wants to merge 1 commit intoalam00000:mainfrom
SerhiiZahuba:main

Conversation

@SerhiiZahuba
Copy link
Copy Markdown

@SerhiiZahuba SerhiiZahuba commented Apr 3, 2026

Hello. I want to add a Ukrainian translation to the project.

Summary by CodeRabbit

  • New Features
    • Added Ukrainian language support. Users can now switch to Ukrainian to access all application content, including navigation, tool descriptions, settings, documentation, and user interface elements.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

Added Ukrainian language support to the application by introducing locale files for common and tool-specific UI strings, and updating the i18n configuration to recognize and route the new ua language code across URL paths and language detection mechanisms.

Changes

Cohort / File(s) Summary
Ukrainian Localization
public/locales/ua/common.json, public/locales/ua/tools.json
Added comprehensive Ukrainian translation files covering navigation, donation prompts, hero/feature messaging, file upload UI, settings, FAQ, compliance, tool-specific labels, and templated strings with dynamic placeholders for runtime interpolation.
I18n Configuration
src/js/i18n/i18n.ts, vite.config.ts
Registered Ukrainian (ua) as a supported language by adding it to supportedLanguages, languageNames, URL detection regex, link rewriting logic, and vite's SUPPORTED_LANGUAGES constant for language-prefixed route handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • add Russian translation #555: Both PRs add a new locale and update i18n routing/configuration through identical modifications to src/js/i18n/i18n.ts and vite.config.ts.

Suggested reviewers

  • alam00000

Poem

🐰 A rabbit hops through languages wide,
Ukrainian joins the translation tide,
With ua codes and locale files in place,
The app now speaks with Ukrainian grace! 🌍

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal and lacks required template sections including issue reference, change type, testing details, and checklist items specified in the repository template. Fill out the complete PR template including issue reference, type of change, testing methodology, and verification checklist items to meet repository standards.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Added Ukrainian translation' directly and clearly summarizes the main change of adding Ukrainian localization files to the project.
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 avoid duplication.

The hardcoded language list in this regex duplicates the supportedLanguages array. While the current change correctly adds 'ua', future maintainers might update one location but forget the other.

♻️ Optional refactor to derive regex from array
// At module level, create a reusable pattern:
const langPattern = supportedLanguages.join('|');

// Then in getLanguageFromUrl():
const langMatch = path.match(
  new RegExp(`^/(${langPattern})(?:/|$)`)
);

This would also apply to the similar patterns 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, The regex in getLanguageFromUrl
currently hardcodes the language list (used in the langMatch) duplicating
supportedLanguages and risking drift; instead, derive the pattern from the
supportedLanguages array (e.g., create a module-level langPattern =
supportedLanguages.join('|')) and replace the literal regex construction in
getLanguageFromUrl (the path.match usage that sets langMatch) with a RegExp
built from that pattern; apply the same change to the other places that use
hardcoded lists (changeLanguage and rewriteLinks) so all language-matching uses
reference the single langPattern/supportedLanguages source.
🤖 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/ua/common.json`:
- Around line 15-23: hero.title is empty for Ukrainian which causes fallback to
English; set the "hero.title" key to an appropriate single-word Ukrainian
translation (e.g., "Це") so the UI shows a proper Ukrainian label instead of the
English fallback; update the value for the hero.title property in the Ukrainian
locale JSON (the "hero" object and its "title" key).

---

Nitpick comments:
In `@src/js/i18n/i18n.ts`:
- Around line 62-64: The regex in getLanguageFromUrl currently hardcodes the
language list (used in the langMatch) duplicating supportedLanguages and risking
drift; instead, derive the pattern from the supportedLanguages array (e.g.,
create a module-level langPattern = supportedLanguages.join('|')) and replace
the literal regex construction in getLanguageFromUrl (the path.match usage that
sets langMatch) with a RegExp built from that pattern; apply the same change to
the other places that use hardcoded lists (changeLanguage and rewriteLinks) so
all language-matching uses reference the single langPattern/supportedLanguages
source.
🪄 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: 788f4acf-f1ab-41fa-babb-20009a3833bb

📥 Commits

Reviewing files that changed from the base of the PR and between ed6e6c0 and e64595a.

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

Comment on lines +15 to +23
"hero": {
"title": "",
"pdfToolkit": "Набір PDF-інструментів",
"builtForPrivacy": "створений з урахуванням конфіденційності",
"noSignups": "Без реєстрації",
"unlimitedUse": "Без обмежень",
"worksOffline": "Працює офлайн",
"startUsing": "Почати зараз"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how hero.title is used in other locale files
echo "Checking hero.title in other locales:"
rg -n '"title"' public/locales/*/common.json | grep -A1 '"hero"' | head -20

# Check how it's rendered in templates/code
rg -n 'hero\.title|hero\[.title' --type ts --type html -C2

Repository: alam00000/bentopdf

Length of output: 816


🏁 Script executed:

#!/bin/bash
# Extract hero.title values from all locale files
echo "=== hero.title values across all locales ==="
for file in public/locales/*/common.json; do
  locale=$(echo "$file" | cut -d'/' -f3)
  value=$(rg -A1 '"hero"' "$file" | rg '"title"' | head -1)
  echo "$locale: $value"
done

# Also check if there's a pattern of empty titles in other sections
echo ""
echo "=== Checking for other empty title fields ==="
rg '"title"\s*:\s*""' public/locales/ua/common.json

Repository: alam00000/bentopdf

Length of output: 647


Add missing translation for hero.title in Ukrainian.

The hero.title is empty in the Ukrainian locale, while all other 19 locales have translations (single words like "The", "Das", "Il", or phrases). This will cause the UI to display the English fallback text instead of a Ukrainian translation. Provide an appropriate Ukrainian translation.

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

In `@public/locales/ua/common.json` around lines 15 - 23, hero.title is empty for
Ukrainian which causes fallback to English; set the "hero.title" key to an
appropriate single-word Ukrainian translation (e.g., "Це") so the UI shows a
proper Ukrainian label instead of the English fallback; update the value for the
hero.title property in the Ukrainian locale JSON (the "hero" object and its
"title" key).

@alam00000
Copy link
Copy Markdown
Owner

@SerhiiZahuba thank you. you'd need to sign the CLA so I can merge

@SerhiiZahuba
Copy link
Copy Markdown
Author

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.

2 participants