Skip to content

Commit 37e8b37

Browse files
authored
Docs pre-release cleanup + fix documentation translation pipeline (#1963)
* docs: remove the pre-release banner and --beta build flag entirely The in-app and website docs carried a 'Pre-release — subject to change' banner injected by build-docs.sh's --beta flag, mirrored by a runtime banner in MarkdownConverter for translated pages, and guarded at release time by a dedicated cut-release/release-gate dance. The banner is no longer wanted. - build-docs.sh: drop the --beta flag and banner injection - MarkdownConverter: drop the runtime banner from wrapInHTMLDocument / wrapInHTMLDocumentForFile / rewrapForFile (callers passed no banner arg) - docs.css: remove the now-unused .pre-release-banner class - docs-deploy.yml: build without --beta; delete the obsolete docs-release-gate.yml (its only job was blocking a banner leak) - cut-release-docs.sh / RELEASING / contributing / copilot-instructions / constitution: drop --beta references and the release-gate workflow row - specs: fix --beta build commands; mark specs/013 (the banner release- versioning feature) Superseded and note the removal in specs/003 FRs - remove an orphaned built page (adding-locale-translations.html) that had no source markdown and still carried the banner - rebuild the in-app HTML bundle Build succeeds for the iOS simulator. * fix: docs translation language detection and stop caching untranslated English Two related docs-translation bugs: 1. Language detection used Locale.current, which reflects the device REGION locale, not the app's display language. With a per-app language override (iOS Settings > App > Language) the UI localizes via preferredLocalizations while Locale.current stays on the device region — so the app could be fully Spanish yet the docs pipeline saw "en" and never translated. Detect the docs language from Bundle.main.documentationLanguageCode (the resolved display localization) instead, across all call sites. 2. translateMarkdown silently fell back to the English source per segment when no translation backend was available (Apple Translation language pack not installed AND FoundationModels unavailable), then cached and even uploaded that English as a completed translation — polluting the on-device cache and the community translations repo. Gate translateMarkdown on a real backend being available up front; return nil (skip) otherwise so nothing fake is cached or uploaded. The HTML path already behaved correctly. * feat: prompt to download the language pack when docs translation is unavailable When the docs language is supported by Apple Translation but the on-device language pack isn't installed (and FoundationModels isn't available), the docs previously just stayed English with no explanation. Add an in-context prompt: - DocTranslationService.translationBackendStatus(for:) reports available / needsLanguagePack / unavailable. - DocBrowserView shows a 'Translate Documentation' banner with a Download button when the pack is needed; tapping it runs a Translation framework prepareTranslation() download (LanguagePackDownloadModifier), then re-runs the pipeline so the docs translate in-session. - kickoffTranslation() also reloads DocBundle after on-device prefetch builds the rendered folder, so on-device translations appear without a cold relaunch. Compiled to a no-op on Mac Catalyst / pre-iOS 26 where the Translation framework is unavailable.
1 parent 22c9690 commit 37e8b37

33 files changed

Lines changed: 241 additions & 694 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ The app ships a complete offline documentation system (feature `003-app-docs-mar
195195
- The `**` closing the title must be immediately adjacent to the last word (no trailing space): `> **Tip — Title**` ✓, `> **Tip — Title **` ✗.
196196
- **After editing any `.md` file under `docs/`**, regenerate the bundled HTML and commit it:
197197
```bash
198-
bash scripts/build-docs.sh --output Meshtastic/Resources/docs --beta
198+
bash scripts/build-docs.sh --output Meshtastic/Resources/docs
199199
```
200200
Then copy updated snapshots if needed:
201201
```bash

.github/workflows/docs-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
run: sudo apt-get install -y cmark-gfm
8282

8383
- name: Build docs bundle
84-
run: bash scripts/build-docs.sh --output Meshtastic/Resources/docs --beta
84+
run: bash scripts/build-docs.sh --output Meshtastic/Resources/docs
8585

8686
- name: Setup Ruby
8787
uses: ruby/setup-ruby@v1

.github/workflows/docs-release-gate.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/docs-staleness.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
'',
9090
'If this PR does **not** require a doc update (e.g., internal refactor, bug fix, test change), add the **`skip-docs-check`** label to dismiss this warning.',
9191
'',
92-
'After updating `docs/`, re-run `bash scripts/build-docs.sh --output Meshtastic/Resources/docs --beta` locally and commit the regenerated HTML bundle.',
92+
'After updating `docs/`, re-run `bash scripts/build-docs.sh --output Meshtastic/Resources/docs` locally and commit the regenerated HTML bundle.',
9393
].join('\n');
9494
9595
// Find and update an existing bot comment, or create a new one

