🌐 [translation-sync] long_run_growth: read mpd2020.xlsx from data-lectures - #285
Conversation
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-08-07 📝 Translation Quality
Summary: The 'Setting up' section is generally well translated with fluent, accurate prose, but the translation modifies the underlying code logic (loading country_to_name mapping from an external CSV instead of deriving it from the dataset as in the English source) without adjusting the accompanying explanatory text to match, creating an accuracy mismatch between narrative and code. Minor punctuation and phrasing issues also exist but do not significantly impede understanding. Core prose in the 'Setting up' section is accurately and fluently translated, preserving the meaning of the English source Code comments within the changed section are properly translated into Chinese while preserving code functionality where unchanged Proper use of full-width Chinese punctuation throughout the modified section Suggestions:
🔍 Diff Quality
Summary: The data_url change was correctly synced to the same code cell location in the target document, with no other unintended modifications. This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
This automated translation-sync PR updates the zh-cn long_run_growth lecture to align with upstream data handling changes, notably switching the Maddison dataset source and adjusting how country-code metadata is derived for plotting.
Changes:
- Update
mpd2020.xlsxdownload URL to useQuantEcon/data-lectures. - Replace
country_code_cn.csv-basedcode_to_namemapping with one derived from the Maddison dataset (currently introduces a runtime incompatibility). - Update translation sync state metadata (source SHA, sync date, mode, tool version).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lectures/long_run_growth.md | Switches dataset URL and changes code_to_name construction used by later plots/labels. |
| .translate/state/long_run_growth.md.yml | Updates translation-sync bookkeeping metadata for this file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| code_to_name = data[ | ||
| ['countrycode', 'country']].drop_duplicates().reset_index(drop=True).set_index(['countrycode']) |
✅ Deploy Preview for playful-platypus-17d3bb ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The sync correctly repointed data_url to data-lectures, but it also replaced
a deliberate localisation in the same cell:
code_to_name = pd.read_csv("../lectures/datasets/country_code_cn.csv")
.set_index('code')
with the English source's version, which derives the mapping from the
spreadsheet's own countrycode/country columns. That drops the name_chinese
column, and long_run_growth.md:263 reads code_to_name.loc[c]['name_chinese'],
so the build failed with KeyError: 'name_chinese'. Nine call sites use
code_to_name, and the comment at :536 relies on country_code_cn.csv carrying
the BEM mapping.
Had it built, every chart in this lecture would have silently reverted to
English country labels on the Chinese site.
This restores only that line. The repoint — the point of the sync — is
untouched, so mpd2020.xlsx still comes from data-lectures rather than from
lecture-python-intro, where it no longer exists.
Verified: mpd2020.xlsx loads from the new URL (21,682 rows) and
code_to_name.loc['GBR']['name_chinese'] resolves to 英国.
Context: QuantEcon/workspace-lectures#25.
|
The failing build was catching a real problem, not flaking. Pushed What was wrongThis sync changed two things in the same cell. The first is the point of the PR and is correct —
That second line is the English source's version, which derives the mapping from the spreadsheet's own Nine call sites use The fixOne line restored. The diff against Verified directly rather than by re-running the build: Why this one and not the others#286 and #288 touched only URL lines and merged cleanly. This PR is different because the English side changed a line adjacent to a localised one inside the same code cell, and the sync replaced the whole block. Worth noting for the translation programme: that is a general hazard for the rest of the dataset migration, not a one-off. Any lecture where this repo has localised a line near a data read will collide the same way, and it surfaces only as a build failure — there is no check that says "a localisation was overwritten". Recorded in QuantEcon/workspace-lectures#25. Merging this closes the last of the eight datasets that were 404ing on this repo's |
#291) These are lines whose Chinese content lives inside a code cell, where a whole-cell resync can drop it without anything raising. They are the cells an upcoming repoint rewrites, so mark them before that lands rather than after. The dangerous three are executable, not comments: heavy_tails.md:815 label="公司规模(市值)" heavy_tails.md:868 country_names = ['美国', '日本', '印度', '意大利'] heavy_tails.md:882 ... label=country_names[i], xlabel='对数财富' ... :868 defines and :882 consumes, inside the same cell, so a wholesale replacement drops both together and the cell still runs — English labels just appear on the Chinese charts. That is silent, unlike the KeyError in #285 where only one half went. The other four are translated comments (heavy_tails 816, 837, 878 and mle 109). What this does and does not buy. `# i18n` is named in action-translation's translation prompts (src/translator.ts:291, :384, :666 — "NEVER remove i18n/localization code ... or lines marked `# i18n`"), and the tool emits it on the font block it injects (src/localization-rules.ts:151-154). So it is a live convention, not decoration. But it is *prompt-level* protection: the extract-and-reinject phase that would make it deterministic is still a proposal (docs/developer/roadmap.md, "i18n code annotation convention", phase 2), and that roadmap entry exists precisely because the model sometimes drops these lines anyway. Markers raise the odds; hand-diffing each sync PR is still what actually protects these lines. Three more lines in these cells are localised and deliberately NOT marked -- the `caption:` keys at heavy_tails.md:807, 833 and 859. They sit in the cell's mystnb YAML header, where `#` is not a comment marker and the convention has no meaning. They are on the hand-diff list instead. Repo-wide this takes lecture-intro.zh-cn from 0 markers to 7; the same convention has 132 uses in lecture-python.zh-cn. Trailing two-space form matches that repo. Verified: diff is 7 lines, all pure appends; no data-read URL and no YAML key touched; every code cell in both files still compiles, apart from the pre-existing `!pip install` magic cell at heavy_tails.md:48. Step C0 of QuantEcon/workspace-lectures#23. See QuantEcon/workspace-lectures#26 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python-intro.
Source PR
#823 - long_run_growth: read mpd2020.xlsx from data-lectures
Files Updated
lectures/long_run_growth.md.translate/state/long_run_growth.md.ymlDetails
This PR was created automatically by the translation action.