fix: resolve issue #35 - [BUG] Small inaccuracies with German translation#119
fix: resolve issue #35 - [BUG] Small inaccuracies with German translation#119cryst6line wants to merge 1 commit intoTimilsinaBimal:mainfrom
Conversation
Standardize German translations to use either formal (Sie) or informal (du) form consistently throughout the codebase Closes TimilsinaBimal#35
|
@cryst6line is attempting to deploy a commit to the Bimal Timilsina's projects Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses inconsistencies in German translations by standardizing the use of informal "du" pronouns and verb forms. It introduces a mechanism to normalize Google Translate's output for German and provides static overrides for common phrases, ensuring a more consistent and informal tone throughout the application's German interface. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
Thank you for your contribution! I noticed a discrepancy between your pull request description, which mentions standardizing to the formal 'Sie', and the code changes, which implement the informal 'du'. Could you please clarify which form is the intended standard for the application?
While I appreciate the effort to improve the translations, the current approach of using regular expressions in _normalize_german_formality to alter grammar is very risky and likely to introduce new errors. German grammar is complex, and simple text replacements can easily go wrong due to ambiguous words (e.g., 'Sie' can mean 'you' or 'they') and complex verb conjugations. A safer and more reliable approach would be to expand the _STATIC_TRANSLATIONS dictionary to handle specific phrases that are translated incorrectly.
Let's first decide on the formal vs. informal direction, and then we can figure out the safest way to implement it. Great job on taking the initiative to fix this!
| def _normalize_german_formality(text: str) -> str: | ||
| """Normalize German text to use the informal (du) address form consistently.""" | ||
| text = re.sub(r"\bWeil Sie\b", "Weil du", text) | ||
| text = re.sub(r"\bwas Sie\b", "was du", text) | ||
| text = re.sub(r"\bfür Sie\b", "für dich", text) | ||
| text = re.sub(r"\bIhren\b", "deinen", text) | ||
| text = re.sub(r"\bIhrem\b", "deinem", text) | ||
| text = re.sub(r"\bIhrer\b", "deiner", text) | ||
| text = re.sub(r"\bIhres\b", "deines", text) | ||
| text = re.sub(r"\bIhre\b", "deine", text) | ||
| if text.endswith(" haben"): | ||
| text = text[:-6] + " hast" | ||
| return text |
There was a problem hiding this comment.
This function attempts to convert formal German ('Sie') to informal ('du') using regular expressions, but this approach is highly unreliable and will introduce significant grammatical errors and potentially change the meaning of sentences.
Here are a few examples of the issues:
- Pronoun Ambiguity: Words like
Sie,Ihre, andIhrenare ambiguous in German. They can refer to the formal 'you', but also 'they' or 'her'. Replacing them automatically will lead to incorrect translations. For example, a phrase like 'Das ist für sie' ('This is for them') could be incorrectly changed to 'Das ist für dich' ('This is for you'). - Fragile Verb Conjugation: The
text.endswith(' haben')check is a critical flaw. It will incorrectly changeWir haben('we have') toWir hast, which is grammatically incorrect. This happens because 'haben' is used for multiple pronouns ('wir', 'sie', 'Sie').
This function is very likely to make the German translations worse, not better. A much safer approach is to use the _STATIC_TRANSLATIONS dictionary to manually correct specific phrases. I strongly recommend removing this function and the call to it to avoid introducing bugs.
|
Thanks for the detailed review, @gemini-code-assist[bot]! You're right — there was a discrepancy between the PR description and the code. The description incorrectly stated I'd standardized to formal Sie, but the implementation actually uses the informal du form throughout. I've updated the PR description to accurately reflect what the code does. Regarding the regex approach in The Vercel authorization is a project-level setting outside my control — that'll need a team member to approve. |
|
Thanks for the update on the PR description, @cryst6line. It's good to see it now accurately reflects the implementation. Your explanation regarding the focused regex approach in |
What I changed
The German translations were mixing formal pronouns ("Sie") and informal pronouns ("du") — for example, some catalog names used "Weil Sie..." while others used "Weil du...". I standardized everything to use the informal "du" form consistently throughout the codebase.
Changes:
_normalize_german_formality()which converts any formal "Sie"-form output from Google Translate to the informal "du" formWhy this matters
Consistent tone makes the app feel more polished. Mixing formal and informal German in the same interface is jarring for native speakers.
Note on form choice
I chose informal ("du") as it's the norm for consumer apps and aligns with the existing informal phrasing already present in the codebase. Happy to switch to formal ("Sie") if that better fits the project's tone.