.specify/memory/constitution.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Sync Impact Report
99
in-app and on the website — using the shared
1010
`**Month YYYY** — [Page](path.md) — sentence` format showing ~12 months;
1111
docs/index.md is a Quick Links hub; no release notes / RELEASENOTES.md;
12-
rebuild in-app HTML with `--beta`
12+
rebuild in-app HTML after editing docs
1313
Added sections: none
1414
Removed sections: N/A
1515
Templates requiring updates:
@@ -219,9 +219,8 @@ cross-platform consistency as standards evolve.
219219
The website home `docs/index.md` is a Quick Links nav hub (no changelog),
220220
and the guide landings `docs/user.md` / `docs/developer.md` link to their
221221
"What's New" child rather than duplicating it. After editing any in-app
222-
doc, run `scripts/build-docs.sh --output Meshtastic/Resources/docs --beta`
223-
to regenerate the bundled HTML under `Meshtastic/Resources/docs/` (the
224-
`--beta` flag preserves the pre-release banner the repo ships with).
222+
doc, run `scripts/build-docs.sh --output Meshtastic/Resources/docs`
223+
to regenerate the bundled HTML under `Meshtastic/Resources/docs/`.
225224

226225
## Governance
227226

Meshtastic/Extensions/Bundle.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,17 @@ extension Bundle {
3131
return false
3232
#endif
3333
}
34+
35+
/// The language the app is actually *displaying* in, normalized to a language code (e.g. "es").
36+
///
37+
/// Use this — not `Locale.current` — to decide the documentation translation target. A per-app
38+
/// language override (iOS Settings → Meshtastic → Language) localizes the UI via
39+
/// `preferredLocalizations` but leaves `Locale.current` reflecting the device's region locale,
40+
/// so they disagree: the app can be fully Spanish while `Locale.current.language.languageCode`
41+
/// is still "en". Keying docs translation off the display localization keeps docs in sync with
42+
/// the chrome the user actually sees. Falls back to "en".
43+
public var documentationLanguageCode: String {
44+
let preferred = preferredLocalizations.first ?? "en"
45+
return Locale(identifier: preferred).language.languageCode?.identifier ?? "en"
46+
}
3447
}

Meshtastic/Resources/docs/assets/docs.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,3 @@ picture img {
349349
margin-bottom: 6px;
350350
color: var(--warning-border);
351351
}
352-
353-
/* ── Pre-release warning banner ── */
354-
.pre-release-banner {
355-
background-color: var(--warning-bg);
356-
border: 1px solid var(--warning-border);
357-
border-radius: 6px;
358-
padding: 10px 14px;
359-
margin-bottom: 16px;
360-
font-size: 0.875rem;
361-
}

Meshtastic/Resources/docs/developer/adding-locale-translations.html

Lines changed: 0 additions & 255 deletions
This file was deleted.

Meshtastic/Resources/docs/developer/contributing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h2>Documentation</h2>
4545
</tbody>
4646
</table>
4747
<p>Source markdown lives under <code>docs/user/</code> and <code>docs/developer/</code>. To rebuild the bundled HTML after editing any markdown:</p>
48-
<pre><code class="language-sh">bash scripts/build-docs.sh --output Meshtastic/Resources/docs --beta
48+
<pre><code class="language-sh">bash scripts/build-docs.sh --output Meshtastic/Resources/docs
4949
</code></pre>
5050
<p>Commit the regenerated files under <code>Meshtastic/Resources/docs/</code> with your PR.</p>
5151
<h2>Branch Naming</h2>

0 commit comments

Comments
 (0)