Conversation
|
All contributors have signed the CLA ✍️ ✅ |
📝 WalkthroughWalkthroughAdded 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 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/js/i18n/i18n.ts (1)
62-64: Consider generating regex fromsupportedLanguagesto avoid duplication.The hardcoded language list in this regex duplicates the
supportedLanguagesarray. 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) andrewriteLinks()(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
📒 Files selected for processing (4)
public/locales/ua/common.jsonpublic/locales/ua/tools.jsonsrc/js/i18n/i18n.tsvite.config.ts
| "hero": { | ||
| "title": "", | ||
| "pdfToolkit": "Набір PDF-інструментів", | ||
| "builtForPrivacy": "створений з урахуванням конфіденційності", | ||
| "noSignups": "Без реєстрації", | ||
| "unlimitedUse": "Без обмежень", | ||
| "worksOffline": "Працює офлайн", | ||
| "startUsing": "Почати зараз" | ||
| }, |
There was a problem hiding this comment.
🧩 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 -C2Repository: 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.jsonRepository: 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).
|
@SerhiiZahuba thank you. you'd need to sign the CLA so I can merge |
|
I have read the CLA Document and I hereby sign the CLA |
Hello. I want to add a Ukrainian translation to the project.
Summary by CodeRabbit