Add Gujarati language support with translations#14752
Conversation
📝 WalkthroughWalkthroughA new Gujarati language localization module is added at Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lang/gu.rs`:
- Around line 1-3: Add Gujarati to the module list and language maps: declare
mod gu; in the module declarations, add ("gu", "Gujarati") to the LANGS
constant, and add the match arm "gu" => gu::T.deref() inside translate_locale()
so that the static translation map T from src/lang/gu.rs is exposed and
selectable; update the module declarations, LANGS constant, and
translate_locale() match to reference gu and gu::T.deref() accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| lazy_static::lazy_static! { | ||
| pub static ref T: std::collections::HashMap<&'static str, &'static str> = | ||
| [ |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify Gujarati language wiring in src/lang.rs
rg -n --fixed-strings 'mod gu;' src/lang.rs
rg -n --fixed-strings '("gu",' src/lang.rs
rg -n --fixed-strings '"gu" => gu::T.deref(),' src/lang.rsRepository: rustdesk/rustdesk
Length of output: 43
🏁 Script executed:
# First, check if src/lang.rs exists and examine its structure
head -100 src/lang.rs
# Check how many lines are in src/lang.rs
wc -l src/lang.rsRepository: rustdesk/rustdesk
Length of output: 1669
🏁 Script executed:
# Look for a known language registration pattern (e.g., English 'en')
# to understand the expected structure
rg -n --fixed-strings 'mod en;' src/lang.rs
rg -n --fixed-strings '("en",' src/lang.rs
rg -n --fixed-strings '"en" => en::T.deref(),' src/lang.rsRepository: rustdesk/rustdesk
Length of output: 97
🏁 Script executed:
# Verify that src/lang/gu.rs actually exists
ls -la src/lang/gu.rsRepository: rustdesk/rustdesk
Length of output: 125
🏁 Script executed:
# Search for translate_locale function and its match arms
rg -n 'translate_locale' src/lang.rs -A 50Repository: rustdesk/rustdesk
Length of output: 1944
🏁 Script executed:
# Get more of the translate_locale function to see all match arms
rg -n 'translate_locale' src/lang.rs -A 100 | tail -60Repository: rustdesk/rustdesk
Length of output: 2785
🏁 Script executed:
# Specifically search for "gu" in the match arms
rg -n '"gu"' src/lang.rsRepository: rustdesk/rustdesk
Length of output: 43
Gujarati will not be usable unless it is registered in src/lang.rs.
src/lang/gu.rs exists but is missing three required registrations:
mod gu;declaration (not in module list)("gu", "Gujarati")entry in theLANGSconstant"gu" => gu::T.deref()match arm intranslate_locale()
Without these, users cannot select Gujarati.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lang/gu.rs` around lines 1 - 3, Add Gujarati to the module list and
language maps: declare mod gu; in the module declarations, add ("gu",
"Gujarati") to the LANGS constant, and add the match arm "gu" => gu::T.deref()
inside translate_locale() so that the static translation map T from
src/lang/gu.rs is exposed and selectable; update the module declarations, LANGS
constant, and translate_locale() match to reference gu and gu::T.deref()
accordingly.
(cherry picked from commit 2d41b3e)
Summary by CodeRabbit