Skip to content

docs(i18n): Vietnamese translation for queryset rules (DOL001–DOL007) - #54

Merged
FROWNINGdev merged 2 commits into
FROWNINGdev:mainfrom
RinZ27:docs/i18n-vi-queryset-rules
Jul 28, 2026
Merged

docs(i18n): Vietnamese translation for queryset rules (DOL001–DOL007)#54
FROWNINGdev merged 2 commits into
FROWNINGdev:mainfrom
RinZ27:docs/i18n-vi-queryset-rules

Conversation

@RinZ27

@RinZ27 RinZ27 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Vietnamese (vi) translations for the queryset rule group (DOL001–DOL007), following the docs/i18n/ layout convention. Partial coverage per the contributor note in #52 — the queryset group is the most commonly encountered family in day-to-day Django code so it made sense as the first chunk.

Type of change

  • Bug fix (non-breaking, restores expected behaviour)
  • Feature (non-breaking, adds a capability)
  • Breaking change (existing users have to update config or code)
  • Docs / README / comments only (no runtime effect)
  • Internal refactor (no behaviour change, no public API change)
  • Dependency bump
  • CI / build / tooling

Test plan

Docs-only change. Verified all relative links between the translated files resolve correctly on GitHub. Code blocks, rule codes, option names, and suppression syntax are kept byte-identical to the English source — only explanatory prose is translated. Vietnamese is my native language; no machine translation used.

Checklist

  • I ran the full test suite locally (cd cli && pytest -q for Python, npm test for TypeScript) and it is green
  • I added or updated tests that cover the change (bugfixes should get a regression test)
  • If the change is user-facing I updated the CHANGELOG under ## [Unreleased]
  • If the change touches the MCP tool contract (new tool, new arg, new error code) I updated the tool description in mcp_server.py and the relevant tests in test_mcp_server.py
  • If this is a breaking change I called it out under ## Summary above and suggested a migration path

Related issues / discussions

Refs #52

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RinZ27, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9bbde3ab-8342-4f17-a442-65cf6dd641ff

📥 Commits

Reviewing files that changed from the base of the PR and between dab7598 and 3ec0bc6.

📒 Files selected for processing (9)
  • docs/i18n/rules/vi/DOL001.md
  • docs/i18n/rules/vi/DOL002.md
  • docs/i18n/rules/vi/DOL003.md
  • docs/i18n/rules/vi/DOL004.md
  • docs/i18n/rules/vi/DOL005.md
  • docs/i18n/rules/vi/DOL006.md
  • docs/i18n/rules/vi/DOL007.md
  • docs/i18n/rules/vi/README.md
  • docs/rules/README.md
📝 Walkthrough

Walkthrough

Added a Vietnamese rule catalog README and localized documentation for DOL001–DOL007, including rule metadata, incorrect/correct examples, QuickFix details, semantic caveats, and suppression or workspace configuration guidance.

Changes

Vietnamese rule documentation

