mirror of
https://github.com/storytold/soundcraft.git
synced 2026-11-29 01:07:06 -06:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35dcf1d412 | ||
|
|
f155bba583 | ||
|
|
896de30146 | ||
|
|
681f40f566 | ||
|
|
a3c7f4edc7 | ||
|
|
7fe79e21ed | ||
|
|
d42ade0951 | ||
|
|
025cf1e0ba | ||
|
|
31dfc36766 | ||
|
|
7a563aca6e | ||
|
|
af7c16b570 | ||
|
|
60950ba884 | ||
|
|
c776bbd2b4 |
@@ -95,7 +95,15 @@
|
||||
"unsigned_artifact_name": "nightly-unsigned-linux-x86_64",
|
||||
"trust": {
|
||||
"fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED"
|
||||
}
|
||||
},
|
||||
"package_formats": [
|
||||
"appimage",
|
||||
"arch",
|
||||
"deb",
|
||||
"flatpak",
|
||||
"oci",
|
||||
"rpm"
|
||||
]
|
||||
},
|
||||
"macos-aarch64": {
|
||||
"unsigned_artifact_name": "nightly-unsigned-macos-aarch64",
|
||||
|
||||
@@ -37,6 +37,7 @@ jobs:
|
||||
dry-run: ${{ github.event_name == 'schedule' }}
|
||||
app-name: soundcraft
|
||||
app-title: SoundCraft
|
||||
macos-runner: macos-15
|
||||
version: ${{ inputs.version }}
|
||||
contributors-artifact: ${{ needs.credits.outputs.artifact-name }}
|
||||
secrets:
|
||||
|
||||
+14
-3
@@ -21,9 +21,18 @@ are bundled.
|
||||
|
||||
## Fonts
|
||||
|
||||
SoundCraft bundles no font files. It uses the default fonts shipped inside the `egui` crate
|
||||
(Ubuntu-Light: Ubuntu Font Licence 1.0; Hack: MIT; Noto Emoji: OFL-1.1; emoji-icon-font: MIT)
|
||||
and, at runtime, the operating system's own UI fonts when available (never redistributed).
|
||||
SoundCraft ships one font file, for the web build only. Everything else is the default fonts
|
||||
shipped inside the `egui` crate (Ubuntu-Light: Ubuntu Font Licence 1.0; Hack: MIT; Noto Emoji:
|
||||
OFL-1.1; emoji-icon-font: MIT) and, at runtime, the operating system's own UI fonts when available
|
||||
(never redistributed).
|
||||
|
||||
The browser cannot reach the operating system's fonts, and egui's bundled faces carry no Han
|
||||
glyphs, so a Simplified Chinese interface would draw boxes. `assets/fonts/NotoSansSC-SoundCraftSubset.ttf`
|
||||
is therefore compiled into the web build alone (`crates/ui-egui/src/fonts.rs`): a subset of the
|
||||
Noto Sans SC variable font, pinned at weight 400 and reduced with fontTools to the UI glyph set
|
||||
(the zh-Hans catalog, GB 2312 level-1 common characters, ASCII, Latin-1 letters and the UI's
|
||||
punctuation, arrows and triangles; about 1.1 MiB). It is SIL Open Font License 1.1 — see
|
||||
`assets/fonts/OFL.txt`. Native builds never embed it and keep drawing with system fonts.
|
||||
|
||||
## Bundled egui font icons
|
||||
|
||||
@@ -47,6 +56,8 @@ here. The subset uses default_fonts; the parent face uses monochrome_emoji_fonts
|
||||
| `docs/brand/artcraft-mark.png` | ArtCraft Team | ArtCraft brand assets | ArtCraft brand terms |
|
||||
| `docs/brand/artcraft-mark-black.svg` | ArtCraft Team | ArtCraft brand assets | ArtCraft brand terms |
|
||||
| `docs/brand/artcraft-mark-black.png` | ArtCraft Team | ArtCraft brand assets | ArtCraft brand terms |
|
||||
| `assets/fonts/NotoSansSC-SoundCraftSubset.ttf` | Google LLC / Noto Project Authors | Noto Sans SC variable font, subset to the UI glyph set and pinned at weight 400 (generated with fontTools by `docs/i18n/tools/subset_web_font.py`) | SIL Open Font License 1.1 (`assets/fonts/OFL.txt`) |
|
||||
| `assets/fonts/OFL.txt` | Noto Project Authors / SIL | SIL Open Font License 1.1 text | OFL-1.1 |
|
||||
| `assets/app-icon/icon.svg` | SoundCraft contributors | original (hand-placed SVG paths; placeholder app icon) | MIT OR Apache-2.0 |
|
||||
| `packaging/macos/dmg/` (all files) | @XusBadia | original (macOS DMG window background and layout, from the app icon; see `packaging/macos/dmg/README.md`) | MIT OR Apache-2.0 |
|
||||
| `assets/app-icon/soundcraft-1024.png` | SoundCraft contributors | original, rendered from `icon.svg` | MIT OR Apache-2.0 |
|
||||
|
||||
Generated
+18
-18
@@ -5971,7 +5971,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
@@ -5996,7 +5996,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-au-host"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
@@ -6006,7 +6006,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-automation"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"craft-audio",
|
||||
@@ -6020,7 +6020,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-clap-host"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"clap-sys",
|
||||
"libc",
|
||||
@@ -6035,7 +6035,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-cli"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
@@ -6053,7 +6053,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-dsp"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"proptest",
|
||||
@@ -6064,7 +6064,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-engine"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
"craft-aaf",
|
||||
@@ -6094,7 +6094,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-interchange"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
"craft-aaf",
|
||||
@@ -6107,7 +6107,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-midi"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-midi",
|
||||
"proptest",
|
||||
@@ -6115,7 +6115,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-mix"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"log",
|
||||
@@ -6131,14 +6131,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-model"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-scraft-format",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-playback"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"cpal",
|
||||
"craft-audio",
|
||||
@@ -6154,14 +6154,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-time"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-ui-egui"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"craft-behavior",
|
||||
@@ -6197,7 +6197,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-video"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-media",
|
||||
"craft-video",
|
||||
@@ -6208,7 +6208,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-vst3-host"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"libloading 0.9.0",
|
||||
@@ -6226,7 +6226,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-web"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"craft-web-api",
|
||||
@@ -8150,7 +8150,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"
|
||||
|
||||
[[package]]
|
||||
name = "xtask"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"]
|
||||
default-members = ["crates/*", "apps/*", "xtask"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.95"
|
||||
|
||||
+4
-3
@@ -52,7 +52,7 @@ measures readiness and adds hardware, localization and field bug reports.
|
||||
| UI/UX fidelity | ~55 % | 60–100 | [ui-parity.md](docs/ui-parity.md) |
|
||||
| File formats | ~40 % | 70–120 | [file-format-parity.md](docs/file-format-parity.md) |
|
||||
| Hardware (interfaces, MIDI, surfaces, sync) | ~12 % | 110–180 | [hardware-parity.md](docs/hardware-parity.md) |
|
||||
| Localization | ~12 % (1 of Pro Tools' 8 languages; English and pt-BR fixed UI strings, no CJK/RTL font fallback or native review) | 70–110 | [localization-parity.md](docs/localization-parity.md) |
|
||||
| Localization | ~19 % (2 of Pro Tools' 8 languages; English, pt-BR and zh-Hans fixed UI strings, with a CJK fallback and a web Han font; no RTL or complex-script shaping, no native review) | 55–90 | [localization-parity.md](docs/localization-parity.md) |
|
||||
| Performance | ~35 % (unmeasured) | 40–70 | [hardware-parity.md](docs/hardware-parity.md#performance) |
|
||||
| Stability | ~45 % | 50–80 | [gaps.md](docs/gaps.md) |
|
||||
| Platforms | ~65 % (5 platforms built, macOS exercised) | 20–40 | [gaps.md](docs/gaps.md) |
|
||||
@@ -86,7 +86,7 @@ Weights and evidence per row: [target-app-parity.md](docs/target-app-parity.md#f
|
||||
| Language | Code | Status | Translated |
|
||||
|---|---|---|---:|
|
||||
| English | en | full | 100 % |
|
||||
| Simplified Chinese | zh-Hans | none | 0 % |
|
||||
| Simplified Chinese | zh-Hans | full — 100 % of fixed UI strings; CJK fallback, web Han font, tests pass | 100 % (native-speaker review pending) |
|
||||
| Spanish | es | full — 100 % of fixed UI strings and engine errors; tests pass | 100 % (native-speaker review done) |
|
||||
| Hindi | hi | none | 0 % |
|
||||
| Arabic | ar | none | 0 % |
|
||||
@@ -98,7 +98,7 @@ Weights and evidence per row: [target-app-parity.md](docs/target-app-parity.md#f
|
||||
| Korean | ko | none | 0 % |
|
||||
| Vietnamese | vi | none | 0 % |
|
||||
|
||||
Other languages shipped: Spanish complete (fixed UI strings and engine errors, native-speaker review). French is partial (≈ 62 %). Brazilian Portuguese covers the fixed UI strings (100 %), with native-speaker review, CJK/RTL font fallbacks and script shaping still pending. Detail: [localization-parity.md](docs/localization-parity.md).
|
||||
Other languages shipped: Spanish complete (fixed UI strings and engine errors, native-speaker review). French is partial (≈ 62 %). Brazilian Portuguese and Simplified Chinese cover the fixed UI strings (100 %); both still need native-speaker review. CJK fallbacks ship for Chinese, while RTL and complex-script shaping are still missing. Detail: [localization-parity.md](docs/localization-parity.md).
|
||||
|
||||
## Upcoming
|
||||
|
||||
@@ -191,6 +191,7 @@ mutated and truncated movies. Field reports from the first public week are track
|
||||
|---|---|---|
|
||||
| 2026-11-27 | trivial | Languages table: Spanish catalog complete with native-speaker review. Estimates unchanged |
|
||||
| 2026-11-24 | trivial | Languages table: French and Spanish catalogs, partial (≈ 62 %), PR #143. Estimates unchanged |
|
||||
| 2026-11-22 | minor | Languages table: Simplified Chinese (zh-Hans) covers the fixed UI strings through the `locales/zh-Hans` catalog, with a Han system-font fallback and an OFL web subset; needs native review. Localization estimate 70–110 → 55–90 h |
|
||||
| 2026-11-14 | minor | Strict external-WAV AAF import with bounded property caching; remaining interchange work and readiness estimates unchanged |
|
||||
| 2026-11-09 | trivial | Progress log: Frequency Shifter plugin; readiness estimates unchanged |
|
||||
| 2026-11-08 | trivial | Command-click breakpoint/control priority and insertion affordance; active-tool drags retained; readiness estimates unchanged |
|
||||
|
||||
@@ -12,18 +12,38 @@
|
||||
import { createRequire } from 'node:module'
|
||||
import http from 'node:http'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
const dir = process.argv[2]
|
||||
if (!dir) { console.error('usage: node page-api.mjs <site folder>'); process.exit(2) }
|
||||
const cwd = path.resolve(process.cwd())
|
||||
const tmp = path.resolve(os.tmpdir())
|
||||
const rootDir = path.resolve(cwd, dir)
|
||||
const inAllowedRoot =
|
||||
rootDir === cwd ||
|
||||
rootDir.startsWith(cwd + path.sep) ||
|
||||
rootDir === tmp ||
|
||||
rootDir.startsWith(tmp + path.sep)
|
||||
if (!inAllowedRoot) {
|
||||
console.error('site folder must be inside the current working directory or system temp directory')
|
||||
process.exit(2)
|
||||
}
|
||||
const rootPrefix = rootDir.endsWith(path.sep) ? rootDir : rootDir + path.sep
|
||||
const require = createRequire(path.join(process.cwd(), 'noop.js'))
|
||||
const { chromium } = (() => { try { return require('playwright') } catch { return require('@playwright/test') } })()
|
||||
|
||||
const types = { '.html': 'text/html', '.js': 'text/javascript', '.wasm': 'application/wasm', '.png': 'image/png' }
|
||||
const server = http.createServer(async (req, res) => {
|
||||
const route = decodeURIComponent(req.url.split('?')[0])
|
||||
const file = path.join(dir, route === '/' ? 'index.html' : route)
|
||||
const relPath = (route === '/' ? 'index.html' : route).replace(/^\/+/, '')
|
||||
const file = path.resolve(rootDir, relPath)
|
||||
if (!file.startsWith(rootPrefix)) {
|
||||
res.writeHead(403)
|
||||
res.end()
|
||||
return
|
||||
}
|
||||
try {
|
||||
const body = await readFile(file)
|
||||
res.writeHead(200, { 'content-type': types[path.extname(file)] || 'application/octet-stream' })
|
||||
@@ -42,7 +62,7 @@ try {
|
||||
await page.locator('canvas').first().waitFor({ timeout: 180_000 })
|
||||
await page.waitForFunction(() => window.soundcraft && typeof window.soundcraft.request === 'function', null, { timeout: 180_000 })
|
||||
|
||||
const names = await page.evaluate(() => Object.keys(window.soundcraft).sort())
|
||||
const names = await page.evaluate(() => Object.keys(window.soundcraft).sort((a, b) => a.localeCompare(b)))
|
||||
for (const f of ['request', 'execute', 'commands', 'docInspect', 'uiInspect', 'screenshot']) {
|
||||
assert(names.includes(f), `window.soundcraft.${f} is installed (found: ${names.join(' ')})`)
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 46 KiB |
Binary file not shown.
@@ -0,0 +1,93 @@
|
||||
Copyright © 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
+20
-4
@@ -18,13 +18,27 @@ fn midi_offset(s: &Session, t: &Track) -> i64 {
|
||||
.map_or(0, |v| v as i64)
|
||||
}
|
||||
|
||||
/// Send note on/offs and controllers for MIDI clips overlapping the block.
|
||||
/// Send note on/offs and controllers for MIDI clips overlapping the block. With `chase` (the
|
||||
/// first block after a start or seek), notes already sounding at `pos` are struck at the block
|
||||
/// start too, so a chord that began before a seek is heard rather than skipped until the next one.
|
||||
///
|
||||
/// `live` holds the notes played live on the same instrument. Instruments end notes by pitch, so
|
||||
/// a clip note-off is not sent while a live key holds that pitch: the key's own release ends it.
|
||||
/// A note-off held back that way is told to `live`: when the key goes up earlier in the same
|
||||
/// block, the note still lasts until the clip's note-off.
|
||||
pub(crate) fn schedule_notes(s: &Session, t: &Track, pos: Samples, frames: usize, inst: &mut PluginSlot, held: &mut Vec<u8>, live: &mut LiveNotes) {
|
||||
// The block, the instrument, its held and live notes, and whether this block chases: one call per
|
||||
// block from `render_instrument`, so a struct would only repack these.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn schedule_notes(
|
||||
s: &Session,
|
||||
t: &Track,
|
||||
pos: Samples,
|
||||
frames: usize,
|
||||
inst: &mut PluginSlot,
|
||||
held: &mut Vec<u8>,
|
||||
live: &mut LiveNotes,
|
||||
chase: bool,
|
||||
) {
|
||||
let sr = s.sample_rate;
|
||||
// MIDI Track Offsets: the track's notes sound `offset` samples later (earlier if negative), so
|
||||
// the block looks that far back into the clips.
|
||||
@@ -36,7 +50,9 @@ pub(crate) fn schedule_notes(s: &Session, t: &Track, pos: Samples, frames: usize
|
||||
continue;
|
||||
}
|
||||
let ClipContent::Midi { sequence } = &clip.content else { continue };
|
||||
if !clip.range().overlaps(&Range { start: pos, end }) {
|
||||
// A note-off clamped to the clip end falls on the first sample after the
|
||||
// clip, so a block starting exactly there still releases its notes.
|
||||
if !clip.range().overlaps(&Range { start: pos, end }) && clip.end() != pos {
|
||||
continue;
|
||||
}
|
||||
let base = s.tempo.samples_to_ticks(clip.start, sr);
|
||||
@@ -71,7 +87,7 @@ pub(crate) fn schedule_notes(s: &Session, t: &Track, pos: Samples, frames: usize
|
||||
if on >= clip.end() {
|
||||
continue;
|
||||
}
|
||||
if on >= pos && on < end {
|
||||
if (on >= pos && on < end) || (chase && on < pos && off > pos) {
|
||||
inst.plugin.note_on(usize::try_from(on - pos).unwrap_or(0), n.pitch, n.velocity);
|
||||
if !held.contains(&n.pitch) && held.len() < 128 {
|
||||
held.push(n.pitch);
|
||||
|
||||
+10
-3
@@ -60,6 +60,9 @@ pub(crate) struct Strip {
|
||||
pub(crate) live: LiveNotes,
|
||||
/// The instrument's next block starts somewhere new: send it the controllers in effect there.
|
||||
pub(crate) chase: bool,
|
||||
/// Live controllers moved the instrument and were let go: the next block sends it the clips'
|
||||
/// controllers again, without striking the notes already sounding (that is `chase`).
|
||||
pub(crate) restore_controllers: bool,
|
||||
/// The last block played the clips: stopped monitoring has their sustain pedal to let go of.
|
||||
pub(crate) clips_played: bool,
|
||||
pub(crate) muted: bool,
|
||||
@@ -164,6 +167,7 @@ impl Strip {
|
||||
held: Vec::new(),
|
||||
live: LiveNotes::default(),
|
||||
chase: true,
|
||||
restore_controllers: false,
|
||||
clips_played: false,
|
||||
muted: false,
|
||||
gr: 0.0,
|
||||
@@ -343,7 +347,10 @@ fn render_instrument(s: &Session, t: &Track, strip: &mut Strip, live: &LiveInput
|
||||
}
|
||||
inst.plugin.set_transport(transport);
|
||||
// Whether the clips' controller values were sent to the instrument for this block.
|
||||
let mut chased = std::mem::take(&mut strip.chase);
|
||||
// A start or seek: notes already sounding are struck again too (not when only a live
|
||||
// source went away, below; those notes are still held).
|
||||
let chase = std::mem::take(&mut strip.chase);
|
||||
let mut chased = chase | std::mem::take(&mut strip.restore_controllers);
|
||||
if chased {
|
||||
let from_clips = chase_controllers(s, t, pos, inst);
|
||||
strip.live.restore_defaults(from_clips, inst.plugin.as_mut());
|
||||
@@ -364,7 +371,7 @@ fn render_instrument(s: &Session, t: &Track, strip: &mut Strip, live: &LiveInput
|
||||
chased = true;
|
||||
}
|
||||
if !live.monitor_only {
|
||||
schedule_notes(s, t, pos, frames, inst, &mut strip.held, &mut strip.live);
|
||||
schedule_notes(s, t, pos, frames, inst, &mut strip.held, &mut strip.live, chase);
|
||||
strip.clips_played = true;
|
||||
} else {
|
||||
// Stopped: the clips are silent, only live MIDI input plays. Playback that ran to its
|
||||
@@ -389,7 +396,7 @@ fn render_instrument(s: &Session, t: &Track, strip: &mut Strip, live: &LiveInput
|
||||
strip.live.play(t, inst.plugin.as_mut(), live.midi, live.ports, frames);
|
||||
} else if strip.live.touched() && strip.live.release(inst.plugin.as_mut()) {
|
||||
// Live controllers moved the instrument: the next block sets them from the clips.
|
||||
strip.chase = true;
|
||||
strip.restore_controllers = true;
|
||||
}
|
||||
if strip.buf.len() >= 2 {
|
||||
inst.plugin.process(&mut strip.buf, frames);
|
||||
|
||||
@@ -47,6 +47,20 @@ fn delay_line_change_keeps_buffers_and_history() {
|
||||
assert_eq!(ptrs, after, "delay line reallocated going back to its size");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn note_off_at_the_clip_end_on_a_block_boundary_releases_the_note() {
|
||||
// The note ends with its 24,000-sample clip; 480-frame blocks put that
|
||||
// note-off at the first sample of the block after the clip.
|
||||
let mut s = synth_session(-6.0);
|
||||
if let Some(ins) = s.tracks[0].instrument.as_mut() {
|
||||
ins.params.insert("amp_release".into(), 20.0);
|
||||
}
|
||||
let out = render_range(&s, Range::new(0, 48_000), 480);
|
||||
let peak = |r: std::ops::Range<usize>| out[0].get(r).unwrap_or_default().iter().fold(0.0_f32, |p, x| p.max(x.abs()));
|
||||
assert!(peak(12_000..24_000) > 0.01, "the synth should sound");
|
||||
assert!(peak(30_000..48_000) < 1e-4, "the note must be released at the clip end");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stored_instrument_params_reach_the_plugin() {
|
||||
// #152: a saved instrument level of -12 dB must render quieter than -6 dB.
|
||||
@@ -529,6 +543,36 @@ impl Plugin for Ears {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notes_held_across_a_seek_are_struck_again() {
|
||||
let mut s = Session::default();
|
||||
let t = s.add_track(TrackKind::Instrument, ChannelFormat::Stereo, None);
|
||||
s.track_mut(t).unwrap().instrument = Some(Insert::new("clap:test.keys"));
|
||||
let mut seq = soundcraft_midi::Sequence::default();
|
||||
// A two-note chord over the first two beats at 120 BPM (0..48_000), then a note from beat 3.
|
||||
for pitch in [60, 64] {
|
||||
seq.notes.push(soundcraft_midi::Note { pitch, velocity: 90, release_velocity: 64, channel: 0, start: 0, length: 1920 });
|
||||
}
|
||||
seq.notes.push(soundcraft_midi::Note { pitch: 67, velocity: 90, release_velocity: 64, channel: 0, start: 1920, length: 960 });
|
||||
let cid = s.new_clip_id();
|
||||
s.track_mut(t).unwrap().playlist_mut().unwrap().clips.push(Clip::midi(cid, "m", 0, 96_000, seq));
|
||||
let heard = Arc::new(std::sync::Mutex::new(Vec::new()));
|
||||
let keys = Keys { inner: soundcraft_dsp::create("gain").unwrap(), heard: Arc::clone(&heard) };
|
||||
let mut eng = MixEngine::new(48_000.0, 512);
|
||||
eng.set_external_instances(true);
|
||||
eng.adopt(vec![PreparedInstance { track: t, slot: INSTRUMENT_SLOT, id: "clap:test.keys".into(), ch: 2, plugin: Box::new(keys) }]);
|
||||
render_block(&mut eng, &s, 0);
|
||||
assert_eq!(std::mem::take(&mut *heard.lock().unwrap()), vec![(60, 90), (64, 90)]);
|
||||
render_block(&mut eng, &s, 512);
|
||||
assert!(heard.lock().unwrap().is_empty(), "continuing playback does not strike held notes again");
|
||||
// Seek into the middle of the chord: both notes sound again from the block start.
|
||||
render_block(&mut eng, &s, 24_000);
|
||||
assert_eq!(std::mem::take(&mut *heard.lock().unwrap()), vec![(60, 90), (64, 90)]);
|
||||
// Seek past the chord into the later note: only that one is chased.
|
||||
render_block(&mut eng, &s, 60_000);
|
||||
assert_eq!(std::mem::take(&mut *heard.lock().unwrap()), vec![(67, 90)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn controllers_play_at_their_offsets_and_are_chased_after_a_seek() {
|
||||
let mut s = Session::default();
|
||||
|
||||
@@ -1793,6 +1793,7 @@ pub(super) fn translate(source: &str) -> Option<&'static str> {
|
||||
"SoundFlow" => "SoundFlow",
|
||||
"Space Clips…" => "Espaciar clips…",
|
||||
"Spanish" => "Español",
|
||||
"Simplified Chinese" => "Chino simplificado",
|
||||
"Speed Ramp" => "Speed Ramp",
|
||||
"Splice" => "Splice",
|
||||
"Split into Mono" => "Dividir en mono",
|
||||
|
||||
@@ -1181,6 +1181,7 @@ pub(super) fn translate(source: &str) -> Option<&'static str> {
|
||||
"SoundFlow" => "SoundFlow",
|
||||
"Space Clips…" => "Espacer les clips…",
|
||||
"Spanish" => "Espagnol",
|
||||
"Simplified Chinese" => "Chinois simplifié",
|
||||
"Speed Ramp" => "Speed Ramp",
|
||||
"Splice" => "Splice",
|
||||
"Split into Mono" => "Scinder en mono",
|
||||
|
||||
@@ -1784,6 +1784,7 @@ fn menu_translate(source: &str) -> Option<&'static str> {
|
||||
"Portuguese (Brazil)" => "Português (Brasil)",
|
||||
"French" => "Francês",
|
||||
"Spanish" => "Espanhol",
|
||||
"Simplified Chinese" => "Chinês simplificado",
|
||||
"key:Space" => "Espaço",
|
||||
"key:Up" => "Cima",
|
||||
"key:Down" => "Baixo",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+196
-20
@@ -1,10 +1,13 @@
|
||||
//! Fonts: egui's bundled defaults, plus the operating system's own UI fonts loaded at runtime when
|
||||
//! present (never redistributed). A "bold" family is always defined so the UI can use it.
|
||||
//! present (never redistributed). The web build, which reaches no operating-system fonts, bundles a
|
||||
//! small Open Font License subset of Noto Sans SC instead (see `assets/fonts/` and
|
||||
//! `ATTRIBUTION.md`). A "bold" family is always defined so the UI can use it.
|
||||
|
||||
use egui::{FontData, FontDefinitions, FontFamily};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// (path, ttc index) candidates for regular and bold UI text, by platform.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const REGULAR: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/HelveticaNeue.ttc", 0),
|
||||
("/System/Library/Fonts/Helvetica.ttc", 0),
|
||||
@@ -17,6 +20,7 @@ const REGULAR: &[(&str, u32)] = &[
|
||||
("/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf", 0),
|
||||
("/usr/share/fonts/liberation-sans-fonts/LiberationSans-Regular.ttf", 0),
|
||||
];
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const BOLD: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/HelveticaNeue.ttc", 1),
|
||||
("/System/Library/Fonts/Helvetica.ttc", 1),
|
||||
@@ -31,6 +35,7 @@ const BOLD: &[(&str, u32)] = &[
|
||||
];
|
||||
/// Hangul fallback, appended after every family so Korean session, track and clip names draw
|
||||
/// whatever the interface language. The Noto Sans CJK collection's face 1 is its Korean face.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const HANGUL: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/AppleSDGothicNeo.ttc", 0),
|
||||
("/System/Library/Fonts/Supplemental/AppleGothic.ttf", 0),
|
||||
@@ -42,9 +47,40 @@ const HANGUL: &[(&str, u32)] = &[
|
||||
("/usr/share/fonts/truetype/nanum/NanumGothic.ttf", 0),
|
||||
("/usr/share/fonts/naver-nanum/NanumGothic.ttf", 0),
|
||||
];
|
||||
/// Han fallback (Simplified Chinese first), placed before [`HANGUL`] for every interface language
|
||||
/// except Korean, so a Chinese interface and Chinese session, track and clip names draw in Chinese
|
||||
/// shapes instead of boxes. On Linux the first resolvable CJK face is often Noto Sans CJK's Korean
|
||||
/// face, whose Han glyphs are Korean-styled; the first face with a glyph wins, so Han must come
|
||||
/// first. Face 2 of the Noto Sans CJK collection is its Simplified Chinese face (face 0 is
|
||||
/// Japanese, 1 Korean), and `Source Han Sans SC` / `Noto Sans CJK SC` ship as single-face files.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const HAN: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/PingFang.ttc", 0),
|
||||
("/System/Library/Fonts/Supplemental/Songti.ttc", 0),
|
||||
("/System/Library/Fonts/STHeiti Light.ttc", 0),
|
||||
("C:\\Windows\\Fonts\\msyh.ttc", 0),
|
||||
("C:\\Windows\\Fonts\\msyh.ttf", 0),
|
||||
("C:\\Windows\\Fonts\\simhei.ttf", 0),
|
||||
("/usr/share/fonts/opentype/source-han-cjk/SourceHanSansSC-Regular.otf", 0),
|
||||
("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc", 2),
|
||||
("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", 2),
|
||||
("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc", 2),
|
||||
("/usr/share/fonts/opentype/noto/NotoSansCJKsc-Regular.otf", 0),
|
||||
("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc", 0),
|
||||
("/usr/share/fonts/wqy-microhei/wqy-microhei.ttc", 0),
|
||||
("/usr/share/fonts/truetype/arphic/uming.ttc", 0),
|
||||
];
|
||||
/// Font files larger than this are skipped: egui keeps the whole file in memory.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const MAX_FONT_BYTES: u64 = 64 << 20;
|
||||
/// The Han-capable TrueType font bundled for the web build only: egui's default fonts carry no Han
|
||||
/// glyphs and a browser cannot reach the operating system's fonts, so a Chinese interface would
|
||||
/// draw boxes. It is a Noto Sans SC (OFL-1.1) subset at weight 400 covering a superset of the UI
|
||||
/// glyph set; regenerate it with `docs/i18n/tools/subset_web_font.py`. See `assets/fonts/OFL.txt`
|
||||
/// and `ATTRIBUTION.md`. Native builds never embed it: the include is compiled out of them
|
||||
/// (`test` keeps it available to the glyph-coverage tests).
|
||||
#[cfg(any(target_arch = "wasm32", test))]
|
||||
const BUNDLED_HAN: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/fonts/NotoSansSC-SoundCraftSubset.ttf"));
|
||||
|
||||
/// Asks fontconfig for the desktop's font matching `pattern`. Only TrueType/OpenType results are
|
||||
/// used: egui cannot read Type 1 or bitmap fonts, which `fc-match` may return on minimal systems.
|
||||
@@ -103,34 +139,79 @@ fn load(cands: &[(&str, u32)], pattern: &str, lang: Option<&str>, system_fonts:
|
||||
None
|
||||
}
|
||||
|
||||
/// The web build has no operating-system fonts: the bundled subset is the CJK fallback.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn load(_: &[(&str, u32)], _: &str, _: Option<&str>, _: bool) -> Option<FontData> {
|
||||
None
|
||||
fn bundled_han() -> FontData {
|
||||
FontData::from_static(BUNDLED_HAN)
|
||||
}
|
||||
|
||||
/// The font set: the bundled faces, plus the system ones when `system_fonts` is true.
|
||||
/// Appends `name` as the lowest-priority fallback of every family. Only appends, so the order the
|
||||
/// faces are added in is the order glyphs are looked up in.
|
||||
fn add_fallback(fonts: &mut FontDefinitions, name: &'static str, font: FontData) {
|
||||
fonts.font_data.insert(name.into(), Arc::new(font));
|
||||
for family in fonts.families.values_mut() {
|
||||
family.push(name.into());
|
||||
}
|
||||
}
|
||||
|
||||
/// Should a Chinese-shaped Han face claim the Han glyphs before the Korean face? The first face
|
||||
/// with a glyph wins, so a Chinese interface must come first (on Linux fontconfig often resolves
|
||||
/// Noto Sans CJK's Korean face, whose Han glyphs are Korean-styled). Every interface language
|
||||
/// except Korean orders Han first; Korean reverses the two, so Hangul and Hanja draw from the
|
||||
/// Korean face. A future `zh-Hant` (Traditional Chinese) or `ja` (Japanese) is expected to keep
|
||||
/// Han first as well; only a language-suitable Han face would change (the [`HAN`] list is
|
||||
/// Simplified-first today).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn han_before_hangul(language: &str) -> bool {
|
||||
language.split(['-', '_']).next() != Some("ko")
|
||||
}
|
||||
|
||||
/// The font set: egui's bundled defaults, the operating system's faces where present and when
|
||||
/// `system_fonts` is true, and (web only) the bundled Han face as the last fallback of every
|
||||
/// family. The interface language decides the order of the two CJK fallbacks.
|
||||
pub fn definitions(system_fonts: bool) -> FontDefinitions {
|
||||
let mut fonts = FontDefinitions::default();
|
||||
let base: Vec<String> = fonts.families.get(&FontFamily::Proportional).cloned().unwrap_or_default();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let mut bold_family = base.clone();
|
||||
if let Some(reg) = load(REGULAR, "sans-serif", None, system_fonts) {
|
||||
fonts.font_data.insert("system-regular".into(), Arc::new(reg));
|
||||
if let Some(f) = fonts.families.get_mut(&FontFamily::Proportional) {
|
||||
f.insert(0, "system-regular".into());
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
if let Some(reg) = load(REGULAR, "sans-serif", None, system_fonts) {
|
||||
fonts.font_data.insert("system-regular".into(), Arc::new(reg));
|
||||
if let Some(f) = fonts.families.get_mut(&FontFamily::Proportional) {
|
||||
f.insert(0, "system-regular".into());
|
||||
}
|
||||
}
|
||||
if let Some(b) = load(BOLD, "sans-serif:style=Bold", None, system_fonts) {
|
||||
fonts.font_data.insert("system-bold".into(), Arc::new(b));
|
||||
bold_family.insert(0, "system-bold".into());
|
||||
} else if fonts.font_data.contains_key("system-regular") {
|
||||
bold_family.insert(0, "system-regular".into());
|
||||
}
|
||||
fonts.families.insert(FontFamily::Name("bold".into()), bold_family);
|
||||
// The first face with a glyph wins, so the interface language decides whether a Han or a
|
||||
// Korean face claims the Han glyphs a Chinese interface draws (see `han_before_hangul`).
|
||||
let language = crate::localization::current_language().id();
|
||||
let hangul = load(HANGUL, "sans-serif:lang=ko", Some("ko"), system_fonts);
|
||||
let han = load(HAN, "sans-serif:lang=zh-cn", Some("zh-cn"), system_fonts);
|
||||
let ordered = if han_before_hangul(language) {
|
||||
[("system-han", han), ("system-hangul", hangul)]
|
||||
} else {
|
||||
[("system-hangul", hangul), ("system-han", han)]
|
||||
};
|
||||
for (name, font) in ordered {
|
||||
if let Some(font) = font {
|
||||
add_fallback(&mut fonts, name, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(b) = load(BOLD, "sans-serif:style=Bold", None, system_fonts) {
|
||||
fonts.font_data.insert("system-bold".into(), Arc::new(b));
|
||||
bold_family.insert(0, "system-bold".into());
|
||||
} else if fonts.font_data.contains_key("system-regular") {
|
||||
bold_family.insert(0, "system-regular".into());
|
||||
}
|
||||
fonts.families.insert(FontFamily::Name("bold".into()), bold_family);
|
||||
if let Some(h) = load(HANGUL, "sans-serif:lang=ko", Some("ko"), system_fonts) {
|
||||
fonts.font_data.insert("system-hangul".into(), Arc::new(h));
|
||||
for family in fonts.families.values_mut() {
|
||||
family.push("system-hangul".into());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
// No system fonts in the browser: the bundled Han face keeps a Chinese interface, and
|
||||
// Chinese session, track and clip names, readable instead of drawing boxes.
|
||||
let _ = system_fonts;
|
||||
fonts.families.insert(FontFamily::Name("bold".into()), base);
|
||||
add_fallback(&mut fonts, "web-han", bundled_han());
|
||||
}
|
||||
fonts
|
||||
}
|
||||
@@ -226,4 +307,99 @@ mod tests {
|
||||
assert!(ctx.fonts_mut(|f| f.has_glyphs(&font, "가한국어세션")), "{family:?} has no Hangul");
|
||||
}
|
||||
}
|
||||
|
||||
/// The interface language orders the two CJK fallbacks: a Chinese interface draws Han glyphs
|
||||
/// from the Han face first, Korean draws them from the Korean face.
|
||||
#[test]
|
||||
fn cjk_fallback_order_follows_the_interface_language() {
|
||||
assert!(han_before_hangul("zh-Hans"));
|
||||
assert!(han_before_hangul("en"));
|
||||
// A future Traditional Chinese or Japanese catalog keeps Han first; only the Han face
|
||||
// itself would become Traditional Chinese or Japanese.
|
||||
assert!(han_before_hangul("zh-Hant"));
|
||||
assert!(han_before_hangul("ja"));
|
||||
assert!(!han_before_hangul("ko"));
|
||||
assert!(!han_before_hangul("ko-kr"));
|
||||
}
|
||||
|
||||
/// Chinese names draw in every family, not as boxes; skipped when the system has no Han font.
|
||||
#[test]
|
||||
fn every_family_draws_han_with_a_system_han_font() {
|
||||
let defs = definitions(true);
|
||||
if !defs.font_data.contains_key("system-han") {
|
||||
eprintln!("skipping: no Han system font");
|
||||
return;
|
||||
}
|
||||
let families: Vec<FontFamily> = defs.families.keys().cloned().collect();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.set_fonts(defs);
|
||||
let mut output = ctx.run_ui(egui::RawInput::default(), |_| {});
|
||||
output.textures_delta.clear();
|
||||
for family in families {
|
||||
let font = egui::FontId::new(13.0, family.clone());
|
||||
assert!(ctx.fonts_mut(|f| f.has_glyphs(&font, "轨道片段混音")), "{family:?} has no Han");
|
||||
}
|
||||
}
|
||||
|
||||
/// Under a Chinese interface every family that resolved both faces puts Han before Hangul, so
|
||||
/// Chinese text never draws in Korean-styled shapes.
|
||||
#[test]
|
||||
fn chinese_interface_puts_han_before_hangul_in_every_family() {
|
||||
let _language = crate::localization::enter(crate::localization::Language::SimplifiedChinese);
|
||||
let defs = definitions(true);
|
||||
let mut compared = 0;
|
||||
for (family, family_fonts) in &defs.families {
|
||||
let han = family_fonts.iter().position(|font| font == "system-han");
|
||||
let hangul = family_fonts.iter().position(|font| font == "system-hangul");
|
||||
if let (Some(han), Some(hangul)) = (han, hangul) {
|
||||
assert!(han < hangul, "{family:?} puts Hangul before Han: {family_fonts:?}");
|
||||
compared += 1;
|
||||
}
|
||||
}
|
||||
if compared == 0 {
|
||||
eprintln!("skipping: no system Han and Hangul fonts resolved");
|
||||
}
|
||||
}
|
||||
|
||||
/// The web fallback chain (egui defaults + the bundled face) draws the entire zh-Hans catalog in
|
||||
/// every family: the property that keeps the browser build free of boxes.
|
||||
#[test]
|
||||
fn bundled_web_font_draws_the_zh_hans_catalog_in_every_family() {
|
||||
let Some(catalog) = zh_hans_catalog() else { return };
|
||||
let mut defs = definitions(false);
|
||||
add_fallback(&mut defs, "web-han", FontData::from_static(BUNDLED_HAN));
|
||||
let mut sample: Vec<char> = catalog.chars().filter(|c| !['\t', '\r', '\n'].contains(c)).collect();
|
||||
sample.sort_unstable();
|
||||
sample.dedup();
|
||||
let sample: String = sample.into_iter().collect();
|
||||
let families: Vec<FontFamily> = defs.families.keys().cloned().collect();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.set_fonts(defs);
|
||||
let mut output = ctx.run_ui(egui::RawInput::default(), |_| {});
|
||||
output.textures_delta.clear();
|
||||
for family in families {
|
||||
let font = egui::FontId::new(13.0, family.clone());
|
||||
let missing: Vec<char> = sample.chars().filter(|c| !ctx.fonts_mut(|fonts| fonts.has_glyphs(&font, &c.to_string()))).collect();
|
||||
assert!(missing.is_empty(), "{family:?} cannot draw {missing:?} of the zh-Hans catalog even with the bundled web font");
|
||||
}
|
||||
}
|
||||
|
||||
/// The asset must not silently grow into a full CJK font, which would bloat the web download.
|
||||
#[test]
|
||||
fn bundled_web_font_stays_within_its_size_budget() {
|
||||
const BUDGET: usize = 2 << 20; // 2 MiB
|
||||
assert!(BUNDLED_HAN.len() <= BUDGET, "the bundled web font is {} bytes; its budget is {BUDGET}", BUNDLED_HAN.len());
|
||||
}
|
||||
|
||||
/// The source of the zh-Hans catalog, or `None` (skip) when it is not checked out.
|
||||
fn zh_hans_catalog() -> Option<String> {
|
||||
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/src/i18n/zh-hans.tsv");
|
||||
match std::fs::read_to_string(path) {
|
||||
Ok(catalog) => Some(catalog),
|
||||
Err(err) => {
|
||||
eprintln!("skipping: cannot read {path}: {err}");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
SoundCraft UI translations — license and provenance
|
||||
====================================================
|
||||
|
||||
`crates/ui-egui/src/i18n/zh-hans.tsv` holds SoundCraft's own Simplified Chinese translation of the
|
||||
English source strings in the code. `crates/ui-egui/locales/zh-Hans/mod.rs` is generated from it by
|
||||
`docs/i18n/tools/gen_zh_hans_locale.py`; edit the TSV, never the module.
|
||||
|
||||
License: MIT OR Apache-2.0, the same terms as the SoundCraft code (see LICENSE-MIT and
|
||||
LICENSE-APACHE in the repository root). The translations are bundled only in the SoundCraft UI; the
|
||||
English source strings in the code remain the canonical text.
|
||||
|
||||
Provenance: the rows are original wording written for SoundCraft. No translated string, glossary or
|
||||
translation memory from another product was copied. Wording decisions and their reasoning are
|
||||
recorded in `docs/i18n/glossary.md`, so a reviewer can challenge a term without leaving the
|
||||
repository.
|
||||
|
||||
Review status: AI-authored, not yet read by a native-speaking audio engineer.
|
||||
|
||||
Rules when editing: keep the format documented at the top of the TSV, keep every `{name}` and `{}`
|
||||
placeholder (and its format spec) exactly, keep a trailing `…` in menu items, and run
|
||||
`python3 docs/i18n/tools/gen_zh_hans_locale.py` followed by
|
||||
`cargo test -p soundcraft-ui-egui --lib`.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@ mod es;
|
||||
mod fr;
|
||||
#[path = "../locales/pt-BR/mod.rs"]
|
||||
mod pt_br;
|
||||
#[path = "../locales/zh-Hans/mod.rs"]
|
||||
mod zh_hans;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
@@ -25,11 +27,13 @@ pub enum Language {
|
||||
French,
|
||||
#[serde(rename = "es")]
|
||||
Spanish,
|
||||
#[serde(rename = "zh-Hans")]
|
||||
SimplifiedChinese,
|
||||
}
|
||||
|
||||
impl Language {
|
||||
/// All supported languages, in the order they are shown in the language menu.
|
||||
pub const ALL: [Self; 4] = [Self::English, Self::PortugueseBrazil, Self::French, Self::Spanish];
|
||||
pub const ALL: [Self; 5] = [Self::English, Self::PortugueseBrazil, Self::French, Self::Spanish, Self::SimplifiedChinese];
|
||||
|
||||
/// Stable language tag used in preferences and control commands.
|
||||
pub const fn id(self) -> &'static str {
|
||||
@@ -38,6 +42,7 @@ impl Language {
|
||||
Self::PortugueseBrazil => "pt-BR",
|
||||
Self::French => "fr",
|
||||
Self::Spanish => "es",
|
||||
Self::SimplifiedChinese => "zh-Hans",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +53,7 @@ impl Language {
|
||||
Self::PortugueseBrazil => "Portuguese (Brazil)",
|
||||
Self::French => "French",
|
||||
Self::Spanish => "Spanish",
|
||||
Self::SimplifiedChinese => "Simplified Chinese",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +66,7 @@ impl Language {
|
||||
match self {
|
||||
Self::English => number.to_owned(),
|
||||
Self::PortugueseBrazil | Self::French | Self::Spanish => number.replace('.', ","),
|
||||
Self::SimplifiedChinese => number.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +77,7 @@ impl Language {
|
||||
Self::PortugueseBrazil => pt_br::translate(source).unwrap_or(source),
|
||||
Self::French => fr::translate(source).unwrap_or(source),
|
||||
Self::Spanish => es::translate(source).unwrap_or(source),
|
||||
Self::SimplifiedChinese => zh_hans::translate(source).unwrap_or(source),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,6 +113,7 @@ fn error_text_in(language: Language, message: &str, depth: usize) -> String {
|
||||
Language::PortugueseBrazil => pt_br::ERROR_TEMPLATES,
|
||||
Language::French => fr::ERROR_TEMPLATES,
|
||||
Language::Spanish => es::ERROR_TEMPLATES,
|
||||
Language::SimplifiedChinese => zh_hans::ERROR_TEMPLATES,
|
||||
};
|
||||
let mut best: Option<(usize, &str, Vec<(String, String)>)> = None;
|
||||
for (template, translation) in templates {
|
||||
@@ -372,12 +381,14 @@ mod tests {
|
||||
assert_eq!(Language::parse(" PT-br "), Some(Language::PortugueseBrazil));
|
||||
assert_eq!(Language::parse(" FR "), Some(Language::French));
|
||||
assert_eq!(Language::parse("de"), None);
|
||||
assert_eq!(Language::parse(" ZH-hans "), Some(Language::SimplifiedChinese));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn language_translations_fall_back_to_the_english_source() {
|
||||
assert_ne!(Language::PortugueseBrazil.text("Appearance"), "Appearance");
|
||||
assert_eq!(Language::PortugueseBrazil.text("A source string with no catalog entry"), "A source string with no catalog entry");
|
||||
assert_ne!(Language::SimplifiedChinese.text("Appearance"), "Appearance");
|
||||
assert_eq!(Language::English.text("Appearance"), "Appearance");
|
||||
for language in [Language::French, Language::Spanish] {
|
||||
assert_ne!(language.text("Appearance"), "Appearance", "{language:?}");
|
||||
@@ -385,6 +396,25 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simplified_chinese_translates_the_language_menu() {
|
||||
// `Language::native_name` is English source text; the menu draws it through the catalog, so
|
||||
// a Chinese interface must name every language it offers in Chinese.
|
||||
for language in Language::ALL {
|
||||
assert_ne!(Language::SimplifiedChinese.text(language.native_name()), language.native_name(), "{language:?}");
|
||||
}
|
||||
assert_eq!(Language::SimplifiedChinese.text("Simplified Chinese"), "简体中文");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simplified_chinese_catalog_covers_every_menu_label() {
|
||||
for path in include_str!("../../engine/catalog/menus.txt").lines() {
|
||||
for label in path.split(" > ").map(str::trim).filter(|label| !label.is_empty()) {
|
||||
assert!(super::zh_hans::translate(label).is_some(), "missing zh-Hans menu label: {label}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn language_scope_restores_the_previous_language() {
|
||||
assert_eq!(text("Appearance"), "Appearance");
|
||||
@@ -564,21 +594,22 @@ mod tests {
|
||||
assert_eq!(pt.text("Strip"), "Canal", "the Channel Strip plug-in's short name keeps its own key");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_localized_source_string_has_a_catalog_entry() {
|
||||
fn visit(dir: &std::path::Path, missing: &mut Vec<String>) {
|
||||
/// Every string passed to `text` / `localized_format!` in this crate must have an entry in
|
||||
/// `catalog`; `locale` names it in the failure.
|
||||
fn assert_catalog_covers_the_source(catalog: fn(&str) -> Option<&'static str>, locale: &str) {
|
||||
fn visit(dir: &std::path::Path, missing: &mut Vec<String>, catalog: fn(&str) -> Option<&'static str>) {
|
||||
let Ok(read) = std::fs::read_dir(dir) else { return };
|
||||
for entry in read.flatten() {
|
||||
let path = entry.path();
|
||||
if path.is_dir() {
|
||||
visit(&path, missing);
|
||||
visit(&path, missing, catalog);
|
||||
} else if path.extension().is_some_and(|e| e == "rs") && !path.ends_with("localization.rs") {
|
||||
let Ok(text) = std::fs::read_to_string(&path) else { continue };
|
||||
for marker in ["localization::text(\"", "localized_format!(\""] {
|
||||
for (at, _) in text.match_indices(marker) {
|
||||
let start = at + marker.len() - 1;
|
||||
if let Some((source, _)) = literal(&text[start..])
|
||||
&& super::pt_br::translate(&source).is_none()
|
||||
&& catalog(&source).is_none()
|
||||
{
|
||||
missing.push(format!("{}: {source:?}", path.display()));
|
||||
}
|
||||
@@ -588,7 +619,17 @@ mod tests {
|
||||
}
|
||||
}
|
||||
let mut missing = Vec::new();
|
||||
visit(&std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src"), &mut missing);
|
||||
assert!(missing.is_empty(), "strings without a pt-BR entry:\n{}", missing.join("\n"));
|
||||
visit(&std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src"), &mut missing, catalog);
|
||||
assert!(missing.is_empty(), "strings without a {locale} entry:\n{}", missing.join("\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_localized_source_string_has_a_catalog_entry() {
|
||||
assert_catalog_covers_the_source(super::pt_br::translate, "pt-BR");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_localized_source_string_has_a_zh_hans_entry() {
|
||||
assert_catalog_covers_the_source(super::zh_hans::translate, "zh-Hans");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,6 +594,8 @@ mod tests {
|
||||
assert!(app.run("ui.language", json!({"language": "xx"})).is_err());
|
||||
assert_eq!(app.ui.language, crate::localization::Language::PortugueseBrazil);
|
||||
assert!(crate::menus::UI_COMMANDS.iter().any(|command| command.0 == "ui.language"));
|
||||
assert_eq!(app.run("ui.language", json!({"language": "zh-Hans"})), Ok(json!({"language": "zh-Hans"})));
|
||||
assert_eq!(app.ui.language, crate::localization::Language::SimplifiedChinese);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+13
-11
@@ -1,6 +1,6 @@
|
||||
# Where SoundCraft falls short of Pro Tools
|
||||
|
||||
> **Last reviewed:** 2026-11-14 · **Last updated:** 2026-11-28 · **Change:** minor (G-05: the signed macOS app and CLI carry the plugin-loading entitlements; previously minor: G-01: the Playback Engine shows the current device choice after a command changes it, and a buffer size the driver does not take is reported; previously trivial: G-04: Number of Loops accepts up to 1,000; crossfade remains open; previously minor: G-06: recording to disk is done (#84, long takes #888); streaming sources remain; previously minor: G-02 shrunk: MIDI input devices work; G-03: strict external-WAV AAF import; previously minor: G-05: plugin editors on Linux/X11; previously trivial: G-09: the pt-BR catalog now covers helper-passed tooltips, the status bar, the remove-session prompt and engine error text; G-08: Frequency Shifter, 28 processors; G-04: volume automation read at every sample, #1354; G-01: `setup.playback_engine` applies the device buffer in the desktop app; G-04: Clip Looping crossfade and loop count) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
> **Last reviewed:** 2026-11-14 · **Last updated:** 2026-11-28 · **Change:** minor (G-09: the zh-Hans catalog now covers the fixed UI strings, with a Han fallback and a web subset; previously minor: G-05: the signed macOS app and CLI carry the plugin-loading entitlements; previously minor: G-01: the Playback Engine shows the current device choice after a command changes it, and a buffer size the driver does not take is reported; previously trivial: G-04: Number of Loops accepts up to 1,000; crossfade remains open; previously minor: G-06: recording to disk is done (#84, long takes #888); streaming sources remain; previously minor: G-02 shrunk: MIDI input devices work; G-03: strict external-WAV AAF import; previously minor: G-05: plugin editors on Linux/X11; previously trivial: G-09: the pt-BR catalog now covers helper-passed tooltips, the status bar, the remove-session prompt and engine error text; G-08: Frequency Shifter, 28 processors; G-04: volume automation read at every sample, #1354; G-01: `setup.playback_engine` applies the device buffer in the desktop app; G-04: Clip Looping crossfade and loop count) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
|
||||
Every known shortfall, one entry each, ranked by how much it stops a Pro Tools user from doing
|
||||
real work in SoundCraft. This is the work list: pick from the top. Rows marked **alpha blocker**
|
||||
@@ -23,7 +23,7 @@ When you close a gap, delete its entry (or shrink it) in the same PR, and bump t
|
||||
| G-06 | Sources decoded whole into RAM (recording to disk is done: #84, #888) | Performance | [hardware-parity.md](hardware-parity.md) | 15–25 |
|
||||
| G-07 | Nothing is compared against Pro Tools' output (no fidelity harness) | Features | this file | 20–30 |
|
||||
| G-08 | Built-in plugin catalogue thin and unverified | Features | [plugin-parity.md](plugin-parity.md) | 80–120 |
|
||||
| G-09 | English-first UI with a pt-BR catalog (not native-reviewed); all fixed UI strings covered, no CJK/RTL rendering | Localization | [localization-parity.md](localization-parity.md) | 20–40 |
|
||||
| G-09 | English-first UI with pt-BR and zh-Hans catalogs (neither native-reviewed); all fixed UI strings covered, CJK fallback ships, no other Pro Tools languages and no RTL/complex-script shaping | Localization | [localization-parity.md](localization-parity.md) | 55–90 |
|
||||
| G-10 | No control surfaces (HUI/MCU, EUCON) | Hardware | [hardware-parity.md](hardware-parity.md) | 40–70 |
|
||||
| G-11 | No external sync (MTC, LTC, MIDI clock, video reference) | Hardware | [hardware-parity.md](hardware-parity.md) | 15–25 |
|
||||
| G-12 | Immersive delivery: no Dolby Atmos/ADM BWF, MPEG-H, binaural | Features | [file-format-parity.md](file-format-parity.md) | 50–80 |
|
||||
@@ -185,15 +185,17 @@ parametric request #139. ≈ 80–120 h.
|
||||
|
||||
### G-09. Localization
|
||||
|
||||
See [`localization-parity.md`](localization-parity.md): a pt-BR catalog covers the menu labels and
|
||||
every fixed UI string passed to `text` / `localized_format!` or localized inside a button, toggle or
|
||||
close button (test-checked), including the Edit-window status bar, the remove-session question and
|
||||
the send help text; engine errors are matched against catalog templates at display time by
|
||||
`error_text`. What remains is independent native-speaker review plus egui's lack of complex-script
|
||||
shaping and RTL, and the missing other Pro Tools languages; values built at run time (file, track
|
||||
and device names) and engine command parameter documentation stay untranslated. egui has no
|
||||
complex-script shaping or RTL; no CJK font fallback (PR #141 open). ≈ 70–110 h plus
|
||||
native-speaker review.
|
||||
See [`localization-parity.md`](localization-parity.md): pt-BR and zh-Hans catalogs cover the menu
|
||||
labels and every fixed UI string passed to `text` / `localized_format!` or localized inside a button,
|
||||
toggle or close button (test-checked), including the Edit-window status bar, the remove-session
|
||||
question and the send help text; pt-BR also matches engine errors against catalog templates through
|
||||
`error_text`, while zh-Hans keeps diagnostics English. Chinese has a Han font fallback on the desktop
|
||||
(a system face, never redistributed) and an OFL subset in the web build, ordered ahead of the Hangul
|
||||
fallback except under a Korean interface. What remains is independent native-speaker review of both
|
||||
catalogs, the other Pro Tools languages (Spanish, French, German, Japanese, Korean, Traditional
|
||||
Chinese, Hindi/Arabic for the non-target languages), and egui's lack of complex-script shaping and
|
||||
RTL; values built at run time (file, track and device names) and engine command parameter
|
||||
documentation stay untranslated. ≈ 55–90 h plus native-speaker review.
|
||||
|
||||
### G-10. Control surfaces
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# i18n tools and notes
|
||||
|
||||
Working files for SoundCraft's own catalog (`zh-Hans`). The runtime mechanism and the language list
|
||||
are described in [`../localization.md`](../localization.md); the translator workflow in
|
||||
[`../localization-zh-hans.md`](../localization-zh-hans.md); wording decisions in
|
||||
[`glossary.md`](glossary.md).
|
||||
|
||||
| Path | What |
|
||||
|---|---|
|
||||
| `tools/gen_zh_hans_locale.py` | turns `crates/ui-egui/src/i18n/zh-hans.tsv` into `crates/ui-egui/locales/zh-Hans/mod.rs`; `--check` is the CI/`xtask`-style staleness gate |
|
||||
| `tools/subset_web_font.py` | rebuilds `assets/fonts/NotoSansSC-SoundCraftSubset.ttf` from the catalog's glyph set and the pinned Noto Sans SC source |
|
||||
|
||||
## Why the catalog lives here
|
||||
|
||||
The org keeps shared translations in `storytold/craft-i18n`, read through an optional
|
||||
`CRAFT_I18N_DIR` build input. SoundCraft has not cut over (roadmap stage 3d), so — like the pt-BR
|
||||
catalog — this one ships in the repository, and the TSV is the pre-cutover file that
|
||||
`craft-i18n`'s `tools/sync_app.py` consumes when the app does migrate. Nothing here depends on the
|
||||
other repository being present.
|
||||
|
||||
## Clean room, restated
|
||||
|
||||
Write every row from the plain meaning of the English source. Do not read, copy or "check against"
|
||||
another product's translated interface or translation files, and do not download copyleft or
|
||||
proprietary string tables for reference. If a term needs a decision, write the reasoning in
|
||||
[`glossary.md`](glossary.md) instead of citing a source we must not use.
|
||||
|
||||
The translations are original work by SoundCraft contributors (AI-assisted), licensed like the rest
|
||||
of the repository (MIT OR Apache-2.0); see `crates/ui-egui/src/i18n/LICENSE-translations.txt`.
|
||||
@@ -0,0 +1,69 @@
|
||||
# i18n glossary
|
||||
|
||||
The decisions behind SoundCraft's Simplified Chinese wording. The strings themselves live in
|
||||
`crates/ui-egui/src/i18n/zh-hans.tsv`; the mechanism is in
|
||||
[`../localization.md`](../localization.md) and the translator workflow in
|
||||
[`../localization-zh-hans.md`](../localization-zh-hans.md).
|
||||
|
||||
**Clean room.** Every entry is written from the plain meaning of the English source text. Do not
|
||||
consult another product's translation files, string tables or localized interface — not proprietary
|
||||
ones and not copyleft ones. Where a term is hard, argue it here with the reasoning, not with a
|
||||
source we are not allowed to read.
|
||||
|
||||
## 1. Terms we keep
|
||||
|
||||
| English | Ours | Why |
|
||||
|---|---|---|
|
||||
| Session | 会话 | the ordinary word for a DAW project in Chinese; 工程 reads as engineering |
|
||||
| Track | 轨道 | covers audio and MIDI tracks; 音轨 reads as audio-only |
|
||||
| Clip | 片段 | a piece of audio or MIDI on the timeline |
|
||||
| Region | 区域 | kept distinct from clip |
|
||||
| Bus | 总线 | signal-routing bus |
|
||||
| Solo / Mute | 独奏 / 静音 | |
|
||||
| Automation | 自动化 | |
|
||||
| Export / Import | 导出 / 导入 | |
|
||||
| Snap to Grid | 吸附到网格 | |
|
||||
| Normalize | 标准化 | not 归一化, which is the loudness-community word |
|
||||
| Sample rate | 采样率 | |
|
||||
| Mono / Stereo | 单声道 / 立体声 | |
|
||||
| Quantize | 量化 | |
|
||||
| Undo / Redo | 撤销 / 重做 | 撤销 (not 撤消) is the standard spelling |
|
||||
| Preferences | 首选项 | the majority DAW wording in Chinese |
|
||||
| Meter (level) | 电平表 | the level meter |
|
||||
| Meter (time signature) | 拍号 | same English word, different sense: the catalog carries both |
|
||||
| Tempo | 速度 | |
|
||||
| Velocity | 力度 | MIDI note velocity |
|
||||
| Pan | 声像 | the 规范 acoustics term (sound image) |
|
||||
|
||||
## 2. Deliberate choices that differ from the obvious translation
|
||||
|
||||
| English | Ours | Why |
|
||||
|---|---|---|
|
||||
| Transport | 走带 | the standard Chinese audio-engineering word for the transport section |
|
||||
| Bypass | 旁通 | the community word for bypassing a plug-in |
|
||||
| Record / Record Enable | 录音 / 启用录音 | the action, not the medium |
|
||||
| Latch / Touch (automation) | 锁存 / 触碰 | |
|
||||
| Start / End (clip boundary) | 开头 / 结尾 | positions keep 起点 / 终点 |
|
||||
| Key (signature) | 调号 | musical sense |
|
||||
| Trim (edit) / Trim (automation) | 修剪 / 微调 | two senses, kept apart |
|
||||
| Slip / Spot | 滑动 / 定位 | |
|
||||
| Bounce | 导出 | Bounce Mix = 导出混音 |
|
||||
| Big Counter | 大计数器 | the transport readout |
|
||||
|
||||
## 3. Shape of a translated string
|
||||
|
||||
- Chinese punctuation: use full-width `:`、`,`、`(`、`)`、`。`、`?` inside sentences; keep ASCII
|
||||
`·`、`·`、`—`、`/` and the `>` `›` path separators as they are.
|
||||
- Keep a leading space when the English has one: such fragments are appended to a label at run time
|
||||
(`" It is used by {users}"`).
|
||||
- Preserve every `{placeholder}`, including format specs (`{ms:.1}`, `{seconds:.2}`) and positional
|
||||
`{}`; a test compares placeholder sets.
|
||||
- Keep trailing `…` in menu items (`首选项…`), and keep UI symbols (`+`, `−`, `−∞`, `⬆`) as they are.
|
||||
- No spaces around Chinese text; one space between Chinese and Latin words is fine where it helps
|
||||
(`24 位`, `MIDI 轨道`).
|
||||
|
||||
## 4. Review status
|
||||
|
||||
The catalog is AI-authored from the English source and has not been reviewed by a native-speaking
|
||||
audio engineer. Treat wording as provisional until it is; changes go in the TSV, and the module is
|
||||
regenerated.
|
||||
@@ -0,0 +1,139 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate `crates/ui-egui/locales/zh-Hans/mod.rs` from the translator-facing TSV.
|
||||
|
||||
The TSV (`crates/ui-egui/src/i18n/zh-hans.tsv`) is the source translators edit: one row per
|
||||
string, `context<TAB>English source<TAB>Simplified Chinese`. The UI reads the Rust module, because
|
||||
that is how every locale in this repository ships (see `locales/pt-BR/mod.rs`); this script is the
|
||||
only thing that turns one into the other, so the two never drift.
|
||||
|
||||
Usage (from the repository root):
|
||||
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py # write the module
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py --check # fail if it is out of date
|
||||
|
||||
`@plural` rows carry `singular|plural` in the source column, because English inflects where
|
||||
Simplified Chinese does not; both English keys map to the same Chinese row. The columns use the
|
||||
catalog's escapes (`\n`, `\t`, `\\`), which this script decodes before writing the Rust literal.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
TSV = ROOT / "crates/ui-egui/src/i18n/zh-hans.tsv"
|
||||
OUT = ROOT / "crates/ui-egui/locales/zh-Hans/mod.rs"
|
||||
|
||||
HEADER = """\
|
||||
//! Simplified Chinese (`zh-Hans`) catalog, keyed by the English source string.
|
||||
//!
|
||||
//! Generated by `docs/i18n/tools/gen_zh_hans_locale.py` from
|
||||
//! `crates/ui-egui/src/i18n/zh-hans.tsv`; edit the TSV, then rerun the script. Engine diagnostics
|
||||
//! stay English by design, so this catalog has no error templates.
|
||||
|
||||
/// Returns the Simplified Chinese translation for a source-language UI string.
|
||||
#[rustfmt::skip]
|
||||
pub(super) fn translate(source: &str) -> Option<&'static str> {
|
||||
Some(match source {
|
||||
"""
|
||||
|
||||
FOOTER = """\
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Engine error messages with `{name}` placeholders standing for the values they embed. Simplified
|
||||
/// Chinese keeps engine diagnostics in English by design (see `docs/localization-zh-hans.md`).
|
||||
pub(super) const ERROR_TEMPLATES: &[(&str, &str)] = &[];
|
||||
"""
|
||||
|
||||
|
||||
def unescape(text: str) -> str:
|
||||
"""Decode the catalog's `\\n`, `\\t` and `\\\\` escapes (the TSV is one row per string)."""
|
||||
out = []
|
||||
index = 0
|
||||
while index < len(text):
|
||||
ch = text[index]
|
||||
if ch == "\\" and index + 1 < len(text):
|
||||
nxt = text[index + 1]
|
||||
if nxt == "n":
|
||||
out.append("\n")
|
||||
elif nxt == "t":
|
||||
out.append("\t")
|
||||
elif nxt == "\\":
|
||||
out.append("\\")
|
||||
else:
|
||||
out.append(ch)
|
||||
out.append(nxt)
|
||||
index += 2
|
||||
continue
|
||||
out.append(ch)
|
||||
index += 1
|
||||
return "".join(out)
|
||||
|
||||
|
||||
def rust_literal(text: str) -> str:
|
||||
"""A Rust string literal for `text`; the catalogs contain quotes, braces and newlines."""
|
||||
out = []
|
||||
for ch in text:
|
||||
if ch == "\\":
|
||||
out.append("\\\\")
|
||||
elif ch == '"':
|
||||
out.append('\\"')
|
||||
elif ch == "\n":
|
||||
out.append("\\n")
|
||||
elif ch == "\t":
|
||||
out.append("\\t")
|
||||
elif ch == "\r":
|
||||
out.append("\\r")
|
||||
elif ord(ch) < 0x20:
|
||||
out.append(f"\\u{{{ord(ch):x}}}")
|
||||
else:
|
||||
out.append(ch)
|
||||
return '"' + "".join(out) + '"'
|
||||
|
||||
|
||||
def rows() -> dict[str, str]:
|
||||
"""Every English source string mapped to its Chinese translation."""
|
||||
pairs: dict[str, str] = {}
|
||||
for number, line in enumerate(TSV.read_text(encoding="utf-8").splitlines(), start=1):
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
columns = line.split("\t", 2)
|
||||
if len(columns) != 3:
|
||||
raise SystemExit(f"{TSV}:{number}: expected three tab-separated columns")
|
||||
context, source, translation = (unescape(column) for column in columns)
|
||||
if not source or not translation:
|
||||
raise SystemExit(f"{TSV}:{number}: empty source or translation")
|
||||
# A `@plural` row names both English forms; Chinese has one form for both.
|
||||
sources = source.split("|") if context.startswith("@") else [source]
|
||||
for key in sources:
|
||||
previous = pairs.get(key)
|
||||
if previous is not None and previous != translation:
|
||||
raise SystemExit(f"{TSV}:{number}: {key!r} translated twice, differently")
|
||||
pairs[key] = translation
|
||||
return pairs
|
||||
|
||||
|
||||
def render(pairs: dict[str, str]) -> str:
|
||||
arms = "".join(f" {rust_literal(source)} => {rust_literal(pairs[source])},\n" for source in sorted(pairs))
|
||||
return HEADER + arms + FOOTER
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
rendered = render(rows())
|
||||
if "--check" in argv:
|
||||
if not OUT.exists() or OUT.read_text(encoding="utf-8") != rendered:
|
||||
print(f"{OUT} is out of date; run python3 docs/i18n/tools/gen_zh_hans_locale.py", file=sys.stderr)
|
||||
return 1
|
||||
print(f"{OUT}: up to date")
|
||||
return 0
|
||||
OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
OUT.write_text(rendered, encoding="utf-8")
|
||||
print(f"wrote {OUT.relative_to(ROOT)} ({len(rows())} strings)")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
@@ -0,0 +1,162 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerate `assets/fonts/NotoSansSC-SoundCraftSubset.ttf`.
|
||||
|
||||
Usage (run from the repo root):
|
||||
python3 docs/i18n/tools/subset_web_font.py NotoSansSC-VariableFont_wght.ttf
|
||||
python3 docs/i18n/tools/subset_web_font.py --check
|
||||
|
||||
The web build has no operating-system fonts, so it bundles a small subset of
|
||||
Noto Sans SC (SIL OFL-1.1, see `assets/fonts/OFL.txt` and `ATTRIBUTION.md`),
|
||||
pinned at weight 400. The full variable font is a noto-cjk release:
|
||||
https://github.com/notofonts/noto-cjk (Sans/Variable/OTF or the "Subset"
|
||||
OTC — any file whose family is Noto Sans SC with a wght axis).
|
||||
|
||||
The codepoint set is a superset of the UI glyph set:
|
||||
|
||||
- printable ASCII (U+0020-007E) and Latin-1 (U+00A0-00FF);
|
||||
- the GB 2312 level-1 common Han characters (3,755, rows 16-55), so the
|
||||
catalog can grow new everyday words without touching this script;
|
||||
- every BMP, non-control character used in `crates/ui-egui/src/i18n/*.tsv`
|
||||
(sources, translations and comments — emoji outside the BMP come from
|
||||
egui's bundled emoji fonts, see `fonts.rs`);
|
||||
- `EXTRA_SYMBOLS` below: the punctuation, arrows and symbols the UI draws
|
||||
outside the catalogs (meters, transport, musical notation).
|
||||
|
||||
`--check` compares that set against the shipped subset and exits non-zero on
|
||||
any difference; the catalog-side guarantee (every catalog glyph present) is
|
||||
enforced by the `bundled_web_font_*` tests in `crates/ui-egui/src/fonts.rs`.
|
||||
|
||||
Requires fontTools (`pip install fonttools`). Steps: pin weight 400 with
|
||||
`fontTools.varLib.instancer`, then subset with `fontTools.subset`, keeping the
|
||||
name table (the OFL copyright notice rides along) and all layout features.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
REPO = Path(__file__).resolve().parents[3]
|
||||
CATALOG_DIR = REPO / "crates/ui-egui/src/i18n"
|
||||
SHIPPED = REPO / "assets/fonts/NotoSansSC-SoundCraftSubset.ttf"
|
||||
|
||||
# Punctuation, arrows and symbols the UI draws outside the catalogs. Comment
|
||||
# each addition; the `--check` run against the shipped font catches drift.
|
||||
EXTRA_SYMBOLS = (
|
||||
"ΔΣπ" # Greek letters used in math/technical readouts
|
||||
"–‘’′″›※" # dashes, quotes, primes and reference marks
|
||||
"←↑→↓↔⬆" # arrows (transport, nudge, navigation)
|
||||
"∈√∞≈≤≥" # math symbols
|
||||
"⌘" # command-key hint glyphs
|
||||
"─★" # box drawing and rating star
|
||||
"♩♯" # musical notation
|
||||
"〈〉《》「」『』【】〔〕" # CJK brackets
|
||||
"!¥" # fullwidth exclamation mark, yen sign
|
||||
)
|
||||
|
||||
|
||||
def collect_codepoints() -> set[int]:
|
||||
"""The full codepoint set the subset must carry."""
|
||||
points = set(range(0x20, 0x7F)) | set(range(0xA0, 0x100))
|
||||
# GB 2312 level-1 Han: rows 16-55, decoded straight from the encoding so
|
||||
# no external table is needed (row 55 stops at column 89).
|
||||
for row in range(16, 56):
|
||||
for col in range(1, 95):
|
||||
try:
|
||||
points.add(ord(bytes([0xA0 + row, 0xA0 + col]).decode("gb2312")))
|
||||
except UnicodeDecodeError:
|
||||
continue
|
||||
for path in sorted(CATALOG_DIR.glob("*.tsv")):
|
||||
for ch in path.read_text(encoding="utf-8"):
|
||||
cp = ord(ch)
|
||||
if cp <= 0xFFFF and not ch.isspace() and not unicodedata_category_cc(ch):
|
||||
points.add(cp)
|
||||
points |= {ord(ch) for ch in EXTRA_SYMBOLS}
|
||||
return points
|
||||
|
||||
|
||||
def unicodedata_category_cc(ch: str) -> bool:
|
||||
import unicodedata
|
||||
|
||||
return unicodedata.category(ch) == "Cc"
|
||||
|
||||
|
||||
def shipped_codepoints() -> set[int]:
|
||||
from fontTools.ttLib import TTFont
|
||||
|
||||
return set(TTFont(SHIPPED).getBestCmap())
|
||||
|
||||
|
||||
def check(points: set[int]) -> int:
|
||||
shipped = shipped_codepoints()
|
||||
missing = sorted(points - shipped)
|
||||
stale = sorted(shipped - points)
|
||||
for label, diff in (("missing from the shipped subset", missing), ("no longer needed", stale)):
|
||||
if diff:
|
||||
print(f"{label}: {len(diff)}")
|
||||
for cp in diff[:40]:
|
||||
print(f" U+{cp:04X} {chr(cp)}")
|
||||
if missing:
|
||||
print("regenerate: python3 docs/i18n/tools/subset_web_font.py <NotoSansSC variable font>")
|
||||
return 1
|
||||
if stale:
|
||||
print("the recipe and the shipped subset drifted — regenerate or update EXTRA_SYMBOLS")
|
||||
return 1
|
||||
print(f"ok: the shipped subset matches the recipe exactly ({len(points)} codepoints)")
|
||||
return 0
|
||||
|
||||
|
||||
def regenerate(font: Path, points: set[int], out: Path) -> int:
|
||||
from fontTools import subset
|
||||
from fontTools.varLib import instancer
|
||||
|
||||
font_path = font.resolve()
|
||||
out_path = out.resolve()
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
instanced = Path(tmp) / "NotoSansSC-400.ttf"
|
||||
instancer.main([str(font_path), "wght=400", "-o", str(instanced)])
|
||||
unicodes = ",".join(f"U+{cp:04X}" for cp in sorted(points))
|
||||
subset.main([
|
||||
str(instanced),
|
||||
f"--output-file={out_path}",
|
||||
f"--unicodes={unicodes}",
|
||||
"--layout-features=*",
|
||||
"--glyph-names",
|
||||
"--name-IDs=*",
|
||||
"--name-legacy",
|
||||
"--name-languages=*",
|
||||
"--notdef-glyph",
|
||||
"--notdef-outline",
|
||||
"--recommended-glyphs",
|
||||
])
|
||||
size = out_path.stat().st_size
|
||||
print(f"wrote {out_path} ({size} bytes, {len(points)} codepoints)")
|
||||
if size > 2 * 1024 * 1024:
|
||||
print("warning: over the 2 MiB web budget enforced by the fonts.rs tests")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("font", type=Path, nargs="?", help="Noto Sans SC variable font (a noto-cjk release)")
|
||||
ap.add_argument("--out", type=Path, default=SHIPPED)
|
||||
ap.add_argument("--check", action="store_true", help="compare the recipe against the shipped subset and exit")
|
||||
args = ap.parse_args()
|
||||
|
||||
points = collect_codepoints()
|
||||
if args.check:
|
||||
return check(points)
|
||||
if args.font is None:
|
||||
ap.error("a Noto Sans SC variable font is required (or use --check)")
|
||||
return 2
|
||||
if not args.font.is_file():
|
||||
print(f"error: {args.font} is not a file", file=sys.stderr)
|
||||
return 1
|
||||
return regenerate(args.font, points, args.out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
+34
-27
@@ -1,26 +1,25 @@
|
||||
# Localization parity
|
||||
|
||||
> **Last reviewed:** 2026-11-13 · **Last updated:** 2026-11-27 · **Change:** minor (Spanish catalog completed, with native-speaker terminology review; previously minor: French and Spanish catalogs, partial; previously minor: pt-BR catalog completed: all fixed UI strings translated and covered by tests; native-speaker review, CJK/RTL font fallbacks and RTL script shaping still pending) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
> **Last reviewed:** 2026-11-13 · **Last updated:** 2026-11-28 · **Change:** minor (zh-Hans catalog covers the fixed UI strings, with a Han system-font fallback and an OFL web subset; previously minor: Spanish catalog completed, with native-speaker terminology review; previously minor: French and Spanish catalogs, partial; previously minor: pt-BR catalog completed: all fixed UI strings translated and covered by tests; native-speaker review, CJK/RTL font fallbacks and RTL script shaping still pending) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
|
||||
SoundCraft defaults to English and supports selecting Brazilian Portuguese, French and Spanish. The
|
||||
Spanish catalog covers the same fixed UI strings and engine errors as pt-BR; the French catalog is
|
||||
partial (missing strings show in English). The pt-BR catalog
|
||||
covers all fixed UI strings found in the current source: command labels, menus, Appearance,
|
||||
SoundCraft defaults to English and supports selecting Brazilian Portuguese, French, Spanish and
|
||||
Simplified Chinese. The Spanish catalog covers the same fixed UI strings and engine errors as pt-BR;
|
||||
the French catalog is partial (missing strings show in English). The pt-BR and zh-Hans catalogs
|
||||
cover all fixed UI strings found in the current source: command labels, menus, Appearance,
|
||||
About/Credits, Audio Health, Playback Engine, System Usage, Workspace, plugin parameter and display
|
||||
names, dialogs and buttons, tooltips (including those localized inside buttons and toggles),
|
||||
accessibility names, the Edit-window status bar, the remove-session question and formatted
|
||||
messages. Engine errors are matched against catalog templates at display time by
|
||||
`localization::error_text`. Values built at run time (file, track and device names), engine command
|
||||
parameter documentation and third-party plugin names stay as they are, and the catalog has not been
|
||||
independently or native-speaker reviewed. Pro Tools ships its UI in **8 languages** (bundle
|
||||
`.lproj` folders: English, German, Spanish, French, Japanese, Korean, Simplified Chinese,
|
||||
Traditional Chinese).
|
||||
`localization::error_text`; zh-Hans keeps engine diagnostics in English. Values built at run time
|
||||
(file, track and device names), engine command parameter documentation and third-party plugin names
|
||||
stay as they are, and neither the pt-BR nor the zh-Hans catalog has been independently or
|
||||
native-speaker reviewed. Pro Tools ships its UI in **8 languages** (bundle `.lproj` folders:
|
||||
English, German, Spanish, French, Japanese, Korean, Simplified Chinese, Traditional Chinese).
|
||||
|
||||
**Localization: ~12 %** (measured: 1 of the target's 8 UI languages, and English is the only one
|
||||
complete). Remaining ≈ 70–110 h: a catalog and extraction pass (≈ 15–25 h), a font fallback for
|
||||
CJK/Devanagari/Arabic (PR #141 open), RTL layout and complex-script shaping (egui has neither:
|
||||
≈ 25–40 h, or ship Arabic/Hindi menus-only), then ≈ 3–5 h of agent translation per language, plus
|
||||
native-speaker review (human).
|
||||
**Localization: ~19 %** (measured: 2 of the target's 8 UI languages, and neither translation has had
|
||||
a native-speaker pass). Remaining ≈ 55–90 h: RTL layout and complex-script shaping (egui has
|
||||
neither: ≈ 25–40 h, or ship Arabic/Hindi menus-only), the remaining catalogs (≈ 3–5 h of agent
|
||||
translation each), the Japanese/Korean font faces, and native-speaker review (human).
|
||||
|
||||
Open work: completing the French catalog (rows also kept in storytold/craft-i18n for
|
||||
when SoundCraft reads it), PR #141 (bundled multilingual font fallbacks), issue #67 (Ukrainian).
|
||||
@@ -28,32 +27,39 @@ when SoundCraft reads it), PR #141 (bundled multilingual font fallbacks), issue
|
||||
| Language | Code | UI strings translated | Dialogs / tooltips / help | Script support | Native review | Status | Est. to full (h) | In Pro Tools |
|
||||
|---|---|---|---|---|---|---|---:|---|
|
||||
| English | en | all (source) | ✅ | Latin ✅ | — | **full** | 0 | ✅ |
|
||||
| Simplified Chinese | zh-Hans | 0 (0 %) | ❌ | ❌ no CJK font fallback, no IME testing | no | none | 6–10 | ✅ |
|
||||
| Simplified Chinese | zh-Hans | ✅ 100 % of fixed UI strings: menus, dialogs, buttons, tooltips, accessibility names, status bar, formatted messages | ✅ | Han ✅ (system font on the desktop, OFL subset on the web) | no | **full** | 0–4 (native review) | ✅ |
|
||||
| Spanish | es | ✅ 100 % of fixed UI strings (1,960) and engine errors (254), as pt-BR; catalog and menu-coverage tests pass | 🟡 partial | Latin ✅ | yes (es-ES, sound engineer; terminology reviewed) | full | 0–2 | ✅ |
|
||||
| Hindi | hi | 0 (0 %) | ❌ | ❌ no Devanagari font or shaping | no | none | 8–15 | ❌ |
|
||||
| Arabic | ar | 0 (0 %) | ❌ | ❌ no RTL layout, no shaping | no | none | 15–25 | ❌ |
|
||||
| French | fr | 🟡 1,368 of ~2,210 catalog strings (≈ 62 %); engine errors not yet translated | 🟡 partial | Latin ✅ | no | partial | 1–3 | ✅ |
|
||||
|| Portuguese (Brazil) | pt-BR | ✅ 100 % of fixed UI strings: menus, dialogs, buttons, tooltips, accessibility names, status bar, formatted messages and engine errors; catalog tests pass | 🟡 partial | Latin ✅ | no (native review pending) | full | 0–4 | ❌ |
|
||||
| Portuguese (Brazil) | pt-BR | ✅ 100 % of fixed UI strings: menus, dialogs, buttons, tooltips, accessibility names, status bar, formatted messages and engine errors; catalog tests pass | 🟡 partial | Latin ✅ | no (native review pending) | full | 0–4 | ❌ |
|
||||
| Indonesian | id | 0 (0 %) | ❌ | Latin ✅ | no | none | 3–5 | ❌ |
|
||||
| Japanese | ja | 0 (0 %) | ❌ | ❌ no CJK font fallback, no IME testing | no | none | 6–10 | ✅ |
|
||||
| Japanese | ja | 0 (0 %) | ❌ | 🟡 Han fallback draws Japanese kanji, no kana face and no IME testing | no | none | 6–10 | ✅ |
|
||||
| German | de | 0 (0 %) | ❌ | Latin ✅ | no | none | 3–5 | ✅ |
|
||||
| Korean | ko | 0 (0 %) | ❌ | ❌ no Hangul font fallback | no | none | 6–10 | ✅ |
|
||||
| Korean | ko | 0 (0 %) | ❌ | 🟡 Hangul system-font fallback, no IME testing | no | none | 6–10 | ✅ |
|
||||
| Vietnamese | vi | 0 (0 %) | ❌ | 🟡 Latin with stacked diacritics, untested | no | none | 3–5 | ❌ |
|
||||
|
||||
Other languages shipped: **0**. (Pro Tools also ships Traditional Chinese, zh-Hant.)
|
||||
Other languages shipped: **2**. (Pro Tools also ships Traditional Chinese, zh-Hant.)
|
||||
|
||||
Per-language hours exclude the shared catalog and script work above.
|
||||
Per-language hours exclude the shared catalog and script work above. A Han face now ships for the
|
||||
desktop (system font, never redistributed) and the web (an OFL subset); Traditional Chinese and
|
||||
Japanese would need their own Han faces, since the fallback list is Simplified-first.
|
||||
|
||||
## Usage
|
||||
|
||||
- Pick the language in Appearance ▸ Language, or run the `ui.language` command with
|
||||
`{"language": "pt-BR"}` (or `"en"`, `"fr"`, `"es"`); with no parameter it reports the current language.
|
||||
Example: `soundcraft-cli run --demo --cmd 'ui.language={"language":"pt-BR"}'`.
|
||||
`{"language": "pt-BR"}` (or `"en"`, `"fr"`, `"es"`, `"zh-Hans"`); with no parameter it reports the
|
||||
current language. Example: `soundcraft-cli run --demo --cmd 'ui.language={"language":"zh-Hans"}'`.
|
||||
- The choice is a global preference saved with the UI state (like the theme); recalling a saved
|
||||
window configuration does not change it.
|
||||
- Strings missing from the catalog fall back to English. Add one with a `"English text" => "translated text"`
|
||||
arm in `crates/ui-egui/locales/<tag>/mod.rs`; tests check placeholder parity, duplicates and that every
|
||||
string passed to `text` / `localized_format!` has a pt-BR entry.
|
||||
- Strings missing from the catalog fall back to English, and the tests check placeholder parity,
|
||||
duplicate keys and that every string passed to `text` / `localized_format!` has a pt-BR and a
|
||||
zh-Hans entry.
|
||||
- How a catalog is edited depends on how it is kept. pt-BR, fr and es are hand-written: add a
|
||||
`"English text" => "translated text"` arm to `crates/ui-egui/locales/<tag>/mod.rs`. zh-Hans is
|
||||
generated: add the row to `crates/ui-egui/src/i18n/zh-hans.tsv` and run
|
||||
`python3 docs/i18n/tools/gen_zh_hans_locale.py` — never edit the generated module by hand. See
|
||||
[localization.md](localization.md).
|
||||
|
||||
## Revision history
|
||||
|
||||
@@ -61,6 +67,7 @@ Per-language hours exclude the shared catalog and script work above.
|
||||
|---|---|---|
|
||||
| 2026-11-27 | minor | Completed the Spanish catalog (all fixed UI strings and engine errors) with a native-speaker terminology review; Spanish menu-coverage test; the path prompt's `File path` and `Folder path` fields are translated apart from the Auto Pan `Path` parameter |
|
||||
| 2026-11-24 | minor | French and Spanish catalogs (`locales/fr`, `locales/es`, 1,368 strings each) from PR #143, on the `localization` layer; Appearance ▸ Language lists them; estimates unchanged |
|
||||
| 2026-11-22 | minor | Added the Simplified Chinese catalog on the shared `localization` module (1,383 strings, all menu labels and every `text`/`localized_format!` source covered), a Han system-font fallback ordered ahead of Hangul except for Korean, and a 1.1 MiB OFL Noto Sans SC subset for the web build; catalog and font tests added; localization estimate ~12 % → ~19 % |
|
||||
| 2026-11-13 | minor | Completed the pt-BR catalog: tooltips passed to buttons and toggles, `Not available yet.`, the send hover help, `no instrument`, the search placeholders, the Edit-window status bar (bit depth, track count, undo, ms/frame), the remove-session question and the transport/sample-rate readouts; engine errors now reach the status line through `error_text` |
|
||||
| 2026-11-05 | minor | Added persisted language selection, the `ui.language` command, English fallback and a pt-BR catalog (menus, dialogs, tooltips, accessibility text, formatted messages); added a Usage section and catalog tests |
|
||||
| 2026-10-10 | major | Created: English only, no catalog; the twelve key languages at 0 %; Pro Tools' 8 languages listed from its bundle |
|
||||
| 2026-10-10 | major | Created: English only, no catalog; the twelve key languages at 0 %; Pro Tools' 8 languages listed from its bundle |
|
||||
@@ -0,0 +1,121 @@
|
||||
# Simplified Chinese UI
|
||||
|
||||
SoundCraft's interface can be shown in **简体中文**. The catalog is compiled into the binary
|
||||
(`crates/ui-egui/locales/zh-Hans/mod.rs`), so there is nothing to install and no locale files to
|
||||
find at run time. It covers **every string the UI looks up literally** — menu items and path
|
||||
segments, command labels, dialogs, window titles, tooltips, status-bar and accessibility text and
|
||||
the formatted messages — and every reference menu label in `crates/engine/catalog/menus.txt`.
|
||||
Engine diagnostics and machine-facing surfaces stay English (see
|
||||
[What is translated](#what-is-translated)).
|
||||
|
||||
The mechanism is described in [`localization.md`](localization.md); wording decisions are in
|
||||
[`i18n/glossary.md`](i18n/glossary.md).
|
||||
|
||||
## Selecting the language
|
||||
|
||||
**Setup ▸ Appearance ▸ Language** lists **English** and **简体中文**. Choosing a language applies
|
||||
immediately — menus, panels, dialogs and window titles switch on the next frame, no restart.
|
||||
|
||||
Without the window, use the command:
|
||||
|
||||
```sh
|
||||
soundcraft-cli run --demo --cmd 'ui.language={"language":"zh-Hans"}'
|
||||
```
|
||||
|
||||
`ui.language` with no parameter reports the current language (`{"language":"en"}`), and an unknown
|
||||
tag is an error. The choice is a global preference saved with the UI state (like the theme), so it
|
||||
survives a restart; recalling a saved window configuration never changes it. In the browser the
|
||||
interface starts from `navigator.language`, and the saved preference wins once one exists.
|
||||
|
||||
## What is translated
|
||||
|
||||
English source strings stay in the code and are the lookup keys; the catalog maps them at draw
|
||||
time. Command ids, menu paths used for lookup, preference keys and values, file formats, the
|
||||
control protocol, the CLI and MCP never see translated text, and neither do values built at run
|
||||
time (file, track and device names) or third-party plugin names.
|
||||
|
||||
Engine error messages stay English: a half-translated diagnostic is worse than a whole one, and the
|
||||
`error_text` templates pt-BR carries are deliberately omitted here.
|
||||
|
||||
## Files
|
||||
|
||||
| Path | What |
|
||||
|---|---|
|
||||
| `crates/ui-egui/src/i18n/zh-hans.tsv` | the translator-facing catalog: `context<TAB>English<TAB>translation`, escapes `\n`, `\t`, `\\` |
|
||||
| `crates/ui-egui/locales/zh-Hans/mod.rs` | generated from the TSV; the UI reads this |
|
||||
| `docs/i18n/tools/gen_zh_hans_locale.py` | regenerates the module (`--check` fails when stale) |
|
||||
| `assets/fonts/NotoSansSC-SoundCraftSubset.ttf` | web-only Han font subset, OFL-1.1 |
|
||||
| `docs/i18n/tools/subset_web_font.py` | regenerates the subset from the catalog's glyphs |
|
||||
|
||||
## Editing translations
|
||||
|
||||
```sh
|
||||
# 1. edit crates/ui-egui/src/i18n/zh-hans.tsv (one row per string)
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py # 2. regenerate the module
|
||||
cargo test -p soundcraft-ui-egui --lib # 3. catalog and font tests
|
||||
```
|
||||
|
||||
Keep the English placeholders (`{name}`, `{}`, `{ms:.1}`) exactly as they are: a test compares them.
|
||||
Rows are keyed by the English source, so rewording English text requires updating the row with it.
|
||||
`@plural` rows pair `singular|plural` on one row because Chinese has no plural inflection.
|
||||
|
||||
Look the result up, don't guess: `cargo run -p soundcraft-ui-egui --example ui_shot -- out.png` with a
|
||||
script that sets the language, then read the PNG (and the accessibility tree) before claiming a
|
||||
screen is right.
|
||||
|
||||
## Terminology
|
||||
|
||||
The short table; the reasoning is in [`i18n/glossary.md`](i18n/glossary.md).
|
||||
|
||||
| English | 中文 | Note |
|
||||
|---|---|---|
|
||||
| Session | 会话 | |
|
||||
| Track | 轨道 | audio and MIDI alike; 音轨 reads as audio only |
|
||||
| Clip | 片段 | |
|
||||
| Bus | 总线 | |
|
||||
| Transport | 走带 | standard audio-engineering word |
|
||||
| Pan | 声像 | 规范 acoustics term |
|
||||
| Bypass | 旁通 | |
|
||||
| Record | 录音 | Record Enable = 启用录音 |
|
||||
| Preferences | 首选项 | |
|
||||
| Bounce | 导出 | |
|
||||
| Slip / Spot | 滑动 / 定位 | |
|
||||
| Meter (level) / Meter (time signature) | 电平表 / 拍号 | two senses, two words |
|
||||
| Undo / Redo | 撤销 / 重做 | |
|
||||
|
||||
## Fonts
|
||||
|
||||
egui's bundled faces carry no Han glyphs, so `crates/ui-egui/src/fonts.rs` appends a Han fallback in
|
||||
every family: the operating system's own face on the desktop (fontconfig `lang=zh-cn`, plus
|
||||
per-platform candidates), and the bundled Noto Sans SC subset in the browser, which has no system
|
||||
fonts. Han is ordered before the Hangul fallback for every language except Korean, so Chinese text
|
||||
never draws Korean-styled shapes on Linux where fontconfig resolves Noto Sans CJK's Korean face
|
||||
first.
|
||||
|
||||
The web subset is 1.1 MiB and must stay under 2 MiB (test-enforced). After a catalog change,
|
||||
rebuild it from a Noto Sans SC variable font (a `noto-cjk` release, Sans/Variable/OTF) and check the
|
||||
result:
|
||||
|
||||
```sh
|
||||
# <font>: a Noto Sans SC variable font (family "Noto Sans SC", wght axis) from a noto-cjk release
|
||||
python3 docs/i18n/tools/subset_web_font.py <font> # writes assets/fonts/…
|
||||
python3 docs/i18n/tools/subset_web_font.py --check # fails on drift
|
||||
```
|
||||
|
||||
The test that draws the whole catalog in every family fails until the subset covers the new
|
||||
characters.
|
||||
|
||||
## Validation
|
||||
|
||||
- every localized source string has a zh-Hans entry (test lists what is missing);
|
||||
- placeholders match the English source, keys are unique, every menu label is covered;
|
||||
- the bundled web face draws the whole catalog in every family and fits its budget;
|
||||
- with a system Han font installed, every family draws 轨道片段混音.
|
||||
|
||||
## Known gaps
|
||||
|
||||
- Engine diagnostics stay English.
|
||||
- No native-speaker review yet; the catalog is AI-authored and should be read by a Chinese-speaking
|
||||
audio engineer before it is called finished.
|
||||
- Traditional Chinese (`zh-Hant`) is not shipped; the Han face list is Simplified-first.
|
||||
- No IME testing beyond what the platform provides, and no complex-script shaping (egui has none).
|
||||
@@ -0,0 +1,121 @@
|
||||
# Localization
|
||||
|
||||
SoundCraft's interface ships in English and 简体中文 (Simplified Chinese), and English source text
|
||||
is the key: the strings in the code are what the catalogs translate, so a missing translation falls
|
||||
back to readable English instead of an empty label. Catalogs are compiled into the binary; a
|
||||
release has no catalog files to install or find, and the web build carries them too.
|
||||
|
||||
This page describes the mechanism. For the Chinese catalog itself see
|
||||
[`localization-zh-hans.md`](localization-zh-hans.md); for terminology see
|
||||
[`i18n/glossary.md`](i18n/glossary.md); for coverage against the incumbent see
|
||||
[`localization-parity.md`](localization-parity.md).
|
||||
|
||||
## Supported languages
|
||||
|
||||
| Language | Code | Catalog | Notes |
|
||||
|---|---|---|---|
|
||||
| English (source) | `en` | — (the strings live in the code) | fallback for every catalog |
|
||||
| 简体中文 — Simplified Chinese | `zh-Hans` | [`crates/ui-egui/locales/zh-Hans/mod.rs`](../crates/ui-egui/locales/zh-Hans/mod.rs) | generated from [`zh-hans.tsv`](../crates/ui-egui/src/i18n/zh-hans.tsv) |
|
||||
| Português (Brasil) — Portuguese (Brazil) | `pt-BR` | [`crates/ui-egui/locales/pt-BR/mod.rs`](../crates/ui-egui/locales/pt-BR/mod.rs) | hand-written |
|
||||
|
||||
The registry is the `Language` enum in
|
||||
[`crates/ui-egui/src/localization.rs`](../crates/ui-egui/src/localization.rs): `ALL` is the order
|
||||
the Appearance window offers, `id()` is the tag stored in preferences, and `native_name()` is the
|
||||
English source name the menu draws through the catalog.
|
||||
|
||||
## How a string is localized
|
||||
|
||||
- `localization::text("English source")` returns the translation for the language entered for the
|
||||
current frame, or the source when the catalog has no entry.
|
||||
- `localized_format!("{name} send level", name = …)` translates the template and then fills it; the
|
||||
translation keeps the same placeholders (a test enforces that).
|
||||
- `localization::error_text(message)` matches an engine error against the catalog's error templates
|
||||
and carries the embedded values over, so a low-level library error stays in English rather than
|
||||
turning into a half-translated sentence.
|
||||
- A catalog module exposes `pub(super) fn translate(source: &str) -> Option<&'static str>` and, if
|
||||
it translates engine errors, `pub(super) const ERROR_TEMPLATES`.
|
||||
|
||||
Values built at run time (file, track and device names), command ids, menu paths used for lookup,
|
||||
preference keys and values, file formats, the control protocol and third-party plugin names are
|
||||
never translated. Engine diagnostics are English in the zh-Hans catalog by design; pt-BR carries
|
||||
error templates.
|
||||
|
||||
The zh-Hans module is generated: edit
|
||||
[`crates/ui-egui/src/i18n/zh-hans.tsv`](../crates/ui-egui/src/i18n/zh-hans.tsv) (one row per
|
||||
string, `context<TAB>English<TAB>translation`) and rerun
|
||||
|
||||
```sh
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py # rewrite the locale module
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py --check # fail when it is out of date
|
||||
```
|
||||
|
||||
The TSV is also the file `storytold/craft-i18n`'s `tools/sync_app.py` reads, so the catalog can move
|
||||
to the shared repository when SoundCraft takes that step.
|
||||
|
||||
## Choosing the language
|
||||
|
||||
`Setup ▸ Appearance ▸ Language` (or the `ui.language` command) selects it while the app runs, and
|
||||
the choice is a global preference saved with the UI state:
|
||||
|
||||
```sh
|
||||
soundcraft-cli run --demo --cmd 'ui.language={"language":"zh-Hans"}'
|
||||
```
|
||||
|
||||
With no parameter, `ui.language` reports the current language; an unknown tag is an error. In the
|
||||
browser the language starts from `navigator.language` and follows the saved preference once one
|
||||
exists.
|
||||
|
||||
## Fonts
|
||||
|
||||
egui's bundled faces carry no Han glyphs, so the interface needs a CJK fallback
|
||||
([`crates/ui-egui/src/fonts.rs`](../crates/ui-egui/src/fonts.rs)):
|
||||
|
||||
- Native builds append the operating system's own Han face after every family, resolved through
|
||||
fontconfig (`lang=zh-cn`) with a list of per-platform candidates; nothing is redistributed.
|
||||
- The web build cannot reach system fonts, so it embeds `assets/fonts/NotoSansSC-SoundCraftSubset.ttf`,
|
||||
a Noto Sans SC (OFL-1.1) subset at weight 400 covering the UI glyph set. Regenerate it after a
|
||||
catalog change with
|
||||
|
||||
```sh
|
||||
# <font>: a Noto Sans SC variable font from a noto-cjk release — any file whose family is
|
||||
# "Noto Sans SC" and that carries a wght axis
|
||||
python3 docs/i18n/tools/subset_web_font.py <font>
|
||||
python3 docs/i18n/tools/subset_web_font.py --check
|
||||
```
|
||||
|
||||
and keep [`ATTRIBUTION.md`](../ATTRIBUTION.md) in step; `cargo xtask assets` enforces that.
|
||||
- Han comes before the Hangul fallback for every interface language except Korean, so a Chinese
|
||||
interface and Chinese names draw Chinese shapes even where fontconfig would resolve the Korean
|
||||
face of Noto Sans CJK first.
|
||||
|
||||
## Tests and gates
|
||||
|
||||
`cargo test -p soundcraft-ui-egui` covers the catalog and the fonts:
|
||||
|
||||
- every catalog entry parses, keys are unique and translations keep the English placeholders;
|
||||
- every string passed to `localization::text` / `localized_format!` in `crates/ui-egui/src` has an
|
||||
entry in every shipped catalog, and every reference menu label is translated;
|
||||
- the bundled web face draws the whole zh-Hans catalog in every family and stays inside its 2 MiB
|
||||
budget;
|
||||
- with a system Han font installed, every family draws Chinese text.
|
||||
|
||||
`cargo xtask ci` runs those with the rest of the gates (fmt, clippy, assets, layers, wasm).
|
||||
|
||||
## Adding another language
|
||||
|
||||
1. Add a `locales/<tag>/mod.rs` with `translate` (and `ERROR_TEMPLATES` when engine errors should be
|
||||
translated), plus the `#[path]` module declaration in `localization.rs`.
|
||||
2. Add the `Language` variant: `ALL`, `id()`, `native_name()`, `text()`, and the `error_text`
|
||||
template arm.
|
||||
3. Translate `every_localized_source_string_has_a_catalog_entry`'s set (the test lists what is
|
||||
missing by file and string) and the menu labels.
|
||||
4. Add a font fallback for the script, and for the web build either bundle a subset or document the
|
||||
gap; extend `ATTRIBUTION.md` when a file is added.
|
||||
5. Update [`localization-parity.md`](localization-parity.md), `ROADMAP.md` and `docs/gaps.md`.
|
||||
|
||||
## Relation to `storytold/craft-i18n`
|
||||
|
||||
The org keeps shared translations in `craft-i18n` and reads them through an optional `CRAFT_I18N_DIR`
|
||||
build input. SoundCraft has not cut over (roadmap stage 3d): like pt-BR, this catalog lives in the
|
||||
repository, and its TSV is the pre-cutover file the sync script consumes, so a later migration only
|
||||
moves data.
|
||||
+2
-1
@@ -49,7 +49,7 @@ Status: ✅ done · 🟡 in progress · ⬜ not started.
|
||||
| M12 | **Hardware**: audio interfaces, MIDI devices, sync, control surfaces | ⬜ | 110–180 |
|
||||
| M13 | **Interchange**: AAF/OMF import/export, disk streaming | 🟡 strict external-WAV AAF import; export, OMF and disk streaming missing | 65–115 |
|
||||
| M14 | **Fidelity harness** against Pro Tools (null tests, plugin responses) | ⬜ | 20–30 |
|
||||
| M15 | **Localization**: catalog, fonts/RTL, the 8 Pro Tools languages first | 🟡 partial (pt-BR catalog; Spanish complete; French partial; pt-BR needs native review; PR #141 open) | 45–80 |
|
||||
| M15 | **Localization**: catalog, fonts/RTL, the 8 Pro Tools languages first | 🟡 partial (pt-BR and zh-Hans catalogs, zh-Hans with a CJK fallback; Spanish complete; French partial; pt-BR and zh-Hans need native review; PR #141 open) | 45–80 |
|
||||
| M16 | Built-in plugin depth, sidechain, ARA | ⬜ | 110–170 |
|
||||
| M17 | Immersive delivery (ADM BWF, object renderer, binaural) and video depth | ⬜ | 80–130 |
|
||||
|
||||
@@ -90,6 +90,7 @@ There is no `cargo xtask scorecard` in this repo; the measured number is `cargo
|
||||
|---|---|---|
|
||||
| 2026-11-27 | trivial | M15: Spanish catalog complete (UI strings and engine errors, native-speaker review). Estimates unchanged |
|
||||
| 2026-11-24 | trivial | M15: French and Spanish catalogs (partial, ≈ 62 %) on the `localization` layer (#143). Estimates unchanged |
|
||||
| 2026-11-22 | trivial | M15: the zh-Hans catalog covers the fixed UI strings, with a Han font fallback on the desktop and an OFL web subset; native review still pending |
|
||||
| 2026-11-18 | minor | MIDI input devices landed (G-02 shrunk); the MIDI gate row is unverified until checked on macOS and Windows |
|
||||
| 2026-11-14 | minor | M13 is in progress with strict external-WAV AAF import; the exchange gate still fails without AAF export, OMF or `.ptx`; estimates unchanged |
|
||||
| 2026-11-09 | trivial | 28 built-in processors with the Frequency Shifter |
|
||||
|
||||
@@ -87,7 +87,7 @@ post-production, tracking) can switch. "Ready" is depth, correctness and fidelit
|
||||
| Performance | 5 % | **~35 %** | estimated (unmeasured) | 40–70 | [hardware-parity.md](hardware-parity.md) | Parallel strip rendering and PDC exist; whole files decoded into RAM, recording to disk (#84; long takes #888), no track-count or latency benchmarks |
|
||||
| Ecosystem / plugins | 4 % | **~30 %** | estimated | in Features + Hardware | [plugin-parity.md](plugin-parity.md) | CLAP/VST3/AU hosting; no AAX (Pro Tools' only format), no ARA, no sidechain, no control-surface ecosystem, no content library |
|
||||
| Platforms | 3 % | **~65 %** | estimated | 20–40 | [ROADMAP.md](../ROADMAP.md) | Builds for macOS, Windows x64/x86/arm64, Linux, FreeBSD, Web (Pro Tools: macOS, Windows), but only macOS is exercised at runtime; Web lacks file pickers (#63, #64) |
|
||||
| Localization | 2 % | **~12 %** | measured (catalog count) | 70–110 | [localization-parity.md](localization-parity.md) | English plus a pt-BR catalog (not native-reviewed); Pro Tools ships 8 UI languages; FR/ES PR #143 open |
|
||||
| Localization | 2 % | **~19 %** | measured (catalog count) | 55–90 | [localization-parity.md](localization-parity.md) | English, pt-BR, es, fr (partial) and zh-Hans catalogs (es native-reviewed); Han fallback on the desktop and an OFL subset on the web; Pro Tools ships 8 UI languages |
|
||||
| AI features | 1 % | **~5 %** | estimated | 30–50 | [gaps.md](gaps.md) | Pro Tools has speech-to-text transcription (upgraded in 2026.4); we have only an audio-to-MIDI pitch tracker |
|
||||
| **Weighted** | 100 % | **~40 %** | | **~950–1,450** (overlaps removed) | | |
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ echo "==> SoundCraft $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL
|
||||
# host's disk before anything here could check it.
|
||||
MAX_UNPACKED_BYTES=$((2 * 1024 * 1024 * 1024))
|
||||
UNPACKED="$(tar --numeric-owner -tzvf "$TARBALL" | awk '{ s += $3 } END { print s + 0 }')"
|
||||
[ "$UNPACKED" -le "$MAX_UNPACKED_BYTES" ] || { echo "error: $TARBALL unpacks to $UNPACKED bytes, more than $MAX_UNPACKED_BYTES" >&2; exit 1; }
|
||||
[[ "$UNPACKED" -le "$MAX_UNPACKED_BYTES" ]] || { echo "error: $TARBALL unpacks to $UNPACKED bytes, more than $MAX_UNPACKED_BYTES" >&2; exit 1; }
|
||||
|
||||
WORK="$CARGO_TARGET_DIR/flatpak-bundle"
|
||||
rm -rf "$WORK"
|
||||
|
||||
@@ -100,6 +100,9 @@ sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$SOUNDCRAFT_BUILD_DATE/g" \
|
||||
"$HERE/$APP_ID.metainfo.xml.in" >"$STAGE/usr/share/metainfo/$APP_ID.metainfo.xml"
|
||||
mkdir -p "$STAGE/usr/share/icons"
|
||||
cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/usr/share/icons/"
|
||||
# The compile-time embedded nightly icon lives in assets/app-icon/hicolor for include_bytes!;
|
||||
# exclude it from staged FHS icons so stable and nightly packages never collide on it.
|
||||
rm -f "$STAGE/usr/share/icons/hicolor/256x256/apps/$APP_ID-nightly.png"
|
||||
mkdir -p "$STAGE/usr/share/doc/soundcraft"
|
||||
copy_docs "$STAGE/usr/share/doc/soundcraft"
|
||||
# soundcraft-cli's man pages and shell completions, from its clap definition, written by the
|
||||
|
||||
@@ -7,3 +7,5 @@ sonar.organization=storytold
|
||||
sonar.cpd.exclusions=crates/ui-egui/locales/**
|
||||
# Packaging verification scripts are standalone test suites, not covered by Rust coverage reports.
|
||||
sonar.coverage.exclusions=packaging/**
|
||||
# Browser test harness under apps/soundcraft-web/tests is test code, not production source.
|
||||
sonar.test.inclusions=apps/soundcraft-web/tests/**
|
||||
|
||||
Reference in New Issue
Block a user