Repository navigation
web: localize Pierre diff and file tree text - #8435
Merged
Merged
Conversation
unknwon
force-pushed
the
jc/pierre-labels-patch
branch
from
November 7, 2026 18:11
379b2fa to
b1f01ce
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Both Docker webbuilder stages omit patches/, leaving registered patch files missing and causing both image builds to fail during pnpm install --frozen-lockfile.
1 open issue
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
This PR localizes Pierre-rendered diff and file tree text directly in the React frontend, replacing post-render shadow DOM rewriting.
Changes:
- Adds dependency patches exposing label options for
@pierre/diffsand@pierre/trees. - Passes memoized translations to diff and tree renderers, including tree label updates.
- Adds English locale keys and records both patches in pnpm configuration and the lockfile.
| File | Description |
|---|---|
web/src/pages/repo/Commit.tsx |
Replaces the observer workaround with localized diff options. |
web/src/locales/en-US.json |
Adds generated English diff and tree labels. |
web/src/components/DiffFileTree.tsx |
Supplies translated search and status labels and refreshes them when changed. |
web/scripts/extract-locales.mjs |
Includes the new locale keys in extraction. |
pnpm-workspace.yaml |
Registers both dependency patches. |
pnpm-lock.yaml |
Records patch hashes and patched dependency resolutions. |
patches/@[email protected] |
Adds tree label options and runtime updates. |
patches/@[email protected] |
Adds label options to diff rendering and CodeView. |
conf/locale/locale_en-US.ini |
Defines the new source English strings. |
Review effort: Max
unknwon
force-pushed
the
jc/pierre-labels-patch
branch
from
November 11, 2026 19:52
428b3ed to
a565dda
Compare
appthin
added a commit
to appthin/gogs-plus
that referenced
this pull request
Nov 12, 2026
Brings in the 0.14.4 security and bug fixes (gogs#8439, gogs#8472, gogs#8478, gogs#8480-gogs#8484, gogs#8486, gogs#8488), the Highlights-based diff highlighter for the web UI (gogs#8492, gogs#8434, gogs#8435), absolute entrypoint paths for the SPA shell (gogs#8447), Docker workflow updates (gogs#8463, gogs#8475), and housekeeping. Fork-specific code is preserved: CodeQL workflow, login bans, sign-in protection, the -plus release pipeline, and the rewritten README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Describe the pull request
Pierre's diff view and file tree render their own English text inside shadow roots. This PR localizes that text through the upstream APIs, instead of rewriting the DOM after each render.
@pierre/diffsfrom 1.6.4 to1.7.0-beta.2, which adds a package-widei18nstore ([diffs] Add a labels option for localizing diff text pierrecomputer/pierre#1271).lib/i18n.tsfills it once at startup from the INI-backed locale. That covers "N unmodified lines" (as an ICU plural built from the existing keys), "Expand all" on large collapsed regions, and "No newline at end of file". The text is correct on first paint. A translation that Pierre's ICU parser rejects is logged, and the diff falls back to English instead of failing app startup.@pierre/treesfrom 1.0.0-beta.6 to 1.0.0 and passes itslabelsoption ([trees] Add a labels option for localizing tree text pierrecomputer/pierre#1272). This localizes the search placeholder, the added, deleted, modified, and renamed status tooltips, and the "contains changed files" tooltip on directories. None of these were localized before.Commit.tsxno longer uses aMutationObserverthat walked every shadow root to replace Pierre's English text.DiffFileTree.tsxno longer reopens tree search after a row click. Trees 1.0.0 keeps search open after a click or Enter (feat(trees): Keep file-tree search open and interactive pierrecomputer/pierre#1022). Clicking outside the tree still closes it.web:buildandweb:lintnow listconf/locale/locale_*.iniandscripts/extract-locales.mjsas inputs. Before, an INI-only change could hit moon's cache and leavesrc/locales/*.jsonstale.repo.diff.expand_all,repo.diff.file_added,repo.diff.file_deleted,repo.diff.file_modified,repo.diff.file_renamed,repo.diff.contains_changed_files. The tree search placeholder reusesrepo.search_files.data-*attribute the diff CSS targets is still emitted.Link to the issue: n/a
Checklist
Test plan
moon run web:buildandmoon run web:lintpass.@pierre/[email protected]throughpreloadFileDiffshows English by default and only the translated text afteri18n.set(), with the singular and plural forms selected correctly.@pierre/[email protected]throughpreloadFileTreeemits the custom labels and falls back to English per label.?i18n_debug=1, confirm that the separator count, "Expand all" on a gap over 100 lines, "No newline at end of file", the tree search placeholder, and the tree status tooltips all show their keys.moon run web:linttwice so the second run is cached. Change only a value inconf/locale/locale_en-US.iniand run it again. The task reruns andweb/src/locales/en-US.jsonpicks up the change.