Layer / File(s) Summary
Vietnamese catalog index
docs/i18n/rules/vi/README.md
Documents the localized rule catalog, linked rule pages, severity and applicability classifications, and terminology.
Queryset existence rule pages
docs/i18n/rules/vi/DOL001.md, docs/i18n/rules/vi/DOL002.md, docs/i18n/rules/vi/DOL003.md, docs/i18n/rules/vi/DOL004.md
Documents preferred .exists() patterns over count() and first() checks, with examples and suppression settings.
Queryset composition and iteration pages
docs/i18n/rules/vi/DOL005.md, docs/i18n/rules/vi/DOL006.md, docs/i18n/rules/vi/DOL007.md
Documents queryset condition composition, avoiding eager list() conversion, and preventing N+1 access patterns. Includes caveats, QuickFix details, and suppression guidance.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the Vietnamese translation of queryset rule docs DOL001–DOL007.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/i18n/rules/vi/DOL002.md`:
- Line 5: Update the Vietnamese performance wording in the DOL002 documentation
so it states that counting matching rows is much more expensive, replacing the
phrase that implies counting is only slightly more costly. Preserve the
surrounding explanation and the recommendation to use `.exists()`.

In `@docs/i18n/rules/vi/DOL005.md`:
- Line 5: Update the DOL005 Vietnamese rule text to remove the claim that
combining filter(...).exclude(...) results in one fewer query-planner or
database operation. Frame the suggestion as improving condition
explicitness/readability, while preserving the existing warning that
exclude(...) and ~Q(...) can differ on multi-valued relations and that no
QuickFix is provided.

In `@docs/i18n/rules/vi/DOL006.md`:
- Line 5: Revise the DOL006 explanation to state that list(qs) eagerly evaluates
the queryset and allocates an additional list container, without claiming it
copies each model instance. Clarify that direct QuerySet iteration is not
automatically streaming and that .iterator() must be used explicitly, while
preserving the QuickFix guidance to remove list() and iterate directly.

In `@docs/i18n/rules/vi/README.md`:
- Around line 7-39: Add the three missing rule entries to the Vietnamese README
catalog so it contains all 19 rules targeted by the PR, using the same table
structure and metadata format as the existing entries. Alternatively, explicitly
revise the catalog scope statement if only 16 rules are intended, but ensure the
documented coverage matches the PR objective.
🪄 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 Plus

Run ID: 1bfb40d9-1a45-40bf-a04e-3edc99b558ab

📥 Commits

Reviewing files that changed from the base of the PR and between 32d2735 and dab7598.

📒 Files selected for processing (8)
  • docs/i18n/rules/vi/DOL001.md
  • docs/i18n/rules/vi/DOL002.md
  • docs/i18n/rules/vi/DOL003.md
  • docs/i18n/rules/vi/DOL004.md
  • docs/i18n/rules/vi/DOL005.md
  • docs/i18n/rules/vi/DOL006.md
  • docs/i18n/rules/vi/DOL007.md
  • docs/i18n/rules/vi/README.md

Comment thread docs/i18n/rules/vi/DOL002.md Outdated
Comment thread docs/i18n/rules/vi/DOL005.md Outdated
Comment thread docs/i18n/rules/vi/DOL006.md Outdated
Comment thread docs/i18n/rules/vi/README.md Outdated

@FROWNINGdev FROWNINGdev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this — and for taking a family as a self-contained chunk, which is exactly the shape #52 was asking for.

I verified what I can verify without reading Vietnamese, and the seven translated pages hold up well:

  • every code block in DOL001–DOL006 is byte-identical to the English source;
  • DOL007's only difference is the two # comments inside the sample, which is fine — those are prose, and nothing copy-pasteable or greppable changed;
  • the suppression line, the djangoOrmLens.rules settings key and the rule code appear in all seven pages, unchanged;
  • heading structure matches the English page one-for-one, and the severity/applicability line is translated in place rather than dropped;
  • on DOL005 you kept the multi-valued-relation caveat — that .exclude() and ~Q() diverge across a M2M or reverse FK — intact and correct. That is the one paragraph on the page that would do real damage if it were flattened, so thank you for handling it carefully.

One blocker, and it is entirely in docs/i18n/rules/vi/README.md, not in the translations.

The index is a table of all 19 rules, but only 7 exist in vi/. Two consequences:

  1. Twelve links 404DOL011DOL032, plus nplusone.md and migrations.md under "Tài liệu bổ sung". A broken docs page is the specific thing that has cost this project before, so I would rather not land more of them.
  2. The rows for the untranslated rules describe rules we do not have. The DOL001–DOL007 rows are correct — summaries, severity and applicability all match. The rest do not:
Code Row in this PR The actual rule on main
DOL011 add db_index=True to often-filtered FKs (hint) null=True on CharField/TextField (warning)
DOL012 null=True on a string field (info) Model without __str__ (info)
DOL013 missing related_name on FK (hint) ForeignKey without on_delete (error)
DOL014 use get_or_create() over try/except (info) CharField without max_length (error)
DOL015 ManyToManyField without through= (hint) TextField with max_length has no DB effect (hint)
DOL031 do not call form.save() when is_valid() is False (error) render() with locals() as context (warning)
DOL032 always call is_valid() before save() (error) fields = '__all__' in Meta (warning)

DOL021/DOL022 name the right rule but mark applicability safe; both are suggestion.

Those are plausible Django lint rules — they are just not ours, and a reader who trusts the table would go looking for a related_name diagnostic that never fires, or would read DOL013 as a hint when it defaults to error. Please rebuild the index from docs/rules/README.md on main rather than from the rule codes.

What I would like instead: cut the index down to the seven rules this PR actually ships, and either drop the other sections or point them at the English pages (../../../rules/DOL011.md) so nothing dead-ends. Both are fine by me — your call.

Two smaller notes:

  • I clarified an acceptance criterion on #52 after you opened this, so you could not have seen it: since there is no docs/i18n/README.vi.md, do not treat translating the whole README as a prerequisite. Just link docs/i18n/rules/vi/README.md from docs/rules/README.md and I will wire up the language switcher myself.
  • The migration analyzer went from 15 rules to 16 in py-1.6.0 (conflicting_migration_leaves). Only relevant if you take migrations.md in a later chunk.

Fix the index and I will merge this. The translation work itself is good, and Vietnamese is a language we have no coverage in at all.

FROWNINGdev added a commit that referenced this pull request Jul 28, 2026
Both were surfaced by the automated review on #54, where a contributor
had faithfully translated them into Vietnamese. The defect is in the
English source, not in the translation.

DOL005 claimed that collapsing `.filter().exclude()` into
`.filter(Q(...) & ~Q(...))` buys "one pass for the query planner".
It does not — Django compiles the chained form into a single query
already, so the rewrite changes nothing about how many statements the
database plans. The rule is a legibility hint and now says so. The
multi-valued-relation caveat, which is the part of that page that
actually prevents bugs, is unchanged.

DOL006 claimed `list(qs)` "builds a second in-memory copy of every
row". It does not copy the model instances; `_fetch_all()` builds them
once and the list holds the same objects, so the real cost is the extra
container plus the loss of laziness. The page also implied that dropping
`list()` gives you streaming, which it does not — a plain queryset
iteration still fills `_result_cache` end to end, and chunked reads need
an explicit `.iterator()`.

Reported via automated review on PR #54 (@RinZ27).
@FROWNINGdev

Copy link
Copy Markdown
Owner

Follow-up on the automated review — I checked its three prose findings against the English source, and two of them are our bugs, not yours. You translated the English faithfully; the English was wrong. Both are now fixed on main in bbc0153:

  • DOL005 claimed the Q(...) rewrite buys "one pass for the query planner". It does not — Django already compiles .filter().exclude() into a single query, so the rewrite changes nothing about what the database plans. The page now says plainly that this is a legibility hint, not a speed one. Your multi-valued-relation paragraph was correct and is untouched.
  • DOL006 claimed list(qs) "builds a second in-memory copy of every row". It does not copy the instances — _fetch_all() builds them once and the list holds the same objects, so the real cost is the extra container and the loss of laziness. The page also implied that dropping list() gets you streaming; a plain queryset iteration still fills _result_cache end to end.

Please re-translate those two paragraphs from main. Sorry for the churn — you found a documentation bug that had been sitting there since the rule shipped, which is more than the translation task asked of you.

On the third finding, DOL002: I think the bot misread it, and I would like your read as the native speaker. It flagged số không tốn kém hơn nhiều as saying counting is only marginally more expensive. As I parse it, số không is the numeral zero, carried over from the English "compare against zero", and the comparison is tốn kém hơn nhiều so với — much more expensive than. If that is right, no change is needed. It is a genuine garden-path reading though, so writing so sánh với 0 would remove the ambiguity for the next reader. Your call — you read the language and I do not.

The index rebuild from my earlier review is still the one blocker.

@RinZ27
RinZ27 force-pushed the docs/i18n-vi-queryset-rules branch from dab7598 to 1a27758 Compare July 28, 2026 11:48
@FROWNINGdev

Copy link
Copy Markdown
Owner

The three prose changes are right — DOL005 now frames it as explicitness rather than a planner win, DOL006 drops the copy claim and adds the .iterator() caveat, and DOL002 reads unambiguously. Thanks for turning those around quickly.

The blocker from my review is still open, though, and it is the only thing between this and a merge. My earlier comment was too long and buried it, so here it is on its own:

docs/i18n/rules/vi/README.md still links twelve pages that this PR does not add. I re-ran the check against your new head:

OK   DOL001.md … DOL007.md
404  DOL011.md  DOL012.md  DOL013.md  DOL014.md  DOL015.md
404  DOL021.md  DOL022.md  DOL031.md  DOL032.md
404  migrations.md  nplusone.md

Noting that the catalog contains 16 rules answers the bot's complaint about the count, but it does not stop those twelve links from 404ing for a reader — and the rows themselves still describe rules we do not have. DOL013 is listed as "missing related_name, hint"; the real DOL013 is ForeignKey without on_delete and defaults to error. DOL014 is listed as get_or_create(); the real one is CharField without max_length, also error.

Concretely, what I need: delete the four sections for rules this PR does not translate — "Định nghĩa Model", "Ngày giờ", "Forms / Views" and "Tài liệu bổ sung" — leaving the Queryset table plus the severity and applicability legends. Those rows are all verified correct. Then add one line saying the remaining rules are not translated yet and pointing at the English reference.

That is the whole change: the file gets shorter, nothing else moves.

If you would rather I just do it, say so — maintainer_can_modify is on and I can push that edit to your branch in a minute. It is your PR, so I would rather ask than rewrite it behind you. Either way the seven translated pages are good work and I want them in.

Signed-off-by: RinZ27 <222222878+RinZ27@users.noreply.github.com>
@RinZ27
RinZ27 force-pushed the docs/i18n-vi-queryset-rules branch from 1a27758 to 3ec0bc6 Compare July 28, 2026 12:10

@FROWNINGdev FROWNINGdev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Index is right now — seven rows, seven files, every link resolves. I re-ran the check against 3ec0bc6 and there are no 404s left.

Re-verified the rest after your prose edits, since those touched the translated pages:

  • code blocks in DOL001–DOL006 still byte-identical to the English source; DOL007's only difference remains the two translated # comments, which is fine;
  • the severity/applicability line matches the English page on every rule, including the ones I spot-checked after the rewrite;
  • suppression syntax and the djangoOrmLens.rules key intact throughout.

Also confirmed this does not clash with a change I landed on main mid-review: I bumped the migration-rule count in docs/rules/README.md from 15 to 16 while your branch was open. Your branch never touched that line, so the merge keeps 16 — the two-dot diff makes it look like a revert, but it is not one.

Approving and merging. Thanks for the patience through three rounds of review, and for finding a documentation bug that had been wrong since the rules shipped.

@FROWNINGdev
FROWNINGdev merged commit b115295 into FROWNINGdev:main Jul 28, 2026
17 checks passed
FROWNINGdev added a commit that referenced this pull request Jul 28, 2026
Follow-ups I owed after merging #54, none of which belonged in a
contributor's PR:

- The language switcher on the English rule index now says which rules
  the Vietnamese set actually covers, so a reader knows before clicking
  that it is the queryset family rather than all 19 pages. Also drops a
  stray blank line the merge left behind.
- The Vietnamese index gains a pointer to the English reference for the
  rules it does not cover. That note is in English on purpose: writing
  Vietnamese I do not speak is exactly what #52 tells contributors not
  to do, so it says so and invites a translation.
- CHANGELOG records the translation and credits @RinZ27, plus the two
  documentation bugs the review of that PR uncovered in DOL005 and
  DOL006 — both wrong since the rules shipped.
@FROWNINGdev

Copy link
Copy Markdown
Owner

Merged in b115295, and wired up the rest in 06a6f6d:

  • the language switcher on the English index now names the covered range, so a reader knows before clicking that it is the queryset family and not all 19 pages;
  • your index gained a pointer to the English reference for the rules it does not cover. That note is in English deliberately — writing Vietnamese I do not speak is exactly what Docs: translate the docs/rules/ reference (19 pages, take any chunk) #52 tells contributors not to do, so it says as much and invites a translation. If you want to translate that one line in a later PR, please do;
  • CHANGELOG credits you under [Unreleased], alongside the two documentation bugs this review turned up.

docs/i18n/rules/vi/ is the first translated rule reference in any language, so you set the layout every later one will copy.

If you take another chunk, DOL011DOL015 is the natural next unit — five model-definition rules, same shape as what you just did. Read them from main rather than a release tarball; DOL005 and DOL006 changed underneath you once already today.

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