feat(host): traduire les messages produits par l'hôte
CI / Formatting, tests and builds (push) Successful in 3m18s

Les erreurs de démarrage, les avertissements, les raisons d'arrêt, les
réglages en attente, les refus de validation et la récupération d'un
fichier de réglages partent désormais en Notice: un code, ses valeurs
(port, port libre, interface, adresse, et detail pour les mots du
système) et la phrase anglaise. La coque cherche desktop.host.<code>
dans locales/ et retombe sur la phrase anglaise pour un code qu'elle ne
connaît pas encore; la ligne de commande affiche la phrase anglaise.

Les erreurs de démarrage de la capture deviennent des variantes typées
au lieu de chaînes. Le test notices relit les sources et refuse un code
absent d'un catalogue.

Le Cargo.lock de la coque suit if-addrs, oublié au commit précédent.

Refs #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Guillaume ASSIERandClaude Opus 5.5 committed 2026-10-30 15:55:23 +01:00
1 parent ae5c76a51c
commit aee5dde679
22 files changed
+651 -172

No files matched your search

+3 -2
View File
@@ -20,8 +20,9 @@ local `rustscreen.local` en mDNS, viewer React qui reprend seul après
une coupure ou une veille, tourne l'image et suit le thème, coque desktop Tauri avec icône de
barre système, réglages persistants, interface en français et en anglais, inhibition de veille,
journal JSON local et archive de diagnostics.
Ce qui manque: la capture Windows et macOS, l'encodeur matériel, et la traduction des messages
produits par l'hôte (erreurs, avertissements), aujourd'hui en anglais seulement (#75).
Ce qui manque: la capture Windows et macOS, et l'encodeur matériel. Les messages de l'hôte
(erreurs, avertissements, refus de réglages) partent en codes (`Notice`) que la coque traduit sous
`desktop.host` (#75); le test `notices` refuse un code sans traduction.
L'hôte tient dans `rs-session::Host`: démarrer, arrêter, déconnecter un spectateur, régler, et
publier l'état complet à chaque changement. Lancer `rustscreen` ouvre l'application de bureau
+1
View File
@@ -3592,6 +3592,7 @@ dependencies = [
name = "rs-rtc"
version = "0.5.0"
dependencies = [
"if-addrs",
"rs-codec",
"str0m",
"thiserror 2.0.21",
+5 -5
View File
@@ -14,7 +14,7 @@ use rs_session::{
Config, Host, HostState, InterfaceOption, Overrides, Phase, SettingsOutcome, SourceChoice,
SourceOption,
};
use rs_store::{CloseAction, Rejection, Settings};
use rs_store::{CloseAction, Notice, Rejection, Settings};
use tauri::{Emitter, Manager, RunEvent, State, WindowEvent};
/// The last started source, so that the system tray menu can restart a share
@@ -60,7 +60,7 @@ async fn start(
host: State<'_, Host>,
last: State<'_, LastSource>,
choice: SourceChoice,
) -> Result<(), String> {
) -> Result<(), Notice> {
*last.0.lock().unwrap_or_else(|e| e.into_inner()) = Some(choice.clone());
host.start(choice).await
}
@@ -82,7 +82,7 @@ fn regenerate_access(host: State<'_, Host>) -> bool {
}
#[tauri::command]
async fn trust_device(host: State<'_, Host>, connection: u64) -> Result<(), String> {
async fn trust_device(host: State<'_, Host>, connection: u64) -> Result<(), Notice> {
host.trust_device(connection).await
}
@@ -91,14 +91,14 @@ async fn switch_source(
host: State<'_, Host>,
last: State<'_, LastSource>,
choice: SourceChoice,
) -> Result<(), String> {
) -> Result<(), Notice> {
host.switch_source(choice.clone()).await?;
*last.0.lock().unwrap_or_else(|e| e.into_inner()) = Some(choice);
Ok(())
}
#[tauri::command]
async fn revoke_device(host: State<'_, Host>, key: String) -> Result<(), String> {
async fn revoke_device(host: State<'_, Host>, key: String) -> Result<(), Notice> {
host.revoke_device(&key).await
}
+10 -7
View File
@@ -9,7 +9,7 @@ import { SharePanel } from './components/SharePanel';
import { SourcePicker } from './components/SourcePicker';
import { effectiveLanguage, I18nProvider, useI18n } from './i18n';
import type { Host } from './lib/host';
import { actions, key, status, trayTexts } from './lib/view';
import { actions, key, say, status, trayTexts } from './lib/view';
/**
* The language comes from the host settings, or from the desktop. Changing it
@@ -265,23 +265,26 @@ function Banners({ state }: { state: HostState }) {
<>
{state.error && state.phase === 'stopped' && (
<div className='banner error' role='alert'>
<strong>{t('startFailed')}</strong> {state.error}
<strong>{t('startFailed')}</strong> {say(state.error, t)}
</div>
)}
{state.stop && state.phase === 'stopped' && (
<div className='banner error' role='alert'>
<strong>{t('stoppedByDesktop')}</strong> {state.stop.reason}
<strong>{t('stoppedByDesktop')}</strong> {say(state.stop.reason, t)}
</div>
)}
{state.settings_recovered && <div className='banner warning'>{state.settings_recovered}</div>}
{state.settings_recovered && (
<div className='banner warning'>{say(state.settings_recovered, t)}</div>
)}
{state.warnings.map((w) => (
<div key={w} className='banner warning' role='alert'>
{w}
<div key={w.text} className='banner warning' role='alert'>
{say(w, t)}
</div>
))}
{state.pending_settings.length > 0 && (
<div className='banner info'>
<strong>{t('pendingSettings')}</strong> {state.pending_settings.join('; ')}
<strong>{t('pendingSettings')}</strong>{' '}
{state.pending_settings.map((n) => say(n, t)).join('; ')}
</div>
)}
</>
+6 -5
View File
@@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Capabilities } from "./Capabilities";
import type { Notice } from "./Notice";
import type { Phase } from "./Phase";
import type { Share } from "./Share";
import type { Stop } from "./Stop";
@@ -9,14 +10,14 @@ import type { Stop } from "./Stop";
*/
export type HostState = { phase: Phase, share: Share | null,
/**
* Failure of the last start, to display as is.
* Failure of the last start, translated by the interface (#75).
*/
error: string | null, stop: Stop | null,
error: Notice | null, stop: Stop | null,
/**
* What still works but deserves to be known (interface down, address
* changed).
*/
warnings: Array<string>,
warnings: Array<Notice>,
/**
* Sleep inhibition mechanisms held (`login1`, `screensaver`): empty
* outside a share, or if none could be taken.
@@ -25,11 +26,11 @@ sleep_inhibited: Array<string>,
/**
* Settings changed during the share, applied to the next one.
*/
pending_settings: Array<string>,
pending_settings: Array<Notice>,
/**
* The settings file was unusable at startup: what was done about it.
*/
settings_recovered: string | null,
settings_recovered: Notice | null,
/**
* Capabilities of this machine, to offer only what works.
*/
+16
View File
@@ -0,0 +1,16 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Notice = {
/**
* Key under `desktop.host` in `locales/`, snake case (`port_in_use`).
*/
code: string,
/**
* Values of the placeholders: numbers, interface names, paths, and the
* system's own words (`detail`), which no catalog can translate.
*/
params: { [key in string]: string },
/**
* The English sentence, for the command line and unknown codes.
*/
text: string, };
+2 -1
View File
@@ -1,7 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Notice } from "./Notice";
/**
* A rejected value, named by its field: the interface places it next to the
* faulty field, and the message reads as is.
*/
export type Rejection = { field: string, message: string, };
export type Rejection = { field: string, message: Notice, };
+4 -2
View File
@@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Notice } from "./Notice";
/**
* What a settings change produces.
@@ -9,6 +10,7 @@ export type SettingsOutcome = {
*/
immediate: Array<string>,
/**
* Fields waiting for the next share, with the reason.
* Fields waiting for the next share, with the reason; `field` in the
* parameters names the field.
*/
next_share: Array<string>, };
next_share: Array<Notice>, };
+2 -1
View File
@@ -1,9 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Notice } from "./Notice";
/**
* Why the last share stopped, when it was not the user.
*/
export type Stop = { reason: string,
export type Stop = { reason: Notice,
/**
* Stopped from the desktop ("stop sharing" button, screen unplugged):
* the command line then exits with code 3.
@@ -9,7 +9,7 @@ import type { SettingsOutcome } from '../bindings/SettingsOutcome';
import type { Theme } from '../bindings/Theme';
import { LANGUAGES, useI18n } from '../i18n';
import { type Host, rejectionsOf } from '../lib/host';
import { outcomeSummary } from '../lib/view';
import { noticeOf, outcomeSummary, say } from '../lib/view';
const QUALITIES: QualityPreset[] = ['saver', 'balanced', 'sharp'];
const CODECS: Codec[] = ['vp8', 'vp9'];
@@ -50,7 +50,10 @@ export function SettingsDialog({ host, autostart, onClose, onSaved }: Props) {
setRejections((r) => r.filter((x) => x.field !== field));
setMessage(null);
};
const error = (field: string) => rejections.find((r) => r.field === field)?.message;
const error = (field: string) => {
const found = rejections.find((r) => r.field === field);
return found ? say(found.message, t) : undefined;
};
const save = async () => {
setSending(true);
@@ -78,7 +81,7 @@ export function SettingsDialog({ host, autostart, onClose, onSaved }: Props) {
});
setRejections((r) => r.filter((x) => x.field !== 'trusted_devices'));
} catch (e) {
setRejections([{ field: 'trusted_devices', message: String(e) }]);
setRejections([{ field: 'trusted_devices', message: noticeOf(e) }]);
}
};
@@ -86,7 +89,7 @@ export function SettingsDialog({ host, autostart, onClose, onSaved }: Props) {
try {
setMessage({ type: 'diagnostics', path: await host.exportDiagnostics() });
} catch (e) {
setRejections([{ field: 'diagnostics', message: String(e) }]);
setRejections([{ field: 'diagnostics', message: noticeOf(e) }]);
}
};
+2 -2
View File
@@ -7,7 +7,7 @@ import type { Settings } from '../bindings/Settings';
import type { SettingsOutcome } from '../bindings/SettingsOutcome';
import type { SourceChoice } from '../bindings/SourceChoice';
import type { SourceOption } from '../bindings/SourceOption';
import type { TrayTexts } from './view';
import { noticeOf, type TrayTexts } from './view';
/**
* What the interface can ask of the host. A single real implementation,
@@ -67,5 +67,5 @@ export function rejectionsOf(error: unknown): Rejection[] {
if (Array.isArray(error)) {
return error as Rejection[];
}
return [{ field: 'file', message: String(error) }];
return [{ field: 'file', message: noticeOf(error) }];
}
+25 -1
View File
@@ -11,7 +11,9 @@ import {
expiry,
filter,
key,
noticeOf,
outcomeSummary,
say,
status,
trayTexts,
} from './view';
@@ -153,10 +155,32 @@ describe('texts', () => {
it('a pending setting is said', () => {
expect(outcomeSummary({ immediate: ['limit'], next_share: [] }, t)).toContain('appliqués');
expect(outcomeSummary({ immediate: [], next_share: ['port: would cut'] }, t)).toContain(
const pending = {
code: 'pending_port',
params: { field: 'port' },
text: 'port: changing the port would cut viewers off',
};
expect(outcomeSummary({ immediate: [], next_share: [pending] }, t)).toContain(
'prochain partage',
);
});
it('a host text follows the interface language (#75)', () => {
const busy = {
code: 'port_in_use_free',
params: { port: '8099', free: '8100' },
text: 'port 8099 is already used by another program: port 8100 is free',
};
const en = translatorFor('en');
expect(say(busy, en)).toContain('8100');
expect(say(busy, t)).toContain('8100');
expect(say(busy, t)).not.toBe(say(busy, en));
// A code this shell does not know yet: the host's sentence, not nothing.
const newer = { code: 'from_the_future', params: {}, text: 'A newer host speaks.' };
expect(say(newer, t)).toBe('A newer host speaks.');
expect(noticeOf('boom').text).toBe('boom');
expect(noticeOf(busy)).toBe(busy);
});
});
describe('short code (#19)', () => {
+21 -1
View File
@@ -1,6 +1,7 @@
import type { Translate } from '../../../viewer/src/lib/i18n';
import type { HostState } from '../bindings/HostState';
import type { Label } from '../bindings/Label';
import type { Notice } from '../bindings/Notice';
import type { SettingsOutcome } from '../bindings/SettingsOutcome';
import type { SourceChoice } from '../bindings/SourceChoice';
import type { SourceOption } from '../bindings/SourceOption';
@@ -141,10 +142,29 @@ export function duration(sinceMs: number, nowMs: number): string {
return `${hours} h ${String(minutes % 60).padStart(2, '0')}`;
}
/**
* A text produced by the host, in the interface language (#75): the code is
* looked up under `host`, the English sentence of the host stands in for a
* code this shell does not know yet.
*/
export function say(notice: Notice, t: Translate): string {
return t(`host.${notice.code}`, notice.params) || notice.text;
}
/** Turns any failure into a notice: a command rejects with one, or with anything else. */
export function noticeOf(error: unknown): Notice {
if (error && typeof error === 'object' && 'code' in error && 'text' in error) {
return error as Notice;
}
return { code: '', params: {}, text: String(error) };
}
/** What is said after saving settings. */
export function outcomeSummary(outcome: SettingsOutcome, t: Translate): string {
if (outcome.next_share.length > 0) {
return t('settingsPending', { fields: outcome.next_share.join('; ') });
return t('settingsPending', {
fields: outcome.next_share.map((n) => say(n, t)).join('; '),
});
}
if (outcome.immediate.length > 0) {
return t('settingsApplied');
+66 -28
View File
@@ -14,6 +14,7 @@ use rs_codec::{EncodeConfig, IvfFile, LiveSource, SharedPlayback, VideoCodec, Vp
use rs_platform::PortalInfo;
use rs_proto::{SourceId, SourceKind, StreamSettings};
use rs_signaling::SharedMediaSource;
use rs_store::Notice;
use crate::state::{Label, SharedSource, SourceChoice};
@@ -41,8 +42,60 @@ pub enum StartCaptureError {
Encoder(#[from] rs_codec::EncodeError),
#[error("test pattern: {0}")]
Playback(String),
#[error("{0}")]
Rejected(String),
#[error("{width}x{height} test pattern: too small")]
PatternTooSmall { width: u32, height: u32 },
#[error(
"this binary is built without PipeWire: Wayland capture needs the `pipewire` feature \
(see ADR 0009)"
)]
NoPipewire,
#[error("source {0} not found: see --list")]
SourceNotFound(String),
#[error("X11 only exists on Linux")]
NoX11,
#[error(
"this desktop's portal cannot create a virtual screen (no VIRTUAL type in \
AvailableSourceTypes): share an existing screen"
)]
NoVirtualDisplay,
#[error(
"this desktop's portal can only share an entire screen (no WINDOW type in \
AvailableSourceTypes)"
)]
NoWindow,
#[error("capture task: {0}")]
Task(String),
}
impl StartCaptureError {
/// The error as the interface translates it (#75). The system's own words
/// travel as `detail`.
pub fn notice(&self) -> Notice {
use rs_platform::PortalError;
let text = self.to_string();
match self {
Self::Capture(e) => Notice::new("capture_failed", text).with("detail", e),
Self::Portal(PortalError::Denied(_)) => Notice::new("portal_denied", text),
Self::Portal(PortalError::Timeout) => Notice::new("portal_timeout", text),
Self::Portal(PortalError::Bus(e) | PortalError::Unreachable(e)) => {
Notice::new("portal_unreachable", text).with("detail", e)
}
Self::Portal(PortalError::Response(e) | PortalError::NoStream(e)) => {
Notice::new("portal_failed", text).with("detail", e)
}
Self::Encoder(e) => Notice::new("encoder_failed", text).with("detail", e),
Self::Playback(e) => Notice::new("playback_failed", text).with("detail", e),
Self::PatternTooSmall { width, height } => Notice::new("pattern_too_small", text)
.with("width", width)
.with("height", height),
Self::NoPipewire => Notice::new("no_pipewire", text),
Self::SourceNotFound(id) => Notice::new("source_not_found", text).with("id", id),
Self::NoX11 => Notice::new("no_x11", text),
Self::NoVirtualDisplay => Notice::new("no_virtual_display", text),
Self::NoWindow => Notice::new("no_window", text),
Self::Task(e) => Notice::new("capture_failed", text).with("detail", e),
}
}
}
/// Opens the chosen source. The blocking steps (X11, PipeWire, reading a
@@ -63,9 +116,10 @@ pub async fn start(
SourceChoice::Synthetic { width, height } => {
let (w, h) = rs_capture::pixels::even((*width, *height));
if w < 16 || h < 16 {
return Err(StartCaptureError::Rejected(format!(
"{width}x{height} test pattern: too small"
)));
return Err(StartCaptureError::PatternTooSmall {
width: *width,
height: *height,
});
}
let capturer = SyntheticCapturer::new(w, h, fps);
let source = SharedSource {
@@ -132,11 +186,7 @@ pub async fn start(
#[cfg(not(feature = "pipewire"))]
{
let _ = (virtual_display, window, size, codec);
Err(StartCaptureError::Rejected(
"this binary is built without PipeWire: Wayland capture needs the \
`pipewire` feature (see ADR 0009)"
.into(),
))
Err(StartCaptureError::NoPipewire)
}
}
}
@@ -155,9 +205,7 @@ async fn x11(
let wanted = sources
.iter()
.find(|s| s.id.0 == id || s.id.0.ends_with(id.as_str()))
.ok_or_else(|| {
StartCaptureError::Rejected(format!("source {id} not found: see --list"))
})?;
.ok_or_else(|| StartCaptureError::SourceNotFound(id.clone()))?;
let size = rs_capture::pixels::even((wanted.width, wanted.height));
tracing::info!(
event = "x11_capture",
@@ -189,7 +237,7 @@ async fn x11(
spawn_live(capturer, size, &settings, codec, &id, source)
})
.await
.map_err(|e| StartCaptureError::Rejected(e.to_string()))?
.map_err(|e| StartCaptureError::Task(e.to_string()))?
}
#[cfg(not(target_os = "linux"))]
@@ -198,9 +246,7 @@ async fn x11(
_: &StreamSettings,
_: VideoCodec,
) -> Result<StartedCapture, StartCaptureError> {
Err(StartCaptureError::Rejected(
"X11 only exists on Linux".into(),
))
Err(StartCaptureError::NoX11)
}
/// Starts a capture and its encoder in the dedicated thread.
@@ -281,18 +327,10 @@ async fn portal_pipewire(
use rs_platform::SourceType;
if virtual_display && !portal.is_some_and(PortalInfo::supports_virtual_display) {
return Err(StartCaptureError::Rejected(
"this desktop's portal cannot create a virtual screen (no VIRTUAL type in \
AvailableSourceTypes): share an existing screen"
.into(),
));
return Err(StartCaptureError::NoVirtualDisplay);
}
if window && !portal.is_some_and(PortalInfo::supports_window) {
return Err(StartCaptureError::Rejected(
"this desktop's portal can only share an entire screen (no WINDOW type in \
AvailableSourceTypes)"
.into(),
));
return Err(StartCaptureError::NoWindow);
}
let source_type = if virtual_display {
SourceType::Virtual
@@ -341,7 +379,7 @@ async fn portal_pipewire(
Ok::<_, rs_capture::CaptureError>((capturer, size))
})
.await
.map_err(|e| StartCaptureError::Rejected(e.to_string()))??;
.map_err(|e| StartCaptureError::Task(e.to_string()))??;
let revocation = capturer.revocation();
tokio::spawn(async move {
+189 -87
View File
@@ -19,7 +19,7 @@ use rs_codec::{LiveSource, SharedMedia};
use rs_platform::{Environment, Inhibition, PortalInfo, SessionType};
use rs_proto::StreamSettings;
use rs_signaling::{HostConfig, Room, ServerError, TlsMaterial};
use rs_store::{Origin, Rejection, Settings, Store, TrustedDevice};
use rs_store::{Notice, Origin, Rejection, Settings, Store, TrustedDevice};
use tokio::sync::{oneshot, watch};
use tokio::task::JoinHandle;
@@ -37,7 +37,9 @@ const WATCH_INTERVAL: Duration = Duration::from_secs(1);
const SERVER_STOP_TIMEOUT: Duration = Duration::from_secs(3);
/// Prefix of the warning about a disconnected interface, cleared when it
/// comes back.
const INTERFACE_WARNING: &str = "The interface ";
/// Code of the warning that the chosen interface is down: it goes away when
/// the interface comes back.
const INTERFACE_DOWN: &str = "interface_down";
/// What the caller sets once and for all.
pub struct Config {
@@ -94,12 +96,12 @@ const AFTER_SLEEP: Duration = Duration::from_secs(30);
#[derive(Default)]
struct Base {
phase: Option<Phase>,
error: Option<String>,
error: Option<Notice>,
stop: Option<Stop>,
warnings: Vec<String>,
warnings: Vec<Notice>,
sleep_inhibited: Vec<String>,
pending_settings: Vec<String>,
settings_recovered: Option<String>,
pending_settings: Vec<Notice>,
settings_recovered: Option<Notice>,
}
struct View {
@@ -172,12 +174,21 @@ impl Host {
let (settings, origin) = store.load();
if let Origin::Recovered { backup, reason } = origin {
base.settings_recovered = Some(match backup {
Some(path) => format!(
"Unreadable settings ({reason}): the old file is kept in {}, \
safe values are restored.",
path.display()
),
None => format!("Unreadable settings ({reason}): safe values restored."),
Some(path) => Notice::new(
"settings_recovered",
format!(
"Unreadable settings ({reason}): the old file is kept in {}, \
safe values are restored.",
path.display()
),
)
.with("detail", &reason)
.with("backup", path.display()),
None => Notice::new(
"settings_reset",
format!("Unreadable settings ({reason}): safe values restored."),
)
.with("detail", &reason),
});
}
settings
@@ -284,11 +295,14 @@ impl Host {
lock(&self.0.context).clone()
}
/// Starts a share. Returns the error to display, as is.
pub async fn start(&self, choice: SourceChoice) -> Result<(), String> {
/// Starts a share. The error is also in the state, for the interface.
pub async fn start(&self, choice: SourceChoice) -> Result<(), Notice> {
let mut active = self.0.active.lock().await;
if active.is_some() {
return Err("a share is already running: stop it first".into());
return Err(Notice::new(
"share_running",
"a share is already running: stop it first",
));
}
let (cancel, cancelled) = oneshot::channel();
*lock(&self.0.cancel) = Some(cancel);
@@ -302,7 +316,7 @@ impl Host {
let result = tokio::select! {
result = self.open(choice) => result,
_ = cancelled => Err("start cancelled".to_string()),
_ = cancelled => Err(Notice::new("start_cancelled", "start cancelled")),
};
lock(&self.0.cancel).take();
@@ -344,14 +358,14 @@ impl Host {
/// Trusts the device on this connection (#34): its public key is saved
/// with its name, and it comes back without a link from now on, to this
/// share and the next ones.
pub async fn trust_device(&self, connection: u64) -> Result<(), String> {
pub async fn trust_device(&self, connection: u64) -> Result<(), Notice> {
let room = lock(&self.0.view).as_ref().map(|v| v.room.clone());
let device = room
.and_then(|room| room.device(connection))
.ok_or_else(|| "this viewer is no longer connected".to_string())?;
.ok_or_else(|| Notice::new("viewer_gone", "this viewer is no longer connected"))?;
let key = device
.key
.ok_or_else(|| "this browser cannot remember a key".to_string())?;
.ok_or_else(|| Notice::new("no_device_key", "this browser cannot remember a key"))?;
let mut settings = self.settings();
settings
.trusted_devices
@@ -370,7 +384,7 @@ impl Host {
/// Stops trusting a key. A device connected with it is sent away at once
/// (#34); one connected by a link stays until it leaves.
pub async fn revoke_device(&self, key: &str) -> Result<(), String> {
pub async fn revoke_device(&self, key: &str) -> Result<(), Notice> {
let mut settings = self.settings();
let before = settings.trusted_devices.len();
settings.trusted_devices.retain(|t| t.key != key);
@@ -403,10 +417,13 @@ impl Host {
let mut rejections = new.validate();
let old = self.settings();
if new.autostart != old.autostart && self.0.config.autostart.is_none() {
rejections.push(Rejection {
field: "autostart".into(),
message: "can only be set from the desktop application".into(),
});
rejections.push(Rejection::new(
"autostart",
Notice::new(
"autostart_desktop_only",
"can only be set from the desktop application",
),
));
}
if !rejections.is_empty() {
return Err(rejections);
@@ -415,16 +432,14 @@ impl Host {
&& new.autostart != old.autostart
{
let result = rs_platform::autostart::directory()
.ok_or_else(|| "configuration directory not found".to_string())
.ok_or_else(|| Notice::new("no_config_dir", "configuration directory not found"))
.and_then(|dir| {
rs_platform::autostart::set(&dir, new.autostart, executable, arguments)
.map_err(|e| e.to_string())
rs_platform::autostart::set(&dir, new.autostart, executable, arguments).map_err(
|e| Notice::new("autostart_failed", e.to_string()).with("detail", e),
)
});
if let Err(message) = result {
return Err(vec![Rejection {
field: "autostart".into(),
message,
}]);
return Err(vec![Rejection::new("autostart", message)]);
}
}
if let Some(store) = &self.0.config.store
@@ -432,22 +447,26 @@ impl Host {
{
return Err(match error {
rs_store::StoreError::Rejected(rejections) => rejections,
other => vec![Rejection {
field: "file".into(),
message: other.to_string(),
}],
other => vec![Rejection::new(
"file",
Notice::new("settings_not_saved", other.to_string()).with("detail", &other),
)],
});
}
*lock(&self.0.settings) = new.clone();
let room = lock(&self.0.view).as_ref().map(|v| v.room.clone());
let mut outcome = SettingsOutcome::default();
let mut change = |field: &str, changed: bool, waits: Option<&str>| {
// `waits`: the code and English text of why the field waits for the
// next share, if a share is running.
let mut change = |field: &str, changed: bool, waits: Option<(&str, &str)>| {
if !changed {
return;
}
match (waits, &room) {
(Some(reason), Some(_)) => outcome.next_share.push(format!("{field}: {reason}")),
(Some((code, reason)), Some(_)) => outcome
.next_share
.push(Notice::new(code, format!("{field}: {reason}")).with("field", field)),
_ => outcome.immediate.push(field.to_string()),
}
};
@@ -455,27 +474,39 @@ impl Host {
change(
"port",
new.port != old.port,
Some("changing the port would cut viewers off"),
Some(("pending_port", "changing the port would cut viewers off")),
);
change(
"interface",
new.interface != old.interface,
Some("changing the interface would cut viewers off"),
Some((
"pending_interface",
"changing the interface would cut viewers off",
)),
);
change(
"codec",
new.codec != old.codec,
Some("connected viewers negotiated the codec of the current share"),
Some((
"pending_codec",
"connected viewers negotiated the codec of the current share",
)),
);
change(
"quality",
new.quality != old.quality,
Some("the encoder keeps the quality of the current share"),
Some((
"pending_quality",
"the encoder keeps the quality of the current share",
)),
);
change(
"code_validity_min",
new.code_validity_min != old.code_validity_min,
Some("the displayed code keeps its expiry, the next one takes the new duration"),
Some((
"pending_code_validity",
"the displayed code keeps its expiry, the next one takes the new duration",
)),
);
change("limit", new.limit != old.limit, None);
change("theme", new.theme != old.theme, None);
@@ -530,7 +561,7 @@ impl Host {
// -- Start and stop ---------------------------------------------------------
async fn open(&self, choice: SourceChoice) -> Result<Active, String> {
async fn open(&self, choice: SourceChoice) -> Result<Active, Notice> {
let settings = self.settings();
let overrides = self.0.config.overrides;
let stream_settings = StreamSettings::for_preset(settings.quality);
@@ -544,13 +575,15 @@ impl Host {
// The port first: a busy port must be reported before the desktop asks
// for permission to share the screen.
let ip = listen_address(settings.interface.as_deref())?;
let listener =
rs_signaling::bind_listener(SocketAddr::new(ip, port)).map_err(|e| e.to_string())?;
let listen = listener.local_addr().map_err(|e| e.to_string())?;
let listener = rs_signaling::bind_listener(SocketAddr::new(ip, port))
.map_err(|e| server_notice(&e))?;
let listen = listener
.local_addr()
.map_err(|e| server_notice(&ServerError::Io(e)))?;
let started = capture::start(&choice, &stream_settings, codec, self.0.portal.as_ref())
.await
.map_err(|e| e.to_string())?;
.map_err(|e| e.notice())?;
let StartedCapture {
media,
live,
@@ -569,7 +602,8 @@ impl Host {
"rustscreen.local".to_string(),
"127.0.0.1".to_string(),
];
let material = TlsMaterial::load_or_create(&dir, &names).map_err(|e| e.to_string())?;
let material = TlsMaterial::load_or_create(&dir, &names)
.map_err(|e| Notice::new("tls_failed", e.to_string()).with("detail", e))?;
tracing::info!(fingerprint = %material.fingerprint_pairs(), "certificate ready");
Some(material)
} else {
@@ -718,7 +752,14 @@ impl Host {
let listener = match rs_signaling::bind_listener(SocketAddr::new(new, old.port())) {
Ok(listener) => listener,
Err(error) => {
self.warn(format!("New address {new} unusable: {error}"));
self.warn(
Notice::new(
"address_unusable",
format!("New address {new} unusable: {error}"),
)
.with("address", new)
.with("detail", server_notice(&error)),
);
return;
}
};
@@ -745,11 +786,18 @@ impl Host {
"server restarted on the new address"
);
self.update_base(|b| {
b.warnings.retain(|w| !w.starts_with(INTERFACE_WARNING));
b.warnings.push(format!(
"Address changed ({} became {new}): have viewers scan the new QR code.",
old.ip()
));
b.warnings.retain(|w| w.code != INTERFACE_DOWN);
b.warnings.push(
Notice::new(
"address_moved",
format!(
"Address changed ({} became {new}): have viewers scan the new QR code.",
old.ip()
),
)
.with("before", old.ip())
.with("after", new),
);
});
}
@@ -757,14 +805,18 @@ impl Host {
/// (#26): viewers keep their connection, their token and their full
/// screen, and get the new picture at the next keyframe. If the new source
/// cannot be opened (portal refused), the current one stays shared.
pub async fn switch_source(&self, choice: SourceChoice) -> Result<(), String> {
pub async fn switch_source(&self, choice: SourceChoice) -> Result<(), Notice> {
let source = match self.replace_capture(Some(choice)).await {
Ok(source) => source,
Err(error) => {
tracing::warn!(event = "source_switch_failed", %error, "source not switched");
self.warn(format!(
"Source not switched, the previous one is still shared: {error}"
));
self.warn(
Notice::new(
"source_not_switched",
format!("Source not switched, the previous one is still shared: {error}"),
)
.with("detail", &error),
);
return Err(error);
}
};
@@ -783,7 +835,7 @@ impl Host {
/// Restarts the capture of a share whose source stopped during sleep,
/// without changing room: viewers resume on their own.
async fn restart_capture(&self) -> Result<(), String> {
async fn restart_capture(&self) -> Result<(), Notice> {
if self.replace_capture(None).await?.is_some() {
tracing::info!(
event = "capture_restarted",
@@ -799,7 +851,7 @@ impl Host {
async fn replace_capture(
&self,
choice: Option<SourceChoice>,
) -> Result<Option<SharedSource>, String> {
) -> Result<Option<SharedSource>, Notice> {
let mut active = self.0.active.lock().await;
let Some(opened) = active.as_mut() else {
return Ok(None);
@@ -813,7 +865,7 @@ impl Host {
self.0.portal.as_ref(),
)
.await
.map_err(|e| e.to_string())?;
.map_err(|e| e.notice())?;
let old_media = opened.media.replace(started.media);
let old_live = std::mem::replace(&mut opened.live, started.live.clone());
let old_portal = std::mem::replace(&mut opened.portal, started.portal);
@@ -849,7 +901,7 @@ impl Host {
self.refresh();
}
fn warn(&self, message: String) {
fn warn(&self, message: Notice) {
self.update_base(|b| {
if !b.warnings.contains(&message) {
b.warnings.push(message);
@@ -1019,19 +1071,27 @@ fn empty_state(
}
/// The listen address: the one of the chosen interface, or all of them.
fn listen_address(interface: Option<&str>) -> Result<IpAddr, String> {
fn listen_address(interface: Option<&str>) -> Result<IpAddr, Notice> {
let Some(name) = interface else {
return Ok(Ipv4Addr::UNSPECIFIED.into());
};
let found = rs_platform::network::interface(name).ok_or_else(|| {
format!(
"the interface {name} has no address: plug it in, or choose \"all interfaces\" \
in the settings"
Notice::new(
"interface_missing",
format!(
"the interface {name} has no address: plug it in, or choose \"all interfaces\" \
in the settings"
),
)
.with("name", name)
})?;
found
.primary_address()
.ok_or_else(|| format!("the interface {name} has no address reachable by another device"))
found.primary_address().ok_or_else(|| {
Notice::new(
"interface_unreachable",
format!("the interface {name} has no address reachable by another device"),
)
.with("name", name)
})
}
async fn close(opened: Active) {
@@ -1127,9 +1187,11 @@ async fn watch_share(weak: Weak<Inner>, mut changes: watch::Receiver<u64>) {
Err(error) => {
tokio::spawn(async move {
host.stop_with(Some(Stop {
reason: format!(
"capture could not be restarted after sleep: {error}"
),
reason: Notice::new(
"capture_not_restarted",
format!("capture could not be restarted after sleep: {error}"),
)
.with("detail", &error),
by_desktop: false,
}))
.await;
@@ -1141,7 +1203,8 @@ async fn watch_share(weak: Weak<Inner>, mut changes: watch::Receiver<u64>) {
// Stopping aborts this task: it runs in its own.
tokio::spawn(async move {
host.stop_with(Some(Stop {
reason: format!("capture ended: {cause}"),
reason: Notice::new("capture_ended", format!("capture ended: {cause}"))
.with("detail", &cause),
by_desktop: true,
}))
.await;
@@ -1152,7 +1215,7 @@ async fn watch_share(weak: Weak<Inner>, mut changes: watch::Receiver<u64>) {
match interface {
Some(name) => match rs_platform::network::interface(&name) {
Some(found) if found.active => {
host.update_base(|b| b.warnings.retain(|w| !w.starts_with(INTERFACE_WARNING)));
host.update_base(|b| b.warnings.retain(|w| w.code != INTERFACE_DOWN));
if let Some(new) = found.primary_address()
&& new != listen.ip()
{
@@ -1160,10 +1223,16 @@ async fn watch_share(weak: Weak<Inner>, mut changes: watch::Receiver<u64>) {
tokio::spawn(async move { host.readdress(new).await });
}
}
_ => host.warn(format!(
"{INTERFACE_WARNING}{name} is disconnected: viewers can no longer reach \
the host."
)),
_ => host.warn(
Notice::new(
INTERFACE_DOWN,
format!(
"The interface {name} is disconnected: viewers can no longer reach \
the host."
),
)
.with("name", &name),
),
},
None => {
let current = rs_rtc::local_candidate_address();
@@ -1175,9 +1244,16 @@ async fn watch_share(weak: Weak<Inner>, mut changes: watch::Receiver<u64>) {
"network address changed"
);
if let (Some(_), Some(after)) = (default_address, current) {
host.warn(format!(
"Network address changed ({after}): have viewers scan the new QR code."
));
host.warn(
Notice::new(
"address_changed",
format!(
"Network address changed ({after}): have viewers scan the \
new QR code."
),
)
.with("after", after),
);
}
default_address = current;
}
@@ -1240,12 +1316,38 @@ fn trusted_keys(settings: &Settings) -> Vec<rs_signaling::TrustedKey> {
.collect()
}
fn joined(rejections: &[Rejection]) -> String {
rejections
.iter()
.map(ToString::to_string)
.collect::<Vec<_>>()
.join("; ")
/// The first refusal: the one to fix first, already worded for the interface.
fn joined(rejections: &[Rejection]) -> Notice {
rejections.first().map_or_else(
|| Notice::new("settings_not_saved", "settings not saved"),
|r| r.message.clone(),
)
}
/// A server error as the interface translates it (#75): the port in use comes
/// with the free one to suggest.
fn server_notice(error: &ServerError) -> Notice {
let text = error.to_string();
match error {
ServerError::PortInUse {
port,
free: Some(free),
} => Notice::new("port_in_use_free", text)
.with("port", port)
.with("free", free),
ServerError::PortInUse { port, free: None } => {
Notice::new("port_in_use", text).with("port", port)
}
ServerError::PortForbidden { port } => {
Notice::new("port_forbidden", text).with("port", port)
}
ServerError::AddressUnavailable { address } => {
Notice::new("address_unavailable", text).with("address", address)
}
ServerError::Tls(detail) => Notice::new("tls_failed", text).with("detail", detail),
ServerError::Serve(detail) => Notice::new("server_failed", text).with("detail", detail),
ServerError::Io(detail) => Notice::new("server_failed", text).with("detail", detail),
}
}
fn validity(minutes: u32) -> Option<Duration> {
+10 -8
View File
@@ -8,6 +8,7 @@
//! rewritten by hand (AGENTS.md).
use rs_proto::SourceKind;
use rs_store::Notice;
use serde::{Deserialize, Serialize};
use ts_rs::TS;
@@ -226,7 +227,7 @@ pub struct LocalNameInfo {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, TS)]
#[ts(export, export_to = "../../../desktop/src/bindings/")]
pub struct Stop {
pub reason: String,
pub reason: Notice,
/// Stopped from the desktop ("stop sharing" button, screen unplugged):
/// the command line then exits with code 3.
pub by_desktop: bool,
@@ -238,19 +239,19 @@ pub struct Stop {
pub struct HostState {
pub phase: Phase,
pub share: Option<Share>,
/// Failure of the last start, to display as is.
pub error: Option<String>,
/// Failure of the last start, translated by the interface (#75).
pub error: Option<Notice>,
pub stop: Option<Stop>,
/// What still works but deserves to be known (interface down, address
/// changed).
pub warnings: Vec<String>,
pub warnings: Vec<Notice>,
/// Sleep inhibition mechanisms held (`login1`, `screensaver`): empty
/// outside a share, or if none could be taken.
pub sleep_inhibited: Vec<String>,
/// Settings changed during the share, applied to the next one.
pub pending_settings: Vec<String>,
pub pending_settings: Vec<Notice>,
/// The settings file was unusable at startup: what was done about it.
pub settings_recovered: Option<String>,
pub settings_recovered: Option<Notice>,
/// Capabilities of this machine, to offer only what works.
pub capabilities: Capabilities,
}
@@ -275,8 +276,9 @@ pub struct Capabilities {
pub struct SettingsOutcome {
/// Fields applied right away.
pub immediate: Vec<String>,
/// Fields waiting for the next share, with the reason.
pub next_share: Vec<String>,
/// Fields waiting for the next share, with the reason; `field` in the
/// parameters names the field.
pub next_share: Vec<Notice>,
}
/// A network interface offered in the settings.
+9 -4
View File
@@ -365,11 +365,15 @@ async fn a_busy_port_is_named_with_a_free_one_and_nothing_starts() {
let port = busy.local_addr().unwrap().port();
let (host, _dir) = host("port", port).await;
let error = host.start(test_pattern()).await.unwrap_err();
assert!(error.contains(&port.to_string()), "{error}");
assert!(error.contains("is free"), "{error}");
assert!(error.text.contains(&port.to_string()), "{error}");
assert!(error.text.contains("is free"), "{error}");
// What the interface translates (#75): a code, the port, the free one.
assert_eq!(error.code, "port_in_use_free", "{error:?}");
assert_eq!(error.params["port"], port.to_string());
assert!(error.params["free"].parse::<u16>().is_ok(), "{error:?}");
let state = host.state();
assert_eq!(state.phase, Phase::Stopped);
assert_eq!(state.error.as_deref(), Some(error.as_str()));
assert_eq!(state.error, Some(error));
}
#[tokio::test(flavor = "multi_thread")]
@@ -382,7 +386,8 @@ async fn settings_say_what_applies_now_and_what_waits() {
let outcome = host.update_settings(settings.clone()).await.unwrap();
assert_eq!(outcome.immediate, ["limit"]);
assert_eq!(outcome.next_share.len(), 1);
assert!(outcome.next_share[0].starts_with("port"));
assert_eq!(outcome.next_share[0].code, "pending_port");
assert_eq!(outcome.next_share[0].params["field"], "port");
assert_eq!(host.state().share.unwrap().limit, 2);
assert_eq!(host.state().pending_settings.len(), 1);
// Saved on disk, read back at the next launch.
+72
View File
@@ -0,0 +1,72 @@
//! Every text the host produces has its translation (#75).
//!
//! The host hands the desktop codes (`Notice`), not sentences: a code without
//! an entry under `desktop.host` would show the English fallback in every
//! language. This test reads the sources for the codes and checks each
//! catalog of `locales/` has them, so that adding a message without its
//! translation fails here rather than on a user's screen.
use std::collections::BTreeSet;
use std::path::Path;
/// The string literal right after `marker`, skipping whitespace.
fn literals_after(source: &str, marker: &str) -> Vec<String> {
source
.match_indices(marker)
.filter_map(|(at, _)| {
let rest = source[at + marker.len()..].trim_start();
let rest = rest.strip_prefix('"')?;
let end = rest.find('"')?;
let code = &rest[..end];
code.bytes()
.all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'_')
.then(|| code.to_string())
})
.collect()
}
fn sources(dir: &Path, found: &mut Vec<String>) {
for entry in std::fs::read_dir(dir).unwrap().flatten() {
let path = entry.path();
if path.is_dir() {
sources(&path, found);
} else if path.extension().is_some_and(|e| e == "rs") {
found.push(std::fs::read_to_string(path).unwrap());
}
}
}
#[test]
fn every_host_code_is_translated() {
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
let mut texts = Vec::new();
for krate in ["rs-session", "rs-store"] {
sources(&root.join("crates").join(krate).join("src"), &mut texts);
}
let mut codes = BTreeSet::new();
for text in &texts {
// `Notice::new("code", ...)`, the pending reasons `Some(("code", ...))`
// and the constant of the interface warning.
for marker in ["Notice::new(", "Some((", "INTERFACE_DOWN: &str ="] {
codes.extend(literals_after(text, marker));
}
}
assert!(codes.contains("port_in_use_free"), "{codes:?}");
assert!(codes.contains("pending_port"), "{codes:?}");
assert!(codes.contains("interface_down"), "{codes:?}");
for language in ["en", "fr"] {
let file = root.join("locales").join(format!("{language}.json"));
let catalog: serde_json::Value =
serde_json::from_str(&std::fs::read_to_string(&file).unwrap()).unwrap();
let host = &catalog["desktop"]["host"];
let missing: Vec<_> = codes
.iter()
.filter(|code| !host[code.as_str()].is_string())
.collect();
assert!(
missing.is_empty(),
"{language}.json misses desktop.host.{missing:?}"
);
}
}
+35 -14
View File
@@ -27,6 +27,9 @@ use rs_proto::{DeviceId, QualityPreset};
use serde::{Deserialize, Serialize};
use ts_rs::TS;
mod notice;
pub use notice::Notice;
/// Format version. A field added with a default value does not change it; a
/// field whose meaning changes does.
pub const VERSION: u32 = 1;
@@ -189,14 +192,14 @@ impl Default for Settings {
#[ts(export, export_to = "../../../desktop/src/bindings/")]
pub struct Rejection {
pub field: String,
pub message: String,
pub message: Notice,
}
impl Rejection {
fn new(field: &str, message: impl Into<String>) -> Self {
pub fn new(field: &str, message: Notice) -> Self {
Self {
field: field.to_string(),
message: message.into(),
message,
}
}
}
@@ -214,10 +217,15 @@ impl Settings {
if self.port < MIN_PORT {
rejections.push(Rejection::new(
"port",
format!(
"{} is a privileged port: choose between {MIN_PORT} and 65535",
self.port
),
Notice::new(
"port_privileged",
format!(
"{} is a privileged port: choose between {MIN_PORT} and 65535",
self.port
),
)
.with("port", self.port)
.with("min", MIN_PORT),
));
}
if let Some(name) = &self.interface
@@ -230,19 +238,28 @@ impl Settings {
{
rejections.push(Rejection::new(
"language",
format!("\"{code}\" is not a language code (fr, en, pt-BR)"),
Notice::new(
"language_invalid",
format!("\"{code}\" is not a language code (fr, en, pt-BR)"),
)
.with("code", code),
));
}
if self.limit == 0 || self.limit > MAX_LIMIT {
rejections.push(Rejection::new(
"limit",
format!("between 1 and {MAX_LIMIT} viewers"),
Notice::new("limit_range", format!("between 1 and {MAX_LIMIT} viewers"))
.with("max", MAX_LIMIT),
));
}
if self.code_validity_min > MAX_CODE_VALIDITY_MIN {
rejections.push(Rejection::new(
"code_validity_min",
format!("at most {MAX_CODE_VALIDITY_MIN} minutes (one day), or 0 for no limit"),
Notice::new(
"code_validity_range",
format!("at most {MAX_CODE_VALIDITY_MIN} minutes (one day), or 0 for no limit"),
)
.with("max", MAX_CODE_VALIDITY_MIN),
));
}
if self
@@ -252,7 +269,7 @@ impl Settings {
{
rejections.push(Rejection::new(
"trusted_devices",
"a device without an identifier",
Notice::new("trusted_device_invalid", "a device without an identifier"),
));
}
rejections
@@ -290,12 +307,16 @@ fn is_language_code(code: &str) -> bool {
/// An interface name as the kernel accepts them: at most 15 bytes, without
/// space or slash.
fn validate_interface(name: &str) -> Result<(), String> {
fn validate_interface(name: &str) -> Result<(), Notice> {
if name.is_empty() {
return Err("empty interface name".into());
return Err(Notice::new("interface_empty", "empty interface name"));
}
if name.len() > 15 || name.contains(['/', ' ', '\t', '\n']) {
return Err(format!("\"{name}\" is not an interface name"));
return Err(Notice::new(
"interface_invalid",
format!("\"{name}\" is not an interface name"),
)
.with("name", name));
}
Ok(())
}
+62
View File
@@ -0,0 +1,62 @@
//! A text produced by the host, that the interface translates (#75).
//!
//! The host used to hand the desktop finished English sentences ("port 8099
//! is already used by another program: port 8100 is free"), shown as is
//! whatever the interface language. A [`Notice`] carries a code and its
//! values instead; the desktop finds `desktop.host.<code>` in `locales/` and
//! fills it in. The English text travels along: the command line prints it,
//! and a desktop older than the host, which does not know the code yet, shows
//! it rather than nothing.
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use ts_rs::TS;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, TS)]
#[ts(export, export_to = "../../../desktop/src/bindings/")]
pub struct Notice {
/// Key under `desktop.host` in `locales/`, snake case (`port_in_use`).
pub code: String,
/// Values of the placeholders: numbers, interface names, paths, and the
/// system's own words (`detail`), which no catalog can translate.
pub params: BTreeMap<String, String>,
/// The English sentence, for the command line and unknown codes.
pub text: String,
}
impl Notice {
pub fn new(code: &str, text: impl Into<String>) -> Self {
Self {
code: code.to_string(),
params: BTreeMap::new(),
text: text.into(),
}
}
/// Adds a placeholder value.
pub fn with(mut self, name: &str, value: impl ToString) -> Self {
self.params.insert(name.to_string(), value.to_string());
self
}
}
impl std::fmt::Display for Notice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.text)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn a_notice_reads_in_english_and_carries_its_values() {
let notice = Notice::new("port_in_use", "port 8099 is already used").with("port", 8099);
assert_eq!(notice.to_string(), "port 8099 is already used");
assert_eq!(notice.params["port"], "8099");
let json = serde_json::to_string(&notice).unwrap();
assert!(json.contains(r#""code":"port_in_use""#), "{json}");
}
}
+52
View File
@@ -227,6 +227,58 @@
"resume": "Resume the last share",
"stop": "Stop sharing",
"quit": "Quit"
},
"host": {
"port_privileged": "{port} is a privileged port: choose between {min} and 65535.",
"language_invalid": "\"{code}\" is not a language code (fr, en, pt-BR).",
"limit_range": "Between 1 and {max} viewers.",
"code_validity_range": "At most {max} minutes (one day), or 0 for no limit.",
"trusted_device_invalid": "A trusted device has no identifier.",
"interface_empty": "The interface name is empty.",
"interface_invalid": "\"{name}\" is not an interface name.",
"settings_recovered": "The settings could not be read ({detail}): the old file is kept in {backup}, safe values are restored.",
"settings_reset": "The settings could not be read ({detail}): safe values are restored.",
"settings_not_saved": "The settings could not be saved: {detail}",
"share_running": "A share is already running: stop it first.",
"start_cancelled": "Start cancelled.",
"viewer_gone": "This viewer is no longer connected.",
"no_device_key": "This browser cannot remember a key: it will come back through the QR code.",
"autostart_desktop_only": "Can only be set from the desktop application.",
"no_config_dir": "The configuration folder was not found.",
"autostart_failed": "Autostart could not be changed: {detail}",
"pending_port": "port: changing it would cut viewers off",
"pending_interface": "interface: changing it would cut viewers off",
"pending_codec": "codec: connected viewers negotiated the one of the current share",
"pending_quality": "quality: the encoder keeps the one of the current share",
"pending_code_validity": "code validity: the displayed code keeps its expiry, the next one takes the new duration",
"port_in_use": "Port {port} is already used by another program.",
"port_in_use_free": "Port {port} is already used by another program: port {free} is free.",
"port_forbidden": "Port {port} is reserved to the system: pick a port from 1024 to 65535.",
"address_unavailable": "Address {address} exists on no interface: interface disconnected or address changed.",
"server_failed": "The server could not start: {detail}",
"tls_failed": "The certificate is not usable: {detail}",
"interface_missing": "The interface {name} has no address: plug it in, or choose \"all interfaces\" in the settings.",
"interface_unreachable": "The interface {name} has no address reachable by another device.",
"interface_down": "The interface {name} is disconnected: viewers can no longer reach the host.",
"address_changed": "The network address changed ({after}): have viewers scan the new QR code.",
"address_moved": "The address changed ({before} became {after}): have viewers scan the new QR code.",
"address_unusable": "The new address {address} is unusable: {detail}",
"source_not_switched": "Source not switched, the previous one is still shared: {detail}",
"capture_ended": "The capture ended: {detail}",
"capture_not_restarted": "The capture could not be restarted after sleep: {detail}",
"capture_failed": "The capture failed: {detail}",
"portal_denied": "Sharing was refused in the desktop's dialog.",
"portal_timeout": "The desktop's sharing dialog did not answer in time.",
"portal_unreachable": "The desktop's sharing service cannot be reached: {detail}",
"portal_failed": "The desktop's sharing service answered unexpectedly: {detail}",
"encoder_failed": "The video encoder is unavailable: {detail}",
"playback_failed": "The test file cannot be read: {detail}",
"pattern_too_small": "A {width}×{height} test pattern is too small.",
"no_pipewire": "This build cannot capture under Wayland (no PipeWire support).",
"source_not_found": "Source {id} not found.",
"no_x11": "X11 capture only exists on Linux.",
"no_virtual_display": "This desktop cannot create a virtual screen: share an existing screen.",
"no_window": "This desktop can only share an entire screen."
}
}
}
+52
View File
@@ -227,6 +227,58 @@
"resume": "Reprendre le dernier partage",
"stop": "Arrêter le partage",
"quit": "Quitter"
},
"host": {
"port_privileged": "{port} est un port privilégié : choisissez entre {min} et 65535.",
"language_invalid": "« {code} » n'est pas un code de langue (fr, en, pt-BR).",
"limit_range": "Entre 1 et {max} spectateurs.",
"code_validity_range": "Au plus {max} minutes (un jour), ou 0 pour aucune limite.",
"trusted_device_invalid": "Un appareil de confiance n'a pas d'identifiant.",
"interface_empty": "Le nom d'interface est vide.",
"interface_invalid": "« {name} » n'est pas un nom d'interface.",
"settings_recovered": "Les réglages étaient illisibles ({detail}) : l'ancien fichier est gardé dans {backup}, des valeurs sûres sont rétablies.",
"settings_reset": "Les réglages étaient illisibles ({detail}) : des valeurs sûres sont rétablies.",
"settings_not_saved": "Les réglages n'ont pas pu être enregistrés : {detail}",
"share_running": "Un partage est déjà en cours : arrêtez-le d'abord.",
"start_cancelled": "Démarrage annulé.",
"viewer_gone": "Ce spectateur n'est plus connecté.",
"no_device_key": "Ce navigateur ne sait pas garder de clé : il reviendra par le QR code.",
"autostart_desktop_only": "Ne se règle que depuis l'application de bureau.",
"no_config_dir": "Le dossier de configuration est introuvable.",
"autostart_failed": "Le démarrage automatique n'a pas pu être changé : {detail}",
"pending_port": "port : le changer couperait les spectateurs",
"pending_interface": "interface : la changer couperait les spectateurs",
"pending_codec": "codec : les spectateurs connectés ont négocié celui du partage en cours",
"pending_quality": "qualité : l'encodeur garde celle du partage en cours",
"pending_code_validity": "validité du code : le code affiché garde son échéance, le suivant prendra la nouvelle durée",
"port_in_use": "Le port {port} est déjà utilisé par un autre programme.",
"port_in_use_free": "Le port {port} est déjà utilisé par un autre programme : le port {free} est libre.",
"port_forbidden": "Le port {port} est réservé au système : choisissez un port entre 1024 et 65535.",
"address_unavailable": "L'adresse {address} n'existe sur aucune interface : interface débranchée ou adresse changée.",
"server_failed": "Le serveur n'a pas pu démarrer : {detail}",
"tls_failed": "Le certificat est inutilisable : {detail}",
"interface_missing": "L'interface {name} n'a pas d'adresse : branchez-la, ou choisissez « toutes les interfaces » dans les réglages.",
"interface_unreachable": "L'interface {name} n'a aucune adresse joignable par un autre appareil.",
"interface_down": "L'interface {name} est déconnectée : les spectateurs ne peuvent plus joindre l'hôte.",
"address_changed": "L'adresse réseau a changé ({after}) : faites scanner le nouveau QR code.",
"address_moved": "L'adresse a changé ({before} est devenue {after}) : faites scanner le nouveau QR code.",
"address_unusable": "La nouvelle adresse {address} est inutilisable : {detail}",
"source_not_switched": "Source non changée, la précédente reste partagée : {detail}",
"capture_ended": "La capture s'est arrêtée : {detail}",
"capture_not_restarted": "La capture n'a pas pu reprendre après la veille : {detail}",
"capture_failed": "La capture a échoué : {detail}",
"portal_denied": "Le partage a été refusé dans la fenêtre du bureau.",
"portal_timeout": "La fenêtre de partage du bureau n'a pas répondu à temps.",
"portal_unreachable": "Le service de partage du bureau est injoignable : {detail}",
"portal_failed": "Le service de partage du bureau a répondu de façon inattendue : {detail}",
"encoder_failed": "L'encodeur vidéo est indisponible : {detail}",
"playback_failed": "Le fichier de test est illisible : {detail}",
"pattern_too_small": "Une mire de {width}×{height} est trop petite.",
"no_pipewire": "Cette version ne sait pas capturer sous Wayland (sans PipeWire).",
"source_not_found": "Source {id} introuvable.",
"no_x11": "La capture X11 n'existe que sous Linux.",
"no_virtual_display": "Ce bureau ne sait pas créer d'écran virtuel : partagez un écran existant.",
"no_window": "Ce bureau ne sait partager qu'un écran entier."
}
}
}