Skip to content

fix(zh-tw): clean up jsxref macro args#36169

Merged
yin1999 merged 21 commits into
mainfrom
fix-jsxref-zh-tw
May 26, 2026
Merged

fix(zh-tw): clean up jsxref macro args#36169
yin1999 merged 21 commits into
mainfrom
fix-jsxref-zh-tw

Conversation

@caugner

@caugner caugner commented May 21, 2026

Copy link
Copy Markdown
Contributor

Description

Clean up stale jsxref macro arguments in Traditional Chinese content so they resolve against the en-US JS Reference index. Changes are scoped to the first argument of jsxref() invocations; display text is preserved everywhere it was already explicit, and inserted as the original arg when missing so the rendered label keeps reflecting what the author originally wrote.

18 commits, applied in order:

# Commit Files Args Description
1 8296a54 14 22 Strip trailing .prototype from class refs.
2 6167ba5 4 69 Rewrite stale Operators aggregate-page slugs.
3 e421bd5 4 27 Rewrite Operators/Assignment_Operators with anchor.
4 f83f310 2 5 Operator expression-forms deprecated/non-standard.
5 1374ebb 1 1 Additional Functions/<leaf> localized slugs.
6 b93874b 3 12 Rewrite Global_Objects/<IntlClass>[/X] to Intl/<IntlClass>[/X].
7 8119f13 20 29 Rewrite stale slugs that en-US redirects resolve cleanly.
8 fafda24 19 86 Strip redundant Global_Objects/ prefix when safe.
9 ae92238 9 32 Merge ("foo", "foo()") into ("foo()").
10 d6de450 1 1 Rewrite bare/dotted <IntlClass> refs. Display preservation.
11 7576e04 2 16 Convert WebAssembly jsxref refs to markdown links.
12 18ef6cb 2 2 One-off cleanups.
13 6984843 7 9 Case-correct slugs surfaced by the index-aware rari. Display preservation.
14 c1b4312 1 1 Round 2 of case-fix covering dotted variants.
15 007ce32 1 1 Drop display arg when arg1/arg2 differ only in case.
16 57fe677 24 49 Collapse ("Operators/<kw>", "<kw>")("<kw>") for the 5 operator-keyword shortforms (null, this, delete, new, instanceof), per the convention introduced in mdn/content#44221.
17 e196b19 1 3 Add the per-locale Reference/<kw>Reference/Operators/<kw> redirects that back the shorthand calls under the deployed rari (3 of 5; Operators/null and Operators/instanceof don't exist in zh-tw).
18 07d804d 18 22 Restore the longform ("Operators/null", "null") and ("Operators/instanceof", "instanceof") calls — the target pages aren't translated in zh-tw, so the shorthands can't redirect to real pages.

Motivation

These arguments produced broken or redirected links (templ-broken-link/templ-redirected-link/templ-ill-cased-arg) in the upcoming Rari-based build. The new index-based jsxref resolver is being introduced in mdn/rari#715; this PR ensures the Traditional Chinese content resolves cleanly against both the deployed rari and the index-aware version.

Additional details

Related issues and pull requests

Related to mdn/rari#715 and mdn/content#44221.

`{{jsxref("Object.prototype")}}` and similar refs were producing
broken links because no `Object/prototype` page exists; the class
page (`Object`, `Array`, etc.) documents `.prototype` directly.
Rewrite to link to the class page.
@github-actions github-actions Bot added the l10n-zh Issues related to Chinese content. label May 21, 2026
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor
Preview URLs (51 pages)
Flaws (48)

Note! 36 documents with no flaws that don't need to be listed. 🎉

Found an unexpected or unresolvable flaw? Please report it here.

URL: /zh-TW/docs/Web/API/Web_Workers_API/Using_web_workers
Title: 使用 Web Worker
Flaw count: 4

  • macros:
    • Macro domxref produces link /zh-TW/docs/Web/API/Worker/onmessage which is a redirect
    • Macro domxref produces link /zh-TW/docs/Web/API/Transferable which doesn't resolve
    • Macro domxref produces link /zh-TW/docs/Web/API/ArrayBuffer which doesn't resolve
    • Macro domxref produces link /zh-TW/docs/Web/API/ChromeWorker which doesn't resolve

URL: /zh-TW/docs/Web/JavaScript
Title: JavaScript
Flaw count: 2

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/this which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Guide/Typed_arrays
Title: JavaScript 型別陣列
Flaw count: 1

  • macros:
    • Macro domxref produces link /zh-TW/docs/Web/API/ArrayBufferView which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference
Title: JavaScript 參考文件
Flaw count: 3

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/this which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/delete which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Functions/get
Title: getter
Flaw count: 1

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/delete which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Functions/set
Title: setter
Flaw count: 1

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/delete which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects
Title: 標準內建物件
Flaw count: 16

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/this which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/SIMD which doesn't resolve
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/Float32x4 which doesn't resolve
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/Float64x2 which doesn't resolve
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/Int8x16 which doesn't resolve
    • and 11 more flaws omitted

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
Title: ArrayBuffer
Flaw count: 1

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/BigInt
Title: BigInt
Flaw count: 1

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
Title: Function.prototype.bind()
Flaw count: 5

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Number
Title: Number
Flaw count: 1

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
Title: Object.defineProperty()
Flaw count: 2

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/Object.prototype.watch() which doesn't resolve
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/Object.prototype.unwatch() which doesn't resolve

URL: /zh-TW/docs/Web/JavaScript/Reference/Lexical_grammar
Title: Lexical grammar
Flaw count: 3

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/delete which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/this which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Operators
Title: 運算式與運算子
Flaw count: 4

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/this which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/delete which is a redirect

URL: /zh-TW/docs/Web/JavaScript/Reference/Operators/Operator_precedence
Title: 運算子優先序
Flaw count: 3

  • macros:
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/new which is a redirect
    • Macro jsxref produces link /zh-TW/docs/Web/JavaScript/Reference/delete which is a redirect
External URLs (3)

URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array
Title: Array


URL: /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/JSON
Title: JSON

(comment last updated: 2026-05-26 01:10:09)

caugner added 17 commits May 21, 2026 19:03
The old `Operators/<Group>_Operators` slugs (Arithmetic, Bitwise,
Comparison, Logical) and related obsolete leaves
(`Destructuring_assignment`, `Legacy_generator_function`,
`Logical_nullish_assignment`, `Nullish_coalescing_operator`,
`Spread_operator`) redirect under the en-US slug graph but never
reach the canonical pages cleanly. Rewrite the first arg to the
current canonical sub-path.
The old slug redirects to `Operators#Assignment_operators`. Rewrite
the macro to use the canonical `Operators` page; existing anchors
on the call site are preserved (most calls already pointed at a
specific assignment-operator section).
`Operators/Array_comprehensions`, `Operators/Generator_comprehensions`,
`Operators/Expression_closures`, and `Statements/Legacy_generator_function`
were removed from JavaScript. Rewrite the macro args to point at
`Deprecated_and_obsolete_features`.
Cover the bare/legacy `Functions_and_function_scope` namespace
(canonical: `Functions`).
…lass>`

Intl member classes (`Collator`, `DateTimeFormat`, `NumberFormat`,
`PluralRules`, etc.) live under `Global_Objects/Intl/`; the top-level
`Global_Objects/<Class>` slug is only a redirect.
Rewrite arg1 for slugs that en-US redirects resolve cleanly: bare
`null`/`eval[()]`, `Global_Objects/null`, `Global_Objects/uneval`,
`Object.toSource[()]`, `Global_Objects/<X>/toSource`,
`Classes/Private_properties` → `Classes/Private_elements`,
`Functions_and_function_scope/{Strict_mode,arguments/length}` →
canonical, `Global_Objects/Array/group{,ToMap}` →
`Global_Objects/{Object,Map}/groupBy` (Array.group was moved to
Object.groupBy / Map.groupBy in the spec).
Strip the `Global_Objects/` prefix when safe — display arg2 is dropped
only when it's the last positional arg and equals the post-strip
default. Skips dotted-leaf suffixes and bare `eval`.
The macro strips `()` for URL resolution but keeps it in the default
display, so arg2 is redundant when it only adds parens to arg1. Only
drops arg2 when it's the last positional arg.
`{{jsxref("NumberFormat")}}` and friends resolve via redirect because
the canonical page lives under `Global_Objects/Intl/<Class>`. Rewrite
the bare and dotted forms to the canonical `Intl/<Class>` path. When
no explicit display arg is set, insert the original arg as the
display text so the rendered label keeps reflecting what the author
originally wrote.
WebAssembly was moved out of `Web/JavaScript/Reference/Global_Objects/`
and now lives at `/WebAssembly/Reference/JavaScript_interface/`. The
`jsxref` macro is scoped to JS Reference, so `WebAssembly.<X>` refs
all surface as `templ-redirected-link`. Convert them to plain markdown
links pointing at the canonical WebAssembly path.

Display preservation: keep an explicit display arg when set; otherwise
use the dotted `WebAssembly.<X>` form (with parens preserved when arg1
had them) so the rendered label is unchanged.
Mechanical edits not covered by the bulk sweeps:

- Strip literal `%2E` URL-encoding in arg1 (`Operators/new%2Etarget`)
  so the macro produces the dotted slug.
- `ArrayBufferView` is a Web IDL type, not a JS Reference page —
  swap `jsxref` for `domxref`.
Lowercase JS class names (`string`/`boolean`/`number`/`object`/
`promise`/`array`/`symbol`) → canonical capitalized form;
`Operators/Conditional_Operator`/`Comma_Operator`/`Function`/
`Operator_Precedence`/`Property_Accessors` → lowercase suffix;
method-name typos (`Date/valueof` → `valueOf`, `Map/foreach` →
`forEach`, `object/defineProperty`/`defineProperties` → `Object/`);
lowercase namespace slugs (`statements/`/`operators/`/`functions/`/
`classes`) → canonical capitalized; `Classes/Constructor` → lowercase
`constructor`; `Regexp/` → `RegExp/`; `Intl/DatetimeFormat` →
`DateTimeFormat`; `Statements/empty` → `Empty`;
`Global_objects/` → `Global_Objects/`; `template_literals` →
`Template_literals`; `Errors/Strict_Non_Simple_Params` casing.

Also resolve the bare `function` ambiguous arg (matches both
`Operators/function` and `Statements/function`) by picking the
expression form — all observed call sites are callback parameters in
WebAPI pages.

Display preservation keeps the original (mis-cased) form rendered so
the link text is unchanged.
Round 2 of the case-fix sweep covering the dotted variants the round-1
mapping missed: `Date.valueof` → `Date.valueOf`, `Map.foreach` →
`Map.forEach`, `Regexp.<member>` → `RegExp.<member>` (for
`global`/`ignoreCase`/`multiline`/`sticky`), `object.defineProperty`/
`defineProperties` → `Object.`, and `Operators/conditional_operator`
(uppercase Operators, lowercase Conditional) → `Operators/Conditional_operator`.
… in case

Over-zealous display preservation inserted by the case-fix sweep:
`{{jsxref("Object", "object")}}` was meant to keep "object" rendered,
but for JS type references the canonical (capitalized) class name
should also be the rendered text. Drop the redundant arg2 when it
matches arg1 case-insensitively — covers `Object`/`String`/`Number`/
`Array`/`Boolean`/`Promise`/`Symbol`/`undefined` and any other
mis-cased pair caught by the index-aware rari.

Only drops arg2 when it's the last positional arg (same safety policy
as `merge-parens-display`).
…perator shorthands

Use the bare-keyword shortform for the 5 operator keywords `null`,
`this`, `delete`, `new`, `instanceof` per the convention introduced
in mdn/content#44221. The shortform resolves cleanly on current rari
thanks to the `Reference/<kw>` -> `Reference/Operators/<kw>`
redirects that PR added, and resolves natively under the index-aware
rari from mdn/rari#715.

Only collapses the redundant-display pattern (`("Operators/X", "X")`);
longforms with custom display text (`"delete x"`, `"deleted"`,
`"x instanceof y"`) are preserved.
Mirrors the en-US redirects added in mdn/content#44221 for the 5
operator-keyword shorthands (`null`, `this`, `delete`, `new`,
`instanceof`). Without these per-locale redirects, the bare-keyword
`{{jsxref("null")}}` shortform produces a 404 under the deployed
rari; with them, it falls back via redirect to the canonical
`Reference/Operators/<kw>` page. The index-aware rari from
mdn/rari#715 resolves the shortform directly without needing the
redirect.
`Web/JavaScript/Reference/Operators/null` and `Operators/instanceof`
are not translated in zh-tw, so the per-locale redirects can't point
there and the bare shortforms would 404. Restore the longform for
those two; `this`/`delete`/`new` keep the shortform.
@caugner caugner changed the title fix(zh-tw): clean up stale jsxref macro args fix(zh-tw): clean up jsxref macro args May 22, 2026
@caugner
caugner marked this pull request as ready for review May 22, 2026 21:16
@caugner
caugner requested a review from a team as a code owner May 22, 2026 21:16
@caugner
caugner requested review from yin1999 and removed request for a team May 22, 2026 21:16

@yin1999 yin1999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @caugner. Let me allow myself to do some additional fixes :)

Comment thread files/zh-tw/web/javascript/reference/global_objects/string/concat/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Comment thread files/zh-tw/web/javascript/reference/operators/index.md Outdated
Co-authored-by: A1lo <yin199909@aliyun.com>

@yin1999 yin1999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @caugner. Let me allow myself to do some additional fixes :)

Comment thread files/zh-tw/web/javascript/reference/global_objects/string/concat/index.md Outdated
@yin1999
yin1999 merged commit dfe1390 into main May 26, 2026
12 checks passed
@yin1999
yin1999 deleted the fix-jsxref-zh-tw branch May 26, 2026 01:10
@github-project-automation github-project-automation Bot moved this from Review requested to Done in MDN translated-content l10n-zh May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

l10n-zh Issues related to Chinese content.

Projects

Development

Successfully merging this pull request may close these issues.

2 participants