String packs: rich-text entries, language conditions and word rewriting; theme doctor report; translate-mode words
- Rich sentences (a link or button inside text) can be replaced by data: the inventory gives a rich entry `slots`, a pack value places the site's own elements with {e0}, {e1}, ... (each once, the last may be left out; no markup, plural or other parameters). The engine returns a pieces + element order template; the page inventory carries `rich` slot counts.
- Packs may carry `when: { languages }` (applies only while the site shows one of them; `en` matches `en-GB`) and `rewrite: { words }` (whole-word rewording of the site's own text, messages keep their parameters' values; no sentences of the site in the pack). The hook tells the engine the site's language; a rewording pack makes the delivery carry the whole inventory.
- Apps can ship built-in packs (BuiltInPacks) delivered before installed ones; syncStringPacks hands the tabs a delivery at start only when it changed.
- Translate mode words are a function the app supplies (asked at each draw) and gain a `plural` word; host validates `when` and `rewrite` envelopes.
- Theme doctor: every finding says where (token path or CSS rule), what and how to fix, as catalog keys wb.doctor.*; the Theme Builder shows the full report; the import hint is translated. Doctor words are in the 17 supported catalogs.
- waybetter strings check describes conditions and rewrites.
This commit is contained in:
parent
b3feeb8991
commit
4a2e3850df
33 changed files with 1353 additions and 85 deletions
|
|
@ -101,7 +101,28 @@ pub fn validate_strings(bytes: &[u8]) -> Result<StringsInfo, String> {
|
||||||
return Err(format!("VALIDATION: string {} is not plain text", id.chars().take(64).collect::<String>()));
|
return Err(format!("VALIDATION: string {} is not plain text", id.chars().take(64).collect::<String>()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const KNOWN: &[&str] = &["$schema", "format", "site", "catalog", "language", "base", "name", "authors", "version", "description", "strings"];
|
// Conditions and rewording rules are data too: shapes are checked here, words and values by the page runtime's own validator.
|
||||||
|
if let Some(when) = object.get("when") {
|
||||||
|
let ok = when.as_object().is_some_and(|w| {
|
||||||
|
w.keys().all(|key| key == "languages")
|
||||||
|
&& w.get("languages").and_then(serde_json::Value::as_array).is_some_and(|list| !list.is_empty() && list.len() <= 16 && list.iter().all(|tag| tag.as_str().is_some_and(valid_language)))
|
||||||
|
});
|
||||||
|
if !ok {
|
||||||
|
return Err("VALIDATION: invalid \"when\"".into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(rewrite) = object.get("rewrite") {
|
||||||
|
let ok = rewrite.as_object().is_some_and(|r| {
|
||||||
|
r.keys().all(|key| key == "words")
|
||||||
|
&& r.get("words").and_then(serde_json::Value::as_object).is_some_and(|words| {
|
||||||
|
!words.is_empty() && words.len() <= 64 && words.iter().all(|(from, to)| from.chars().count() <= 40 && to.as_str().is_some_and(|to| plain(to, 40) && !to.contains(['<', '>', '{', '}'])) && !from.contains(['<', '>', '{', '}']) && !from.is_empty())
|
||||||
|
})
|
||||||
|
});
|
||||||
|
if !ok {
|
||||||
|
return Err("VALIDATION: invalid \"rewrite\"".into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const KNOWN: &[&str] = &["$schema", "format", "site", "catalog", "language", "base", "when", "rewrite", "name", "authors", "version", "description", "strings"];
|
||||||
if let Some(key) = object.keys().find(|key| !KNOWN.contains(&key.as_str())) {
|
if let Some(key) = object.keys().find(|key| !KNOWN.contains(&key.as_str())) {
|
||||||
return Err(format!("VALIDATION: unknown field \"{}\"", key.chars().take(40).collect::<String>()));
|
return Err(format!("VALIDATION: unknown field \"{}\"", key.chars().take(40).collect::<String>()));
|
||||||
}
|
}
|
||||||
|
|
@ -361,6 +382,26 @@ mod tests {
|
||||||
format!(r#"{{"format":1,"site":"x","catalog":"web","language":"eo","name":"Esperanto","authors":["A"],"version":"1.0.0","strings":{strings}}}"#).into_bytes()
|
format!(r#"{{"format":1,"site":"x","catalog":"web","language":"eo","name":"Esperanto","authors":["A"],"version":"1.0.0","strings":{strings}}}"#).into_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn conditions_and_rewording_rules_are_plain_data() {
|
||||||
|
let with = |extra: &str| format!(r#"{{"format":1,"site":"x","catalog":"web","language":"en-x-twitter","name":"W","authors":["A"],{extra},"strings":{{}}}}"#).into_bytes();
|
||||||
|
let info = validate_strings(&with(r#""when":{"languages":["en","en-GB"]},"rewrite":{"words":{"Post":"Tweet","posts":"tweets"}}"#)).unwrap();
|
||||||
|
assert_eq!((info.language.as_str(), info.strings), ("en-x-twitter", 0));
|
||||||
|
for bad in [
|
||||||
|
r#""when":{"languages":[]}"#,
|
||||||
|
r#""when":{"languages":["not a tag"]}"#,
|
||||||
|
r#""when":{"code":"x"}"#,
|
||||||
|
r#""when":"en""#,
|
||||||
|
r#""rewrite":{"words":{}}"#,
|
||||||
|
r#""rewrite":{"words":{"Post":"<b>Tweet</b>"}}"#,
|
||||||
|
r#""rewrite":{"words":{"Post":"{x}"}}"#,
|
||||||
|
r#""rewrite":{"words":{"Post":1}}"#,
|
||||||
|
r#""rewrite":{"words":{"Post":"Tweet"},"code":"x"}"#,
|
||||||
|
] {
|
||||||
|
assert!(validate_strings(&with(bad)).is_err(), "{bad}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn packs_are_plain_data_with_the_envelope() {
|
fn packs_are_plain_data_with_the_envelope() {
|
||||||
let info = validate_strings(&pack(r#"{"a0000001":"Hejmo","b0000002":"{count, plural, one {# afiŝo} other {# afiŝoj}}"}"#)).unwrap();
|
let info = validate_strings(&pack(r#"{"a0000001":"Hejmo","b0000002":"{count, plural, one {# afiŝo} other {# afiŝoj}}"}"#)).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ A string pack replaces the wrapped site's own UI strings with data: it adds a la
|
||||||
does not offer, fixes its translation, or rewords it. The framework has the formats, the validator,
|
does not offer, fixes its translation, or rewords it. The framework has the formats, the validator,
|
||||||
the application engine, the hook interface, `waybetter strings check`, the Store kind `strings`
|
the application engine, the hook interface, `waybetter strings check`, the Store kind `strings`
|
||||||
with its install screen, the Languages section and translate mode. Sentences with element slots
|
with its install screen, the Languages section and translate mode. Sentences with element slots
|
||||||
(rich text) cannot be replaced yet.
|
(rich text) are replaced with `{e0}`, `{e1}` placeholders for the site's own elements. A pack can also
|
||||||
|
reword the site's own text by words (`rewrite`) and apply only while the site is in some languages
|
||||||
|
(`when`).
|
||||||
|
|
||||||
## Rules
|
## Rules
|
||||||
|
|
||||||
|
|
@ -39,6 +41,16 @@ with its install screen, the Languages section and translate mode. Sentences wit
|
||||||
- `language` is a BCP 47 tag; a private-use tag is fine. `base` is the language whose plural rules
|
- `language` is a BCP 47 tag; a private-use tag is fine. `base` is the language whose plural rules
|
||||||
the pack follows when the runtime does not know `language`; without either, every number takes
|
the pack follows when the runtime does not know `language`; without either, every number takes
|
||||||
the `other` form.
|
the `other` form.
|
||||||
|
- `when` (optional) is a condition: `{ "languages": ["en"] }` applies the pack only while the site
|
||||||
|
shows English (a tag matches itself and its regional forms: `en` matches `en-GB`; the match is
|
||||||
|
case-insensitive). The site's language is the one its catalog registers (`sink.matched`), so a
|
||||||
|
pack that rewords English never touches a Turkish page. Without `when` a pack always applies.
|
||||||
|
- `rewrite` (optional) rewords the site's own text instead of replacing keys:
|
||||||
|
`{ "words": { "Post": "Tweet", "posts": "tweets" } }`. Whole words only, case as written, 1 to 64
|
||||||
|
entries of plain letters and digits; applied to the text of every inventory key (plain strings, the
|
||||||
|
result of messages, the pieces of rich sentences) that no later pack replaced. A parameter's value
|
||||||
|
is never reworded (a user named "Post" stays "Post"). The pack carries none of the site's sentences,
|
||||||
|
so it keeps working when the site rewords a string, and `strings` may be empty.
|
||||||
- `strings` maps a key id to text. The ids are the inventory's; a pack never carries the site's own
|
- `strings` maps a key id to text. The ids are the inventory's; a pack never carries the site's own
|
||||||
text.
|
text.
|
||||||
|
|
||||||
|
|
@ -53,7 +65,13 @@ stays, when:
|
||||||
- it uses a number or date format, `selectordinal` or a plural offset;
|
- it uses a number or date format, `selectordinal` or a plural offset;
|
||||||
- it contains `<` or `>` (unless the inventory gives the key tag slots; then exactly those tags);
|
- it contains `<` or `>` (unless the inventory gives the key tag slots; then exactly those tags);
|
||||||
- it contains control or bidi-override characters, is empty or is longer than 2000 characters;
|
- it contains control or bidi-override characters, is empty or is longer than 2000 characters;
|
||||||
- the key's kind cannot be replaced by data yet (`rich`, `format`).
|
- the key's kind cannot be replaced by data yet (`format`, and `rich` entries the inventory gives no
|
||||||
|
`slots`).
|
||||||
|
|
||||||
|
A `rich` value (a sentence with a link or button inside) uses the original's element slots:
|
||||||
|
`{e0}` … `{e<slots-1>}` stand for the site's own elements, each exactly once (the last one may be
|
||||||
|
left out: the element after the final piece is not always there), in any order your sentence needs.
|
||||||
|
No plural, select, parameter or markup. A pack never carries HTML; the elements are the site's.
|
||||||
|
|
||||||
A parameter is inserted the way string concatenation would insert it (`String(value)`).
|
A parameter is inserted the way string concatenation would insert it (`String(value)`).
|
||||||
|
|
||||||
|
|
@ -65,7 +83,7 @@ A parameter is inserted the way string concatenation would insert it (`String(va
|
||||||
"entries": {
|
"entries": {
|
||||||
"a0000001": { "kind": "text", "hash": "0k3j…" },
|
"a0000001": { "kind": "text", "hash": "0k3j…" },
|
||||||
"b0000002": { "kind": "message", "params": ["count"], "plural": ["count"], "hash": "…" },
|
"b0000002": { "kind": "message", "params": ["count"], "plural": ["count"], "hash": "…" },
|
||||||
"c0000003": { "kind": "rich", "group": "rich", "hash": "…" }
|
"c0000003": { "kind": "rich", "slots": 2, "group": "rich", "hash": "…" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -74,10 +92,11 @@ A parameter is inserted the way string concatenation would insert it (`String(va
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `text` | a string | yes |
|
| `text` | a string | yes |
|
||||||
| `message` | a function of parameters that returns a string | yes |
|
| `message` | a function of parameters that returns a string | yes |
|
||||||
| `rich` | text with element slots | not yet |
|
| `rich` | text with element slots (`slots`) | yes, when the inventory knows `slots` |
|
||||||
| `format` | a compiled number, date or currency formatter | no |
|
| `format` | a compiled number, date or currency formatter | no |
|
||||||
|
|
||||||
`hash` is a hash of the base-language value (`hashText`), for the drift report; the inventory holds
|
`slots` (rich) is the number of element positions of the site's sentence: piece n is followed by the
|
||||||
|
caller's element n. `hash` is a hash of the base-language value (`hashText`), for the drift report; the inventory holds
|
||||||
no text of the site. `group` names the part of the catalog a key arrives with (default `main`).
|
no text of the site. `group` names the part of the catalog a key arrives with (default `main`).
|
||||||
|
|
||||||
`driftReport(inventory, observed, loadedGroups)` compares an inventory with a newer build: `added`,
|
`driftReport(inventory, observed, loadedGroups)` compares an inventory with a newer build: `added`,
|
||||||
|
|
@ -96,8 +115,13 @@ const engine = createStringEngine(inventory, [compilePack(packA, inventory), com
|
||||||
engine.resolve(id, siteValue); // packB's value, else packA's, else exactly siteValue
|
engine.resolve(id, siteValue); // packB's value, else packA's, else exactly siteValue
|
||||||
```
|
```
|
||||||
|
|
||||||
`resolve` returns a string for a `text` key and a function with the original's call shape for a
|
`resolve` returns a string for a `text` key, a function with the original's call shape for a
|
||||||
`message` key (closures over the parsed message; nothing is evaluated). Feeding a value the engine
|
`message` key (closures over the parsed message; nothing is evaluated) and, for a `rich` key, a
|
||||||
|
`RichTemplate` `{ pieces, order }`: piece n is shown, then the site's element `order[n]` (the shape
|
||||||
|
X's own sentence renderer reads; wiring it into a site's renderer is the adapter's part). A pack's
|
||||||
|
`rewrite` is applied to whichever value results, so a reworded message is a function again.
|
||||||
|
`engine.setLanguage(language)` tells the engine which language the site shows (the hook does it when
|
||||||
|
the adapter reports `matched`); conditional packs wait for it. Feeding a value the engine
|
||||||
produced back in returns the same value. It keeps the site's own value of every key it changed
|
produced back in returns the same value. It keeps the site's own value of every key it changed
|
||||||
(`engine.originals()`), which is what a restore needs; `applyPacks` and `restoreCatalog` do both
|
(`engine.originals()`), which is what a restore needs; `applyPacks` and `restoreCatalog` do both
|
||||||
for a whole catalog object without changing it. A live value whose kind differs from the
|
for a whole catalog object without changing it. A live value whose kind differs from the
|
||||||
|
|
@ -174,6 +198,16 @@ the site's scripts.
|
||||||
The Languages section of the panel (`createStringPacksSection({ inventory })`) lists the installed
|
The Languages section of the panel (`createStringPacksSection({ inventory })`) lists the installed
|
||||||
packs with their coverage, turns them on and off, orders and removes them.
|
packs with their coverage, turns them on and off, orders and removes them.
|
||||||
|
|
||||||
|
### Built-in packs
|
||||||
|
|
||||||
|
An app can ship packs of its own (`BuiltInPacks` in `panel/StringPacks.tsx`: a function returning pack
|
||||||
|
documents as text). They are delivered before the installed packs, so an installed pack wins where both
|
||||||
|
change a word, they follow the app's settings and they are not listed or removable. `syncStringPacks`
|
||||||
|
hands the tabs the delivery at start only when it differs from the one they were last given (every tab
|
||||||
|
reloads for a change). wayBetter for X's Twitter wording (Post -> Tweet, Repost -> Retweet) is one: a
|
||||||
|
`rewrite` pack for English that is delivered while its setting is on. A delivery with a rewording pack
|
||||||
|
carries the whole page inventory (the engine needs every key's shape), not a slice.
|
||||||
|
|
||||||
## Translate mode
|
## Translate mode
|
||||||
|
|
||||||
Switched on in the Languages section. The delivery then carries the whole inventory, packs or not,
|
Switched on in the Languages section. The delivery then carries the whole inventory, packs or not,
|
||||||
|
|
@ -182,5 +216,7 @@ and the page runtime marks every replaceable string with an invisible marker nam
|
||||||
with the key, the current text and its parameters. An edit is checked with the pack rules
|
with the key, the current text and its parameters. An edit is checked with the pack rules
|
||||||
(`checkEdit`) and kept in the tab's draft (`wayBetter.translateDraft`), which applies as the last
|
(`checkEdit`) and kept in the tab's draft (`wayBetter.translateDraft`), which applies as the last
|
||||||
pack after a reload. "Copy pack file" copies the draft as a pack document. "Leave" turns the mode
|
pack after a reload. "Copy pack file" copies the draft as a pack document. "Leave" turns the mode
|
||||||
off for that tab. The markers can reach places that compare text exactly (the window title), so the
|
off for that tab. The bar's and the editor's words are the app's own (`words` option of `installTranslateUi`, a function
|
||||||
|
that is asked again each time they are drawn, so a language switch shows at once); the English
|
||||||
|
defaults are `TRANSLATE_WORDS`. The markers can reach places that compare text exactly (the window title), so the
|
||||||
mode is for authors only and is never on by default.
|
mode is for authors only and is never on by default.
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ export function installStringPacks(win: Window, setups: readonly CatalogSetup[],
|
||||||
refused.push(error instanceof Error ? error.message : String(error));
|
refused.push(error instanceof Error ? error.message : String(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const usable = packs.filter(pack => pack.values.size > 0);
|
const usable = packs.filter(pack => pack.values.size > 0 || pack.rewrite);
|
||||||
return {
|
return {
|
||||||
catalog: setup.adapter.catalog, adapter: setup.adapter, packs, refused, usable,
|
catalog: setup.adapter.catalog, adapter: setup.adapter, packs, refused, usable,
|
||||||
engine: usable.length || options.mark ? createStringEngine(setup.inventory, usable) : null,
|
engine: usable.length || options.mark ? createStringEngine(setup.inventory, usable) : null,
|
||||||
|
|
@ -134,7 +134,7 @@ export function installStringPacks(win: Window, setups: readonly CatalogSetup[],
|
||||||
if (!engine) continue;
|
if (!engine) continue;
|
||||||
const sink: CatalogSink = {
|
const sink: CatalogSink = {
|
||||||
seen(group = 'main') { state.seen[group] = (state.seen[group] ?? 0) + 1; },
|
seen(group = 'main') { state.seen[group] = (state.seen[group] ?? 0) + 1; },
|
||||||
matched(language) { state.languages.add(String(language)); },
|
matched(language) { state.languages.add(String(language)); engine.setLanguage(String(language)); },
|
||||||
resolve(id, original) {
|
resolve(id, original) {
|
||||||
try {
|
try {
|
||||||
state.keys += 1;
|
state.keys += 1;
|
||||||
|
|
|
||||||
|
|
@ -90,14 +90,14 @@ export function checkEdit(lookup: InventoryLookup, id: string, value: string): s
|
||||||
|
|
||||||
export type TranslateWords = {
|
export type TranslateWords = {
|
||||||
bar: string; hint: string; edits(count: number): string; exportPack: string; copied: string; exit: string; reload: string;
|
bar: string; hint: string; edits(count: number): string; exportPack: string; copied: string; exit: string; reload: string;
|
||||||
key: string; original: string; parameters: string; save: string; cancel: string; remove: string; notTranslatable: string; choose: string;
|
key: string; original: string; parameters: string; plural: string; save: string; cancel: string; remove: string; notTranslatable: string; choose: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** English defaults (the app passes its own words). */
|
/** English defaults (the app passes its own words). */
|
||||||
export const TRANSLATE_WORDS: TranslateWords = {
|
export const TRANSLATE_WORDS: TranslateWords = {
|
||||||
bar: 'Translate mode', hint: 'Click a word to change it.', edits: count => `${count} ${count === 1 ? 'edit' : 'edits'}`,
|
bar: 'Translate mode', hint: 'Click a word to change it.', edits: count => `${count} ${count === 1 ? 'edit' : 'edits'}`,
|
||||||
exportPack: 'Copy pack file', copied: 'Pack file copied', exit: 'Leave', reload: 'Reload to see it',
|
exportPack: 'Copy pack file', copied: 'Pack file copied', exit: 'Leave', reload: 'Reload to see it',
|
||||||
key: 'Key', original: 'Now', parameters: 'Parameters', save: 'Save', cancel: 'Cancel', remove: 'Remove edit',
|
key: 'Key', original: 'Now', parameters: 'Parameters', plural: 'plural', save: 'Save', cancel: 'Cancel', remove: 'Remove edit',
|
||||||
notTranslatable: 'This string cannot be changed by a pack yet.', choose: 'Which one?',
|
notTranslatable: 'This string cannot be changed by a pack yet.', choose: 'Which one?',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -106,7 +106,8 @@ export type TranslateUiOptions = {
|
||||||
marker: Marker;
|
marker: Marker;
|
||||||
site: string;
|
site: string;
|
||||||
catalog: string;
|
catalog: string;
|
||||||
words?: Partial<TranslateWords>;
|
/** The bar's and the editor's words; a function is asked again each time they are drawn (the app's language may change). */
|
||||||
|
words?: Partial<TranslateWords> | (() => Partial<TranslateWords>);
|
||||||
/** Leaves translate mode (the app drops the flag and reloads). */
|
/** Leaves translate mode (the app drops the flag and reloads). */
|
||||||
exit(): void;
|
exit(): void;
|
||||||
};
|
};
|
||||||
|
|
@ -132,7 +133,7 @@ button.primary { background: #2563eb; }
|
||||||
*/
|
*/
|
||||||
export function installTranslateUi(win: Window, options: TranslateUiOptions): { dispose(): void } {
|
export function installTranslateUi(win: Window, options: TranslateUiOptions): { dispose(): void } {
|
||||||
const doc = win.document;
|
const doc = win.document;
|
||||||
const words = { ...TRANSLATE_WORDS, ...options.words };
|
const currentWords = (): TranslateWords => ({ ...TRANSLATE_WORDS, ...(typeof options.words === 'function' ? options.words() : options.words) });
|
||||||
const lookup = inventoryLookup(options.inventory);
|
const lookup = inventoryLookup(options.inventory);
|
||||||
const storage = win.sessionStorage;
|
const storage = win.sessionStorage;
|
||||||
const draft = (): TranslateDraft => readDraft(storage) ?? { language: '', name: '', strings: {} };
|
const draft = (): TranslateDraft => readDraft(storage) ?? { language: '', name: '', strings: {} };
|
||||||
|
|
@ -157,6 +158,7 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
const renderBar = () => {
|
const renderBar = () => {
|
||||||
|
const words = currentWords();
|
||||||
bar.replaceChildren();
|
bar.replaceChildren();
|
||||||
const title = doc.createElement('b');
|
const title = doc.createElement('b');
|
||||||
title.textContent = words.bar;
|
title.textContent = words.bar;
|
||||||
|
|
@ -173,6 +175,7 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
const closePop = () => { pop?.remove(); pop = null; };
|
const closePop = () => { pop?.remove(); pop = null; };
|
||||||
|
|
||||||
const edit = (id: string, x: number, y: number, now: string) => {
|
const edit = (id: string, x: number, y: number, now: string) => {
|
||||||
|
const words = currentWords();
|
||||||
closePop();
|
closePop();
|
||||||
pop = doc.createElement('div');
|
pop = doc.createElement('div');
|
||||||
pop.className = 'pop';
|
pop.className = 'pop';
|
||||||
|
|
@ -196,7 +199,7 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
}
|
}
|
||||||
if (shape.params?.length) {
|
if (shape.params?.length) {
|
||||||
const params = doc.createElement('small');
|
const params = doc.createElement('small');
|
||||||
params.textContent = `${words.parameters}: ${shape.params.map(name => `{${name}}${shape.plural?.includes(name) ? ' (plural)' : ''}`).join(', ')}`;
|
params.textContent = `${words.parameters}: ${shape.params.map(name => `{${name}}${shape.plural?.includes(name) ? ` (${words.plural})` : ''}`).join(', ')}`;
|
||||||
pop.append(params);
|
pop.append(params);
|
||||||
}
|
}
|
||||||
const input = doc.createElement('textarea');
|
const input = doc.createElement('textarea');
|
||||||
|
|
@ -234,6 +237,7 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
const onClick = (event: MouseEvent) => {
|
const onClick = (event: MouseEvent) => {
|
||||||
|
const words = currentWords();
|
||||||
if (event.composedPath().includes(host)) return;
|
if (event.composedPath().includes(host)) return;
|
||||||
const found = keysAt(event.target as Element | null);
|
const found = keysAt(event.target as Element | null);
|
||||||
if (!found.length) return;
|
if (!found.length) return;
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,11 @@ type Parts = ReturnType<typeof parseMessage>;
|
||||||
* What the site's value for a key is:
|
* What the site's value for a key is:
|
||||||
* - `text`: a plain string;
|
* - `text`: a plain string;
|
||||||
* - `message`: a function of a parameter object that returns a string;
|
* - `message`: a function of a parameter object that returns a string;
|
||||||
* - `rich`: text with element slots (not replaceable by data yet);
|
* - `rich`: text with element slots (a link or a button inside a sentence). It can be replaced when
|
||||||
|
* the inventory knows its slot count (`slots`): the pack value then places the site's own
|
||||||
|
* elements with `{e0}`, `{e1}`, …, each exactly once (the last may be left out); the value itself is still plain text;
|
||||||
* - `format`: a compiled number/date/currency formatter (not text).
|
* - `format`: a compiled number/date/currency formatter (not text).
|
||||||
* Only `text` and `message` can be replaced by a pack.
|
* Only `text`, `message` and `rich` with known `slots` can be replaced by a pack.
|
||||||
*/
|
*/
|
||||||
export type StringKind = 'text' | 'message' | 'rich' | 'format';
|
export type StringKind = 'text' | 'message' | 'rich' | 'format';
|
||||||
|
|
||||||
|
|
@ -41,6 +43,8 @@ export type InventoryEntry = {
|
||||||
plural?: string[];
|
plural?: string[];
|
||||||
/** Parameters the site's value selects on. */
|
/** Parameters the site's value selects on. */
|
||||||
select?: string[];
|
select?: string[];
|
||||||
|
/** Element slots of a `rich` value (`{e0}` … `{e<slots-1>}` in a pack value; the last may be left out). Without it the key is closed. */
|
||||||
|
slots?: number;
|
||||||
/** Tag slot names, for catalogs whose values carry `<tag>…</tag>` slots. */
|
/** Tag slot names, for catalogs whose values carry `<tag>…</tag>` slots. */
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
/** Hash of the base-language value (`hashText`): drift detection; never the text itself. */
|
/** Hash of the base-language value (`hashText`): drift detection; never the text itself. */
|
||||||
|
|
@ -61,6 +65,22 @@ export type StringInventory = {
|
||||||
entries: Record<string, InventoryEntry>;
|
entries: Record<string, InventoryEntry>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When a pack applies. Without a condition it always does. `languages`: only while the site shows
|
||||||
|
* one of these languages (a tag matches itself and its regional forms: `en` matches `en-GB`), for
|
||||||
|
* example a rewording of English that must not touch a Turkish page.
|
||||||
|
*/
|
||||||
|
export type PackCondition = { languages?: string[] };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pack's rewording rule: whole words replaced inside the site's own text, wherever it appears
|
||||||
|
* (`{ "Post": "Tweet", "posts": "tweets" }`). It carries none of the site's sentences, so it keeps
|
||||||
|
* working when the site words a string differently, and it applies to a value of the site (or of an
|
||||||
|
* earlier pack) that no later pack replaced. Words are matched exactly (case as written), never
|
||||||
|
* inside a longer word, and never in a parameter's value (a user named "Post" stays "Post").
|
||||||
|
*/
|
||||||
|
export type PackRewrite = { words: Record<string, string> };
|
||||||
|
|
||||||
/** A string pack document: metadata and `key id -> text`. */
|
/** A string pack document: metadata and `key id -> text`. */
|
||||||
export type StringPack = {
|
export type StringPack = {
|
||||||
format: 1;
|
format: 1;
|
||||||
|
|
@ -72,6 +92,10 @@ export type StringPack = {
|
||||||
authors: string[];
|
authors: string[];
|
||||||
/** A language whose plural rules the pack follows when the runtime does not know `language`. */
|
/** A language whose plural rules the pack follows when the runtime does not know `language`. */
|
||||||
base?: string;
|
base?: string;
|
||||||
|
/** The pack applies only when this holds (default: always). */
|
||||||
|
when?: PackCondition;
|
||||||
|
/** Rewords the site's text instead of (or besides) replacing keys. */
|
||||||
|
rewrite?: PackRewrite;
|
||||||
version?: string;
|
version?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
strings: Record<string, string>;
|
strings: Record<string, string>;
|
||||||
|
|
@ -83,11 +107,23 @@ export const MAIN_GROUP = 'main';
|
||||||
const TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
const TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
||||||
const IDENT = /^[a-z][a-z0-9-]{0,31}$/;
|
const IDENT = /^[a-z][a-z0-9-]{0,31}$/;
|
||||||
const CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f--]/;
|
const CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f--]/;
|
||||||
|
const REWRITE_FROM = /^[\p{L}\p{N}]{1,40}$/u;
|
||||||
|
const REWRITE_TO = /^[\p{L}\p{N}][\p{L}\p{N}'’-]{0,39}$/u;
|
||||||
|
const MAX_REWRITES = 64;
|
||||||
const CATEGORIES = new Set(['zero', 'one', 'two', 'few', 'many', 'other']);
|
const CATEGORIES = new Set(['zero', 'one', 'two', 'few', 'many', 'other']);
|
||||||
|
|
||||||
/** Whether a pack can replace a value of this kind. */
|
/** Whether a pack can replace a value of this kind (a `rich` one only with known `slots`: pass the shape). */
|
||||||
export function translatable(kind: StringKind): boolean {
|
export function translatable(kind: StringKind | Pick<EntryShape, 'kind' | 'slots'>): boolean {
|
||||||
return kind === 'text' || kind === 'message';
|
const { kind: k, slots } = typeof kind === 'string' ? { kind, slots: undefined } : kind;
|
||||||
|
return k === 'text' || k === 'message' || (k === 'rich' && slots !== undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether `language` (the site's) satisfies a pack's `when`. */
|
||||||
|
export function conditionHolds(when: PackCondition | undefined, language: string | undefined): boolean {
|
||||||
|
if (!when?.languages) return true;
|
||||||
|
if (!language) return false;
|
||||||
|
const have = language.toLowerCase();
|
||||||
|
return when.languages.some(tag => { const want = tag.toLowerCase(); return have === want || have.startsWith(`${want}-`); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 53-bit hash of a text as 11 base-36 characters. Same result in every runtime. */
|
/** 53-bit hash of a text as 11 base-36 characters. Same result in every runtime. */
|
||||||
|
|
@ -108,7 +144,7 @@ export function hashText(text: string): string {
|
||||||
// Inventory lookup (the full inventory, or its compact page form)
|
// Inventory lookup (the full inventory, or its compact page form)
|
||||||
|
|
||||||
/** The facts the validator and the engine need about one key. */
|
/** The facts the validator and the engine need about one key. */
|
||||||
export type EntryShape = Pick<InventoryEntry, 'kind' | 'params' | 'plural' | 'select' | 'tags'>;
|
export type EntryShape = Pick<InventoryEntry, 'kind' | 'params' | 'plural' | 'select' | 'tags' | 'slots'>;
|
||||||
export type InventoryLookup = (id: string) => EntryShape | undefined;
|
export type InventoryLookup = (id: string) => EntryShape | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,6 +158,8 @@ export type PageInventory = {
|
||||||
text: string;
|
text: string;
|
||||||
message: Record<string, string>;
|
message: Record<string, string>;
|
||||||
closed: string;
|
closed: string;
|
||||||
|
/** Rich entries a pack can replace: id -> slot count. */
|
||||||
|
rich?: Record<string, number>;
|
||||||
/** A slice: only the keys some pack names. A key missing from a slice is not a new key of the site. */
|
/** A slice: only the keys some pack names. A key missing from a slice is not a new key of the site. */
|
||||||
partial?: boolean;
|
partial?: boolean;
|
||||||
};
|
};
|
||||||
|
|
@ -130,13 +168,15 @@ function compact(site: string, catalog: string, shapes: Iterable<[string, EntryS
|
||||||
const text: string[] = [];
|
const text: string[] = [];
|
||||||
const closed: string[] = [];
|
const closed: string[] = [];
|
||||||
const message: Record<string, string> = {};
|
const message: Record<string, string> = {};
|
||||||
|
const rich: Record<string, number> = {};
|
||||||
for (const [id, entry] of shapes) {
|
for (const [id, entry] of shapes) {
|
||||||
if (entry.kind === 'text' && !entry.tags?.length) text.push(id);
|
if (entry.kind === 'rich' && entry.slots !== undefined && !entry.tags?.length) rich[id] = entry.slots;
|
||||||
|
else if (entry.kind === 'text' && !entry.tags?.length) text.push(id);
|
||||||
else if (entry.kind === 'message' && !entry.tags?.length) {
|
else if (entry.kind === 'message' && !entry.tags?.length) {
|
||||||
message[id] = (entry.params ?? []).map(name => `${name}${entry.plural?.includes(name) ? '*' : ''}${entry.select?.includes(name) ? '?' : ''}`).join(' ');
|
message[id] = (entry.params ?? []).map(name => `${name}${entry.plural?.includes(name) ? '*' : ''}${entry.select?.includes(name) ? '?' : ''}`).join(' ');
|
||||||
} else closed.push(id);
|
} else closed.push(id);
|
||||||
}
|
}
|
||||||
return { site, catalog, text: text.join(' '), message, closed: closed.join(' ') };
|
return { site, catalog, text: text.join(' '), message, closed: closed.join(' '), ...(Object.keys(rich).length ? { rich } : {}) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function packInventory(inventory: StringInventory): PageInventory {
|
export function packInventory(inventory: StringInventory): PageInventory {
|
||||||
|
|
@ -165,6 +205,7 @@ export function isPageInventory(input: unknown): input is PageInventory {
|
||||||
return typeof input.site === 'string' && IDENT.test(input.site) && typeof input.catalog === 'string' && IDENT.test(input.catalog)
|
return typeof input.site === 'string' && IDENT.test(input.site) && typeof input.catalog === 'string' && IDENT.test(input.catalog)
|
||||||
&& ids(input.text) && ids(input.closed) && isRecord(input.message)
|
&& ids(input.text) && ids(input.closed) && isRecord(input.message)
|
||||||
&& Object.entries(input.message).every(([id, names]) => /^[\w$.-]+$/.test(id) && typeof names === 'string' && /^[\w$*? ]*$/.test(names))
|
&& Object.entries(input.message).every(([id, names]) => /^[\w$.-]+$/.test(id) && typeof names === 'string' && /^[\w$*? ]*$/.test(names))
|
||||||
|
&& (input.rich === undefined || (isRecord(input.rich) && Object.entries(input.rich).every(([id, n]) => /^[\w$.-]+$/.test(id) && Number.isInteger(n) && (n as number) >= 0 && (n as number) <= 32)))
|
||||||
&& (input.partial === undefined || typeof input.partial === 'boolean');
|
&& (input.partial === undefined || typeof input.partial === 'boolean');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,6 +223,7 @@ export function inventoryLookup(inventory: StringInventory | PageInventory): Inv
|
||||||
const map = new Map<string, EntryShape>();
|
const map = new Map<string, EntryShape>();
|
||||||
if (inventory.text) for (const id of inventory.text.split(' ')) map.set(id, TEXT_SHAPE);
|
if (inventory.text) for (const id of inventory.text.split(' ')) map.set(id, TEXT_SHAPE);
|
||||||
if (inventory.closed) for (const id of inventory.closed.split(' ')) map.set(id, CLOSED_SHAPE);
|
if (inventory.closed) for (const id of inventory.closed.split(' ')) map.set(id, CLOSED_SHAPE);
|
||||||
|
if (inventory.rich) for (const [id, slots] of Object.entries(inventory.rich)) map.set(id, { kind: 'rich', slots });
|
||||||
for (const [id, spec] of Object.entries(inventory.message)) {
|
for (const [id, spec] of Object.entries(inventory.message)) {
|
||||||
const names = spec ? spec.split(' ') : [];
|
const names = spec ? spec.split(' ') : [];
|
||||||
map.set(id, {
|
map.set(id, {
|
||||||
|
|
@ -221,13 +263,27 @@ export function checkPackShape(input: unknown): PackIssue[] {
|
||||||
|| input.authors.some(author => typeof author !== 'string' || !author.trim() || author.length > STRING_PACK_LIMITS.name || CONTROL.test(author) || /[<>]/.test(author))) {
|
|| input.authors.some(author => typeof author !== 'string' || !author.trim() || author.length > STRING_PACK_LIMITS.name || CONTROL.test(author) || /[<>]/.test(author))) {
|
||||||
error(`"authors" must be a list of at most ${STRING_PACK_LIMITS.authors} plain-text names`);
|
error(`"authors" must be a list of at most ${STRING_PACK_LIMITS.authors} plain-text names`);
|
||||||
}
|
}
|
||||||
|
if (input.when !== undefined) {
|
||||||
|
const when = input.when;
|
||||||
|
if (!isRecord(when) || Object.keys(when).some(key => key !== 'languages')) error('"when" is an object with "languages"');
|
||||||
|
else if (when.languages !== undefined && (!Array.isArray(when.languages) || !when.languages.length || when.languages.length > 16
|
||||||
|
|| when.languages.some(tag => typeof tag !== 'string' || !TAG.test(tag)))) error('"when.languages" must be a list of 1 to 16 language tags');
|
||||||
|
}
|
||||||
|
if (input.rewrite !== undefined) {
|
||||||
|
const rewrite = input.rewrite;
|
||||||
|
const words = isRecord(rewrite) ? rewrite.words : undefined;
|
||||||
|
if (!isRecord(rewrite) || Object.keys(rewrite).some(key => key !== 'words') || !isRecord(words) || !Object.keys(words).length || Object.keys(words).length > MAX_REWRITES
|
||||||
|
|| Object.entries(words).some(([from, to]) => !REWRITE_FROM.test(from) || typeof to !== 'string' || !REWRITE_TO.test(to))) {
|
||||||
|
error(`"rewrite" is { "words": { "Word": "Replacement" } } with 1 to ${MAX_REWRITES} plain words`);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const field of ['version', 'description'] as const) {
|
for (const field of ['version', 'description'] as const) {
|
||||||
const value = input[field];
|
const value = input[field];
|
||||||
if (value !== undefined && (typeof value !== 'string' || value.length > 400 || CONTROL.test(value) || /[<>]/.test(value))) error(`"${field}" must be plain text`);
|
if (value !== undefined && (typeof value !== 'string' || value.length > 400 || CONTROL.test(value) || /[<>]/.test(value))) error(`"${field}" must be plain text`);
|
||||||
}
|
}
|
||||||
if (!isRecord(input.strings)) error('"strings" must be an object of key id -> text');
|
if (!isRecord(input.strings)) error('"strings" must be an object of key id -> text');
|
||||||
else if (Object.keys(input.strings).length > STRING_PACK_LIMITS.strings) error(`"strings" has more than ${STRING_PACK_LIMITS.strings} entries`);
|
else if (Object.keys(input.strings).length > STRING_PACK_LIMITS.strings) error(`"strings" has more than ${STRING_PACK_LIMITS.strings} entries`);
|
||||||
const known = new Set(['$schema', 'format', 'site', 'catalog', 'language', 'base', 'name', 'authors', 'version', 'description', 'strings']);
|
const known = new Set(['$schema', 'format', 'site', 'catalog', 'language', 'base', 'when', 'rewrite', 'name', 'authors', 'version', 'description', 'strings']);
|
||||||
for (const key of Object.keys(input)) if (!known.has(key)) issues.push({ level: 'warning', message: `unknown field "${key}" is ignored` });
|
for (const key of Object.keys(input)) if (!known.has(key)) issues.push({ level: 'warning', message: `unknown field "${key}" is ignored` });
|
||||||
return issues;
|
return issues;
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +349,7 @@ function checkParts(parts: Parts, shape: EntryShape): string | null {
|
||||||
* reason it is refused (the original then stays).
|
* reason it is refused (the original then stays).
|
||||||
*/
|
*/
|
||||||
export function validateString(shape: EntryShape, value: unknown): { parts: Parts } | { reason: string } {
|
export function validateString(shape: EntryShape, value: unknown): { parts: Parts } | { reason: string } {
|
||||||
if (!translatable(shape.kind)) return { reason: `not translatable yet (${shape.kind})` };
|
if (!translatable(shape)) return { reason: `not translatable yet (${shape.kind})` };
|
||||||
if (typeof value !== 'string') return { reason: 'the value must be text' };
|
if (typeof value !== 'string') return { reason: 'the value must be text' };
|
||||||
if (!value) return { reason: 'the value is empty' };
|
if (!value) return { reason: 'the value is empty' };
|
||||||
if (value.length > STRING_PACK_LIMITS.value) return { reason: `longer than ${STRING_PACK_LIMITS.value} characters` };
|
if (value.length > STRING_PACK_LIMITS.value) return { reason: `longer than ${STRING_PACK_LIMITS.value} characters` };
|
||||||
|
|
@ -306,6 +362,20 @@ export function validateString(shape: EntryShape, value: unknown): { parts: Part
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { reason: `invalid message syntax: ${error instanceof Error ? error.message : String(error)}` };
|
return { reason: `invalid message syntax: ${error instanceof Error ? error.message : String(error)}` };
|
||||||
}
|
}
|
||||||
|
if (shape.kind === 'rich') {
|
||||||
|
// Element slots: `{e0}` … `{e<slots-1>}`, each exactly once (the last may be left out); no plural, select or other parameter.
|
||||||
|
const slots = Array.from({ length: shape.slots ?? 0 }, (_, index) => `e${index}`);
|
||||||
|
const bad = checkParts(parts, { kind: 'message', params: slots });
|
||||||
|
if (bad) return { reason: bad };
|
||||||
|
const used = parts.flatMap(part => (typeof part !== 'string' && part.kind === 'arg' ? [part.name] : []));
|
||||||
|
for (const name of slots) {
|
||||||
|
const count = used.filter(item => item === name).length;
|
||||||
|
// The element after the last piece is not always there: that one slot may be left out.
|
||||||
|
if (count === 0 && name === slots[slots.length - 1] && slots.length > 0) continue;
|
||||||
|
if (count !== 1) return { reason: count ? `{${name}} (the original's element) must appear once, not ${count} times` : `the original's element {${name}} is missing` };
|
||||||
|
}
|
||||||
|
return { parts };
|
||||||
|
}
|
||||||
const problem = checkParts(parts, shape.kind === 'message' ? shape : { kind: 'text' });
|
const problem = checkParts(parts, shape.kind === 'message' ? shape : { kind: 'text' });
|
||||||
return problem ? { reason: problem } : { parts };
|
return problem ? { reason: problem } : { parts };
|
||||||
}
|
}
|
||||||
|
|
@ -313,7 +383,13 @@ export function validateString(shape: EntryShape, value: unknown): { parts: Part
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
// Compiling a pack (validation against an inventory)
|
// Compiling a pack (validation against an inventory)
|
||||||
|
|
||||||
export type CompiledValue = { text: string } | { parts: Parts };
|
/**
|
||||||
|
* A replaced `rich` value in the shape X's own renderer reads: piece `n` is shown, then the site's
|
||||||
|
* element `order[n]` (the last piece has no element after it).
|
||||||
|
*/
|
||||||
|
export type RichTemplate = { readonly pieces: readonly string[]; readonly order: readonly number[] };
|
||||||
|
|
||||||
|
export type CompiledValue = { text: string } | { parts: Parts } | { rich: RichTemplate };
|
||||||
|
|
||||||
export type PackReport = {
|
export type PackReport = {
|
||||||
/** Entries in the pack. */
|
/** Entries in the pack. */
|
||||||
|
|
@ -330,6 +406,9 @@ export type CompiledPack = {
|
||||||
name: string;
|
name: string;
|
||||||
language: string;
|
language: string;
|
||||||
base?: string;
|
base?: string;
|
||||||
|
when?: PackCondition;
|
||||||
|
/** The pack's word rewriting, ready to apply to a text. */
|
||||||
|
rewrite?: (text: string) => string;
|
||||||
site: string;
|
site: string;
|
||||||
catalog: string;
|
catalog: string;
|
||||||
values: ReadonlyMap<string, CompiledValue>;
|
values: ReadonlyMap<string, CompiledValue>;
|
||||||
|
|
@ -341,6 +420,28 @@ function literal(parts: Parts): string {
|
||||||
return parts.map(part => (typeof part === 'string' ? part : '')).join('');
|
return parts.map(part => (typeof part === 'string' ? part : '')).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The word-for-word rewriting of a validated `rewrite` rule. */
|
||||||
|
function compileRewrite(rule: PackRewrite): (text: string) => string {
|
||||||
|
const words = new Map(Object.entries(rule.words));
|
||||||
|
// Words are letters and digits only (checked), so they need no escaping.
|
||||||
|
const alternatives = [...words.keys()].sort((a, b) => b.length - a.length).join('|');
|
||||||
|
const pattern = new RegExp(String.raw`(?<![\p{L}\p{N}_])(?:${alternatives})(?![\p{L}\p{N}_])`, 'gu');
|
||||||
|
return text => text.replace(pattern, word => words.get(word) ?? word);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A validated rich value as pieces and element order. */
|
||||||
|
function richTemplate(parts: Parts): RichTemplate {
|
||||||
|
const pieces: string[] = [];
|
||||||
|
const order: number[] = [];
|
||||||
|
let current = '';
|
||||||
|
for (const part of parts) {
|
||||||
|
if (typeof part === 'string') current += part;
|
||||||
|
else if (part.kind === 'arg') { pieces.push(current); order.push(Number(part.name.slice(1))); current = ''; }
|
||||||
|
}
|
||||||
|
pieces.push(current);
|
||||||
|
return Object.freeze({ pieces: Object.freeze(pieces), order: Object.freeze(order) });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a pack against an inventory. Throws on a malformed envelope or a pack for another
|
* Validates a pack against an inventory. Throws on a malformed envelope or a pack for another
|
||||||
* site/catalog; every other problem is per key and lands in `report`.
|
* site/catalog; every other problem is per key and lands in `report`.
|
||||||
|
|
@ -361,10 +462,10 @@ export function compilePack(input: unknown, inventory: StringInventory | PageInv
|
||||||
if (!shape) { report.unknown.push(id); continue; }
|
if (!shape) { report.unknown.push(id); continue; }
|
||||||
const result = validateString(shape, value);
|
const result = validateString(shape, value);
|
||||||
if ('reason' in result) { report.rejected.push({ id, reason: result.reason }); continue; }
|
if ('reason' in result) { report.rejected.push({ id, reason: result.reason }); continue; }
|
||||||
values.set(id, shape.kind === 'text' ? { text: literal(result.parts) } : { parts: result.parts });
|
values.set(id, shape.kind === 'text' ? { text: literal(result.parts) } : shape.kind === 'rich' ? { rich: richTemplate(result.parts) } : { parts: result.parts });
|
||||||
report.valid += 1;
|
report.valid += 1;
|
||||||
}
|
}
|
||||||
return { name: pack.name, language: pack.language, base: pack.base, site: pack.site, catalog: pack.catalog, values, report };
|
return { name: pack.name, language: pack.language, base: pack.base, when: pack.when, rewrite: pack.rewrite ? compileRewrite(pack.rewrite) : undefined, site: pack.site, catalog: pack.catalog, values, report };
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
|
|
@ -416,6 +517,45 @@ export function renderMessage(parts: Parts, params: Readonly<Record<string, unkn
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The site's (or a pack's) value of one key with `rewrite` applied; a message keeps its parameters' values as they are. */
|
||||||
|
function rewriteValue(shape: EntryShape, value: unknown, rewrite: (text: string) => string): unknown {
|
||||||
|
if (typeof value === 'string') return rewrite(value);
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
const mapped = value.map(piece => (typeof piece === 'string' ? rewrite(piece) : piece));
|
||||||
|
return mapped.some((piece, index) => piece !== value[index]) ? mapped : value;
|
||||||
|
}
|
||||||
|
if (typeof value === 'function') {
|
||||||
|
const message = value as (this: unknown, params?: unknown) => unknown;
|
||||||
|
const plural = new Set(shape.plural ?? []);
|
||||||
|
return function (this: unknown, params?: unknown) {
|
||||||
|
const input = isRecord(params) ? params : {};
|
||||||
|
// The parameters go through as private markers, so only the site's own words are reworded.
|
||||||
|
const forward: Record<string, unknown> = { ...input };
|
||||||
|
const held: [string, unknown][] = [];
|
||||||
|
for (const name of shape.params ?? []) {
|
||||||
|
if (plural.has(name) || !(name in input)) continue;
|
||||||
|
const marker = `\uE000${held.length}\uE001`;
|
||||||
|
held.push([marker, input[name]]);
|
||||||
|
forward[name] = marker;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const out = message.call(this, forward);
|
||||||
|
if (typeof out !== 'string') return message.call(this, params);
|
||||||
|
let text = rewrite(out);
|
||||||
|
for (const [marker, original] of held) text = text.split(marker).join(String(original));
|
||||||
|
return text;
|
||||||
|
} catch {
|
||||||
|
return message.call(this, params);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (typeof value === 'object' && value !== null && 'pieces' in value) {
|
||||||
|
const template = value as RichTemplate;
|
||||||
|
return Object.freeze({ pieces: Object.freeze(template.pieces.map(rewrite)), order: template.order });
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
// The ordered application engine
|
// The ordered application engine
|
||||||
|
|
||||||
|
|
@ -436,6 +576,11 @@ export type StringEngine = {
|
||||||
* Feeding a value this engine produced back in returns the same value (idempotent).
|
* Feeding a value this engine produced back in returns the same value (idempotent).
|
||||||
*/
|
*/
|
||||||
resolve(id: string, original: unknown): unknown;
|
resolve(id: string, original: unknown): unknown;
|
||||||
|
/**
|
||||||
|
* The language the site shows (what packs with a `when.languages` condition are checked
|
||||||
|
* against). Set before the first `resolve`; until then conditional packs do not apply.
|
||||||
|
*/
|
||||||
|
setLanguage(language: string): void;
|
||||||
/** The site's own values of the keys a pack changed: what restoring needs. */
|
/** The site's own values of the keys a pack changed: what restoring needs. */
|
||||||
originals(): ReadonlyMap<string, unknown>;
|
originals(): ReadonlyMap<string, unknown>;
|
||||||
stats(): EngineStats;
|
stats(): EngineStats;
|
||||||
|
|
@ -454,11 +599,13 @@ export function createStringEngine(inventory: StringInventory | PageInventory |
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
const unlisted = new Set<string>();
|
const unlisted = new Set<string>();
|
||||||
const mismatched = new Set<string>();
|
const mismatched = new Set<string>();
|
||||||
|
let siteLanguage: string | undefined;
|
||||||
|
|
||||||
const winner = (id: string): { pack: CompiledPack; value: CompiledValue } | null => {
|
const winner = (id: string): { pack: CompiledPack; value: CompiledValue; index: number } | null => {
|
||||||
for (let index = packs.length - 1; index >= 0; index -= 1) {
|
for (let index = packs.length - 1; index >= 0; index -= 1) {
|
||||||
|
if (!conditionHolds(packs[index]!.when, siteLanguage)) continue;
|
||||||
const value = packs[index]!.values.get(id);
|
const value = packs[index]!.values.get(id);
|
||||||
if (value) return { pack: packs[index]!, value };
|
if (value) return { pack: packs[index]!, value, index };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
@ -466,31 +613,38 @@ export function createStringEngine(inventory: StringInventory | PageInventory |
|
||||||
const resolve = (id: string, incoming: unknown): unknown => {
|
const resolve = (id: string, incoming: unknown): unknown => {
|
||||||
let original = incoming;
|
let original = incoming;
|
||||||
// A value of ours coming back in (a second application): work from the site's own value again.
|
// A value of ours coming back in (a second application): work from the site's own value again.
|
||||||
if (typeof incoming === 'function' && produced.has(incoming)) original = produced.get(incoming);
|
if ((typeof incoming === 'function' || (typeof incoming === 'object' && incoming !== null)) && produced.has(incoming)) original = produced.get(incoming);
|
||||||
else if (typeof incoming === 'string' && applied.has(id) && applied.get(id) === incoming) original = originals.get(id);
|
else if (typeof incoming === 'string' && applied.has(id) && applied.get(id) === incoming) original = originals.get(id);
|
||||||
seen.add(id);
|
seen.add(id);
|
||||||
const found = winner(id);
|
const found = winner(id);
|
||||||
if (!found) {
|
// Word rewriting of the packs after the one whose text won (all of them when none did).
|
||||||
|
const rewrites = packs.flatMap((pack, index) => (index > (found?.index ?? -1) && pack.rewrite && conditionHolds(pack.when, siteLanguage) ? [pack.rewrite] : []));
|
||||||
|
if (!found && !rewrites.length) {
|
||||||
if (whole && unlisted.size < MAX_LISTED && !lookup(id)) unlisted.add(id);
|
if (whole && unlisted.size < MAX_LISTED && !lookup(id)) unlisted.add(id);
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
const shape = lookup(id);
|
const shape = lookup(id);
|
||||||
if (!shape || !translatable(shape.kind)) return original;
|
if (!shape || shape.kind === 'format' || (found && !translatable(shape))) return original;
|
||||||
if (shape.kind === 'text' ? typeof original !== 'string' : typeof original !== 'function') {
|
if (shape.kind === 'text' ? typeof original !== 'string' : shape.kind === 'rich' ? !Array.isArray(original) : typeof original !== 'function') {
|
||||||
if (mismatched.size < MAX_LISTED) mismatched.add(id);
|
if (mismatched.size < MAX_LISTED) mismatched.add(id);
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
if (originals.has(id) && originals.get(id) === original) return applied.get(id);
|
if (originals.has(id) && originals.get(id) === original) return applied.get(id);
|
||||||
let next: unknown;
|
let next: unknown = original;
|
||||||
|
if (found) {
|
||||||
if ('text' in found.value) {
|
if ('text' in found.value) {
|
||||||
next = found.value.text;
|
next = found.value.text;
|
||||||
|
} else if ('rich' in found.value) {
|
||||||
|
next = found.value.rich;
|
||||||
} else {
|
} else {
|
||||||
const parts = found.value.parts;
|
const parts = found.value.parts;
|
||||||
const languages = [found.pack.language, found.pack.base];
|
const languages = [found.pack.language, found.pack.base];
|
||||||
const message = (params?: unknown): string => renderMessage(parts, isRecord(params) ? params : {}, languages);
|
next = (params?: unknown): string => renderMessage(parts, isRecord(params) ? params : {}, languages);
|
||||||
produced.set(message, original);
|
|
||||||
next = message;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
for (const rewrite of rewrites) next = rewriteValue(shape, next, rewrite);
|
||||||
|
if (next === original) return original;
|
||||||
|
if (typeof next === 'function' || typeof next === 'object') produced.set(next as object, original as object);
|
||||||
originals.set(id, original);
|
originals.set(id, original);
|
||||||
applied.set(id, next);
|
applied.set(id, next);
|
||||||
return next;
|
return next;
|
||||||
|
|
@ -498,6 +652,7 @@ export function createStringEngine(inventory: StringInventory | PageInventory |
|
||||||
|
|
||||||
return {
|
return {
|
||||||
resolve,
|
resolve,
|
||||||
|
setLanguage(language) { siteLanguage = language; },
|
||||||
originals: () => originals,
|
originals: () => originals,
|
||||||
stats: () => ({ seen: seen.size, applied: applied.size, unlisted: [...unlisted], mismatched: [...mismatched] }),
|
stats: () => ({ seen: seen.size, applied: applied.size, unlisted: [...unlisted], mismatched: [...mismatched] }),
|
||||||
};
|
};
|
||||||
|
|
@ -539,7 +694,7 @@ export function coverage(inventory: StringInventory, pack: Pick<CompiledPack, 'v
|
||||||
for (const [id, entry] of Object.entries(inventory.entries)) {
|
for (const [id, entry] of Object.entries(inventory.entries)) {
|
||||||
const group = (out[entry.group ?? MAIN_GROUP] ??= { translatable: 0, translated: 0, closed: 0 });
|
const group = (out[entry.group ?? MAIN_GROUP] ??= { translatable: 0, translated: 0, closed: 0 });
|
||||||
for (const bucket of [group, out.all!]) {
|
for (const bucket of [group, out.all!]) {
|
||||||
if (!translatable(entry.kind)) { bucket.closed += 1; continue; }
|
if (!translatable(entry)) { bucket.closed += 1; continue; }
|
||||||
bucket.translatable += 1;
|
bucket.translatable += 1;
|
||||||
if (pack.values.has(id)) bucket.translated += 1;
|
if (pack.values.has(id)) bucket.translated += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -573,7 +728,7 @@ export function driftReport(inventory: StringInventory, observed: Readonly<Recor
|
||||||
for (const [id, now] of Object.entries(observed)) {
|
for (const [id, now] of Object.entries(observed)) {
|
||||||
const before = Object.prototype.hasOwnProperty.call(inventory.entries, id) ? inventory.entries[id] : undefined;
|
const before = Object.prototype.hasOwnProperty.call(inventory.entries, id) ? inventory.entries[id] : undefined;
|
||||||
if (!before) { report.added.push(id); continue; }
|
if (!before) { report.added.push(id); continue; }
|
||||||
if (before.kind !== now.kind || !sameList(before.params, now.params) || !sameList(before.plural, now.plural) || !sameList(before.select, now.select) || !sameList(before.tags, now.tags)) {
|
if (before.kind !== now.kind || before.slots !== now.slots || !sameList(before.params, now.params) || !sameList(before.plural, now.plural) || !sameList(before.select, now.select) || !sameList(before.tags, now.tags)) {
|
||||||
report.reshaped.push(id);
|
report.reshaped.push(id);
|
||||||
} else if (before.hash !== now.hash) {
|
} else if (before.hash !== now.hash) {
|
||||||
report.reworded.push(id);
|
report.reworded.push(id);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
// The theme doctor: advice, never a block. A theme may do anything its trust level allows; the doctor
|
// The theme doctor: advice, never a block. A theme may do anything its trust level allows; the doctor
|
||||||
// points at the lighter mechanism for what the theme does (a token before a component setting, a
|
// points at the lighter mechanism for what the theme does (a token before a component setting, a
|
||||||
// component setting before CSS, CSS before a script) and at performance, accessibility and contrast
|
// component setting before CSS, CSS before a script) and at performance, accessibility and contrast
|
||||||
// costs. Used by the import screen, the Theme Builder's report and `waybetter store check`. Pure.
|
// costs. Used by the import screen, the Theme Builder's full report and `waybetter store check`.
|
||||||
|
// Pure. Every finding says where it is (a token path or the CSS rule), what was found and how to fix
|
||||||
|
// it; the words are catalog keys (`wb.doctor.<id>.found` / `.fix`, English below), so a panel shows
|
||||||
|
// them in the owner's language and the CLI prints the English.
|
||||||
|
|
||||||
import { contrastRatio } from './themeApi.ts';
|
import { contrastRatio } from './themeApi.ts';
|
||||||
import { ensureContrast, type ThemeSpec } from './themeSpec.ts';
|
import { ensureContrast, type ThemeSpec } from './themeSpec.ts';
|
||||||
|
|
@ -9,49 +12,120 @@ import { ensureContrast, type ThemeSpec } from './themeSpec.ts';
|
||||||
export type DoctorAdvice = {
|
export type DoctorAdvice = {
|
||||||
/** `lighter`: a lighter mechanism would do; `performance`, `accessibility`, `contrast`: a cost. */
|
/** `lighter`: a lighter mechanism would do; `performance`, `accessibility`, `contrast`: a cost. */
|
||||||
kind: 'lighter' | 'performance' | 'accessibility' | 'contrast';
|
kind: 'lighter' | 'performance' | 'accessibility' | 'contrast';
|
||||||
/** Stable id, for tests and translations (`wb.doctor.<id>`). */
|
/** Stable id of the finding, for tests (`css-radius`, `contrast-text`). */
|
||||||
id: string;
|
id: string;
|
||||||
/** English text (the panel translates by id when it has the words). */
|
/** Its words in the catalog: `wb.doctor.<key>.found` and `wb.doctor.<key>.fix` (`css-radius`, `contrast`). */
|
||||||
|
key: string;
|
||||||
|
/** A token path of the theme (`colors.text`, `components.postText.fontSize`) or the CSS rule (`.card { border-radius }`). */
|
||||||
|
where: string;
|
||||||
|
/** Values for the `{name}` slots of the words. */
|
||||||
|
params: Record<string, string>;
|
||||||
|
/** English: what was found. */
|
||||||
text: string;
|
text: string;
|
||||||
|
/** English: how to fix it. */
|
||||||
|
fix: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Rule = { id: string; kind: DoctorAdvice['kind']; test: RegExp; text: string };
|
/** The doctor's words in English (the source of `wb.doctor.*` in the catalogs). */
|
||||||
|
export const DOCTOR_MESSAGES = {
|
||||||
|
'wb.doctor.css-radius.found': 'This rule sets corner radii in CSS.',
|
||||||
|
'wb.doctor.css-radius.fix': 'Set them with the radius of a part under components, or shape.radius for all of them: no CSS needed, and it keeps working when the site renames its classes.',
|
||||||
|
'wb.doctor.css-bevel.found': 'This rule draws a bevelled edge with stacked inset shadows.',
|
||||||
|
'wb.doctor.css-bevel.fix': 'Use borderStyle "bevel-out" or "bevel-in" on a part under components: it draws the bevel from the theme’s colors.',
|
||||||
|
'wb.doctor.css-hide.found': 'This rule hides something with display: none.',
|
||||||
|
'wb.doctor.css-hide.fix': 'Use visible on a part under components (avatars, counts, names) or a layout variant such as sidebar: hidden; the owner can then switch it back.',
|
||||||
|
'wb.doctor.css-color.found': 'This rule uses a literal color.',
|
||||||
|
'wb.doctor.css-color.fix': 'Name a role (text, muted, accent, surface…) in colors or in a component, so the contrast pass covers it.',
|
||||||
|
'wb.doctor.css-font.found': 'This rule sets a font family.',
|
||||||
|
'wb.doctor.css-font.fix': 'Use font.roles: it sets the post, heading, numbers and mono faces without CSS.',
|
||||||
|
'wb.doctor.css-has.found': 'This rule uses :has(), which is matched again on every change of the page.',
|
||||||
|
'wb.doctor.css-has.fix': 'Keep :has() off rules that repeat down a timeline, or anchor the rule on a part.',
|
||||||
|
'wb.doctor.css-universal.found': 'This rule uses a universal selector (*), matched against every element.',
|
||||||
|
'wb.doctor.css-universal.fix': 'Anchor the rule on a part instead.',
|
||||||
|
'wb.doctor.css-blur.found': 'This rule blurs what is behind it (backdrop-filter), which is costly on parts that repeat.',
|
||||||
|
'wb.doctor.css-blur.fix': 'Use the glass fill of bars and panels: it is the cheaper place for blur.',
|
||||||
|
'wb.doctor.css-outline-none.found': 'This rule removes the focus outline, so keyboard focus is no longer visible.',
|
||||||
|
'wb.doctor.css-outline-none.fix': 'Use decor.focusRing to draw a visible focus ring instead.',
|
||||||
|
'wb.doctor.css-motion.found': 'This rule animates without checking for reduced motion.',
|
||||||
|
'wb.doctor.css-motion.fix': 'Keep motion inside @media (prefers-reduced-motion: no-preference), or let decor.motion do it for you.',
|
||||||
|
'wb.doctor.css-size.found': 'The CSS is more than 20,000 characters long.',
|
||||||
|
'wb.doctor.css-size.fix': 'The site recalculates styles with every rule; tokens and component settings compile to fewer rules.',
|
||||||
|
'wb.doctor.contrast.found': 'The {token} color was adjusted to stay readable ({ratio}:1 on the background).',
|
||||||
|
'wb.doctor.contrast.fix': 'Pick a lighter or darker {token} color; until then the theme is shown with the adjusted one.',
|
||||||
|
'wb.doctor.glass-post.found': 'Glass is set on posts, but it is not drawn: blur on every post of a timeline is too costly.',
|
||||||
|
'wb.doctor.glass-post.fix': 'Use a solid or tinted fill for posts and keep glass for bars and panels.',
|
||||||
|
'wb.doctor.small-post-text.found': 'Post text is {size}px, which is hard to read for many people.',
|
||||||
|
'wb.doctor.small-post-text.fix': 'Use 14px or more for the post text size, or raise the text size of the whole theme.',
|
||||||
|
'wb.doctor.nav-moved.found': 'The navigation is moved to the {position}, which changes where people look for it.',
|
||||||
|
'wb.doctor.nav-moved.fix': 'It only applies on wide panes, and the owner can turn layout changes off. Keep the default position unless the layout needs it.',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
const fill = (text: string, params: Record<string, string>) => text.replace(/\{(\w+)\}/g, (_, name: string) => params[name] ?? '');
|
||||||
|
|
||||||
|
type Rule = { id: string; kind: DoctorAdvice['kind']; test: RegExp; property: string };
|
||||||
/** What a theme's free-form CSS does that a v2 group does without CSS. */
|
/** What a theme's free-form CSS does that a v2 group does without CSS. */
|
||||||
const CSS_RULES: Rule[] = [
|
const CSS_RULES: Rule[] = [
|
||||||
{ id: 'css-radius', kind: 'lighter', test: /border-radius\s*:/i, text: 'Corner radii: components.<part>.radius (or shape.radius) sets them without CSS and keeps working when the site renames its classes.' },
|
{ id: 'css-radius', kind: 'lighter', test: /border-radius\s*:/gi, property: 'border-radius' },
|
||||||
{ id: 'css-bevel', kind: 'lighter', test: /box-shadow\s*:[^;{}]*inset[^;{}]*inset[^;{}]*inset/i, text: 'Bevelled edges: components.<part>.borderStyle "bevel-out" / "bevel-in" draws them from the theme\'s colors.' },
|
{ id: 'css-bevel', kind: 'lighter', test: /box-shadow\s*:[^;{}]*inset[^;{}]*inset[^;{}]*inset/gi, property: 'box-shadow' },
|
||||||
{ id: 'css-hide', kind: 'lighter', test: /display\s*:\s*none/i, text: 'Hiding a part: components.<part>.visible (avatars, counts, names) or a layout variant (sidebar: hidden) does it, and the owner can switch it back.' },
|
{ id: 'css-hide', kind: 'lighter', test: /display\s*:\s*none/gi, property: 'display' },
|
||||||
{ id: 'css-color', kind: 'lighter', test: /(?:^|[;{\s])(?:color|background(?:-color)?)\s*:\s*#[0-9a-f]{3,8}/i, text: 'Literal colors: name a role (text, muted, accent, surface…) in colors or in a component, so the contrast pass covers it.' },
|
{ id: 'css-color', kind: 'lighter', test: /(?:^|[;{\s])(?:color|background(?:-color)?)\s*:\s*#[0-9a-f]{3,8}/gi, property: 'color' },
|
||||||
{ id: 'css-font', kind: 'lighter', test: /font-family\s*:/i, text: 'Fonts: font.roles sets the post, heading, numbers and mono faces without CSS.' },
|
{ id: 'css-font', kind: 'lighter', test: /font-family\s*:/gi, property: 'font-family' },
|
||||||
{ id: 'css-has', kind: 'performance', test: /:has\(/i, text: ':has() is matched again on every change of the page; keep it off rules that repeat down a timeline.' },
|
{ id: 'css-has', kind: 'performance', test: /:has\(/gi, property: ':has()' },
|
||||||
{ id: 'css-universal', kind: 'performance', test: /(?:^|[\s,>+~])\*\s*(?:[,{>+~:\[]|$)/m, text: 'A universal selector (*) is matched against every element; anchor the rule on a part.' },
|
{ id: 'css-universal', kind: 'performance', test: /(?:^|[\s,>+~])\*\s*(?:[,{>+~:[]|$)/gm, property: '*' },
|
||||||
{ id: 'css-blur', kind: 'performance', test: /backdrop-filter\s*:/i, text: 'Blur (backdrop-filter) is costly on parts that repeat; the glass fill of bars and panels is the cheaper place for it.' },
|
{ id: 'css-blur', kind: 'performance', test: /backdrop-filter\s*:/gi, property: 'backdrop-filter' },
|
||||||
{ id: 'css-outline-none', kind: 'accessibility', test: /outline\s*:\s*(?:none|0)\b/i, text: 'Removing the outline hides where keyboard focus is; decor.focusRing draws a visible one instead.' },
|
{ id: 'css-outline-none', kind: 'accessibility', test: /outline\s*:\s*(?:none|0)\b/gi, property: 'outline' },
|
||||||
{ id: 'css-motion', kind: 'accessibility', test: /(?:animation|transition)\s*:/i, text: 'Motion should stay inside @media (prefers-reduced-motion: no-preference); decor.motion does that for you.' },
|
{ id: 'css-motion', kind: 'accessibility', test: /(?:animation|transition)\s*:/gi, property: 'transition' },
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Advice for a theme document. Empty when there is nothing to say. */
|
const MAX_PER_RULE = 25;
|
||||||
|
|
||||||
|
/** The selector of the rule block a position of `css` is in (the text before its `{`), shortened. */
|
||||||
|
function selectorAt(css: string, index: number): string {
|
||||||
|
const open = css.lastIndexOf('{', index);
|
||||||
|
if (open < 0) return '';
|
||||||
|
const close = Math.max(css.lastIndexOf('}', open - 1), css.lastIndexOf(';', open - 1), css.lastIndexOf('{', open - 1));
|
||||||
|
const selector = css.slice(close + 1, open).replace(/\s+/g, ' ').trim();
|
||||||
|
return selector.length > 80 ? `${selector.slice(0, 79)}…` : selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
function advice(id: string, kind: DoctorAdvice['kind'], where: string, params: Record<string, string> = {}, key = id): DoctorAdvice {
|
||||||
|
const words = DOCTOR_MESSAGES as Record<string, string>;
|
||||||
|
return { kind, id, key, where, params, text: fill(words[`wb.doctor.${key}.found`]!, params), fix: fill(words[`wb.doctor.${key}.fix`]!, params) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Advice for a theme document: every finding, with where it is. Empty when there is nothing to say. */
|
||||||
export function themeDoctor(theme: ThemeSpec): DoctorAdvice[] {
|
export function themeDoctor(theme: ThemeSpec): DoctorAdvice[] {
|
||||||
const out: DoctorAdvice[] = [];
|
const out: DoctorAdvice[] = [];
|
||||||
const css = theme.css ?? '';
|
const css = theme.css ?? '';
|
||||||
if (css.trim()) {
|
if (css.trim()) {
|
||||||
for (const rule of CSS_RULES) if (rule.test.test(css)) out.push({ kind: rule.kind, id: rule.id, text: rule.text });
|
for (const rule of CSS_RULES) {
|
||||||
if (css.length > 20_000) out.push({ kind: 'performance', id: 'css-size', text: 'More than 20,000 characters of CSS: the site recalculates styles with every rule; tokens and component settings compile to fewer rules.' });
|
const seen = new Set<string>();
|
||||||
|
for (const match of css.matchAll(rule.test)) {
|
||||||
|
const selector = selectorAt(css, match.index ?? 0) || 'css';
|
||||||
|
const where = rule.id === 'css-universal' || rule.id === 'css-has' ? selector : `${selector} { ${rule.property} }`;
|
||||||
|
if (seen.has(where)) continue;
|
||||||
|
seen.add(where);
|
||||||
|
out.push(advice(rule.id, rule.kind, where));
|
||||||
|
if (seen.size >= MAX_PER_RULE) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (css.length > 20_000) out.push(advice('css-size', 'performance', 'css'));
|
||||||
}
|
}
|
||||||
if (theme.colors) {
|
if (theme.colors) {
|
||||||
const fixed = ensureContrast(theme.colors);
|
const fixed = ensureContrast(theme.colors);
|
||||||
for (const role of ['text', 'muted', 'accent'] as const) {
|
for (const role of ['text', 'muted', 'accent'] as const) {
|
||||||
if (fixed[role] !== theme.colors[role]) out.push({ kind: 'contrast', id: `contrast-${role}`, text: `The ${role} color was adjusted to stay readable (${contrastRatio(theme.colors[role], theme.colors.bg).toFixed(2)}:1 on the background).` });
|
if (fixed[role] !== theme.colors[role]) {
|
||||||
|
out.push(advice(`contrast-${role}`, 'contrast', `colors.${role}`, { token: role, ratio: contrastRatio(theme.colors[role], theme.colors.bg).toFixed(2) }, 'contrast'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (theme.components) {
|
if (theme.components) {
|
||||||
const posts = theme.components.post;
|
if (theme.components.post?.fill === 'glass') out.push(advice('glass-post', 'performance', 'components.post.fill'));
|
||||||
if (posts?.fill === 'glass') out.push({ kind: 'performance', id: 'glass-post', text: 'Glass on posts is not drawn: blur on every post of a timeline is too costly.' });
|
const size = theme.components.postText?.fontSize;
|
||||||
const text = theme.components.postText?.fontSize;
|
if (size !== undefined && size < 14) out.push(advice('small-post-text', 'accessibility', 'components.postText.fontSize', { size: String(size) }));
|
||||||
if (text !== undefined && text < 14) out.push({ kind: 'accessibility', id: 'small-post-text', text: 'Post text under 14px is hard to read for many people.' });
|
|
||||||
}
|
}
|
||||||
if (theme.variants?.nav === 'top' || theme.variants?.nav === 'bottom') {
|
if (theme.variants?.nav === 'top' || theme.variants?.nav === 'bottom') {
|
||||||
out.push({ kind: 'accessibility', id: 'nav-moved', text: 'Moving the navigation changes where people look for it; it only applies on wide panes, and the owner can turn layout changes off.' });
|
out.push(advice('nav-moved', 'accessibility', 'variants.nav', { position: theme.variants.nav }));
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
143
packages/runtime/tests/stringPacksRich.test.ts
Normal file
143
packages/runtime/tests/stringPacksRich.test.ts
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { test } from 'node:test';
|
||||||
|
import {
|
||||||
|
compilePack, conditionHolds, coverage, createStringEngine, driftReport, inventoryLookup, packInventory, sliceInventory, validateString,
|
||||||
|
checkPackShape, isPageInventory, type StringInventory,
|
||||||
|
} from '../src/stringPacks.ts';
|
||||||
|
|
||||||
|
const INVENTORY: StringInventory = {
|
||||||
|
format: 1, site: 'demo', catalog: 'web', base: 'en',
|
||||||
|
entries: {
|
||||||
|
t1: { kind: 'text', hash: 'h1' },
|
||||||
|
r2: { kind: 'rich', slots: 2, hash: 'h2' },
|
||||||
|
r0: { kind: 'rich', slots: 0, hash: 'h3' },
|
||||||
|
rx: { kind: 'rich', hash: 'h4' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const pack = (strings: Record<string, string>, extra: object = {}) =>
|
||||||
|
({ format: 1, site: 'demo', catalog: 'web', language: 'eo', name: 'P', authors: ['a'], strings, ...extra });
|
||||||
|
|
||||||
|
test('rich values: element slots {e0}..{n-1}, each once, in any order; nothing else', () => {
|
||||||
|
const shape = inventoryLookup(INVENTORY)('r2')!;
|
||||||
|
assert.ok('parts' in validateString(shape, 'Legu {e1} antaŭ {e0}.'));
|
||||||
|
assert.ok('parts' in validateString(shape, 'Legu {e0}.'), 'the last slot may be left out');
|
||||||
|
assert.match((validateString(shape, 'Legu {e1}.') as { reason: string }).reason, /\{e0\}.*missing/);
|
||||||
|
assert.match((validateString(shape, '{e0} {e0} {e1}') as { reason: string }).reason, /once/);
|
||||||
|
assert.match((validateString(shape, '{e0} {e1} {e2}') as { reason: string }).reason, /not a parameter/);
|
||||||
|
assert.match((validateString(shape, '{e0} {e1, plural, other {x}}') as { reason: string }).reason, /not a plural/);
|
||||||
|
assert.match((validateString(shape, '<a>{e0}</a> {e1}') as { reason: string }).reason, /markup/);
|
||||||
|
assert.match((validateString(inventoryLookup(INVENTORY)('rx')!, 'x') as { reason: string }).reason, /not translatable yet/);
|
||||||
|
assert.ok('parts' in validateString(inventoryLookup(INVENTORY)('r0')!, 'Nur teksto'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('rich engine: pieces + element order, idempotent, original kept; a non-array original is left alone', () => {
|
||||||
|
const compiled = compilePack(pack({ r2: 'A {e1} B {e0} C', t1: 'Hejmo' }), INVENTORY);
|
||||||
|
assert.equal(compiled.report.valid, 2);
|
||||||
|
const engine = createStringEngine(INVENTORY, [compiled]);
|
||||||
|
const site = ['Read ', , ' now'];
|
||||||
|
const out = engine.resolve('r2', site) as { pieces: string[]; order: number[] };
|
||||||
|
assert.deepEqual(out, { pieces: ['A ', ' B ', ' C'], order: [1, 0] });
|
||||||
|
assert.equal(engine.resolve('r2', out), out, 'feeding the result back changes nothing');
|
||||||
|
assert.equal(engine.originals().get('r2'), site);
|
||||||
|
assert.equal(engine.resolve('r2', 'not an array'), 'not an array');
|
||||||
|
assert.deepEqual(engine.stats().mismatched, ['r2']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('page inventory carries rich slots; closed rich stays closed; coverage counts replaceable rich', () => {
|
||||||
|
const page = packInventory(INVENTORY);
|
||||||
|
assert.deepEqual(page.rich, { r2: 2, r0: 0 });
|
||||||
|
assert.ok(isPageInventory(JSON.parse(JSON.stringify(page))));
|
||||||
|
assert.ok(!isPageInventory({ ...page, rich: { r2: -1 } }));
|
||||||
|
assert.equal(inventoryLookup(page)('r2')!.slots, 2);
|
||||||
|
assert.equal(inventoryLookup(page)('rx')!.kind, 'rich');
|
||||||
|
assert.equal(inventoryLookup(page)('rx')!.slots, undefined);
|
||||||
|
assert.deepEqual(sliceInventory(page, ['r2']).rich, { r2: 2 });
|
||||||
|
const cover = coverage(INVENTORY, compilePack(pack({ r2: '{e0}{e1}' }), INVENTORY));
|
||||||
|
assert.deepEqual(cover.all, { translatable: 3, translated: 1, closed: 1 });
|
||||||
|
const drift = driftReport(INVENTORY, { r2: { kind: 'rich', slots: 3, hash: 'h2' } }, ['main']);
|
||||||
|
assert.deepEqual(drift.reshaped, ['r2']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('language condition: a pack with when.languages applies only on matching site languages', () => {
|
||||||
|
assert.equal(conditionHolds(undefined, undefined), true);
|
||||||
|
assert.equal(conditionHolds({ languages: ['en'] }, 'en'), true);
|
||||||
|
assert.equal(conditionHolds({ languages: ['en'] }, 'en-GB'), true);
|
||||||
|
assert.equal(conditionHolds({ languages: ['en'] }, 'EN-gb'), true);
|
||||||
|
assert.equal(conditionHolds({ languages: ['en'] }, 'tr'), false);
|
||||||
|
assert.equal(conditionHolds({ languages: ['en'] }, 'ent'), false);
|
||||||
|
assert.equal(conditionHolds({ languages: ['en'] }, undefined), false);
|
||||||
|
const compiled = compilePack(pack({ t1: 'Tweet' }, { when: { languages: ['en'] } }), INVENTORY);
|
||||||
|
const engine = createStringEngine(INVENTORY, [compiled]);
|
||||||
|
assert.equal(engine.resolve('t1', 'Post'), 'Post', 'no language yet: conditional pack waits');
|
||||||
|
engine.setLanguage('tr');
|
||||||
|
assert.equal(engine.resolve('t1', 'Gönderi'), 'Gönderi');
|
||||||
|
const english = createStringEngine(INVENTORY, [compiled]);
|
||||||
|
english.setLanguage('en-GB');
|
||||||
|
assert.equal(english.resolve('t1', 'Post'), 'Tweet');
|
||||||
|
assert.equal(english.resolve('t1', 'Tweet'), 'Tweet');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('when is checked as part of the envelope', () => {
|
||||||
|
const errors = (when: unknown) => checkPackShape(pack({ t1: 'x' }, { when })).filter(issue => issue.level === 'error').length;
|
||||||
|
assert.equal(errors({ languages: ['en', 'en-GB'] }), 0);
|
||||||
|
assert.equal(errors({ languages: [] }), 1);
|
||||||
|
assert.equal(errors({ languages: ['<b>'] }), 1);
|
||||||
|
assert.equal(errors({ code: 'x' }), 1);
|
||||||
|
assert.equal(errors('en'), 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
const REWRITE_INVENTORY: StringInventory = {
|
||||||
|
format: 1, site: 'demo', catalog: 'web', base: 'en',
|
||||||
|
entries: {
|
||||||
|
t1: { kind: 'text', hash: 'h' },
|
||||||
|
m1: { kind: 'message', params: ['name', 'count'], plural: ['count'], hash: 'h' },
|
||||||
|
r1: { kind: 'rich', slots: 2, hash: 'h' },
|
||||||
|
f1: { kind: 'format', hash: 'h' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const WORDS = { Post: 'Tweet', Posts: 'Tweets', post: 'tweet', posts: 'tweets', Repost: 'Retweet' };
|
||||||
|
const wording = (extra: object = {}) => pack({}, { rewrite: { words: WORDS }, when: { languages: ['en'] }, ...extra });
|
||||||
|
|
||||||
|
test('rewrite: whole words in the own text of the site, carrying none of its sentences', () => {
|
||||||
|
const compiled = compilePack(wording(), REWRITE_INVENTORY);
|
||||||
|
assert.equal(compiled.values.size, 0);
|
||||||
|
const engine = createStringEngine(REWRITE_INVENTORY, [compiled]);
|
||||||
|
engine.setLanguage('en');
|
||||||
|
assert.equal(engine.resolve('t1', 'Post, Repost and Posts of the postal service; compost'), 'Tweet, Retweet and Tweets of the postal service; compost');
|
||||||
|
assert.equal(engine.resolve('t1', 'Nothing here'), 'Nothing here');
|
||||||
|
const site = (e: { name: string; count: number }) => `${e.name} has ${e.count} posts`;
|
||||||
|
const message = engine.resolve('m1', site) as (e: unknown) => string;
|
||||||
|
assert.equal(message({ name: 'Post Malone', count: 3 }), 'Post Malone has 3 tweets', 'a parameter value is never reworded');
|
||||||
|
assert.equal(message({ name: 'Ann', count: 1 }), 'Ann has 1 tweets');
|
||||||
|
assert.equal(engine.resolve('m1', message), message, 'feeding the result back changes nothing');
|
||||||
|
assert.equal(engine.originals().get('m1'), site);
|
||||||
|
const rich = engine.resolve('r1', ['Your post ', , ' was a Repost']) as unknown[];
|
||||||
|
assert.deepEqual(rich, ['Your tweet ', , ' was a Retweet']);
|
||||||
|
const same = ['No words'];
|
||||||
|
assert.equal(engine.resolve('r1', same), same, 'an unchanged value is the same object');
|
||||||
|
assert.equal(engine.resolve('f1', 'Post'), 'Post', 'formatters are never touched');
|
||||||
|
assert.equal(engine.resolve('zzz', 'Post'), 'Post', 'unknown keys are never touched');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('rewrite: language condition, order with replacing packs, and its own validation', () => {
|
||||||
|
const compiled = compilePack(wording(), REWRITE_INVENTORY);
|
||||||
|
const turkish = createStringEngine(REWRITE_INVENTORY, [compiled]);
|
||||||
|
turkish.setLanguage('tr');
|
||||||
|
assert.equal(turkish.resolve('t1', 'Post'), 'Post');
|
||||||
|
// A later pack's own text wins and is not reworded; an earlier pack's text is.
|
||||||
|
const later = compilePack(pack({ t1: 'Post office' }, { language: 'en-x-b' }), REWRITE_INVENTORY);
|
||||||
|
const earlier = compilePack(pack({ t1: 'Post office' }, { language: 'en-x-a' }), REWRITE_INVENTORY);
|
||||||
|
const a = createStringEngine(REWRITE_INVENTORY, [compiled, later]);
|
||||||
|
a.setLanguage('en');
|
||||||
|
assert.equal(a.resolve('t1', 'Post'), 'Post office');
|
||||||
|
const b = createStringEngine(REWRITE_INVENTORY, [earlier, compiled]);
|
||||||
|
b.setLanguage('en');
|
||||||
|
assert.equal(b.resolve('t1', 'Post'), 'Tweet office');
|
||||||
|
const bad = (rewrite: unknown) => checkPackShape(wording({ rewrite })).filter(issue => issue.level === 'error').length;
|
||||||
|
assert.equal(bad({ words: { Post: 'Tweet' } }), 0);
|
||||||
|
assert.equal(bad({ words: {} }), 1);
|
||||||
|
assert.equal(bad({ words: { Post: '<b>Tweet</b>' } }), 1);
|
||||||
|
assert.equal(bad({ words: { 'two words': 'x' } }), 1);
|
||||||
|
assert.equal(bad({ words: { Post: 'Tweet' }, code: 1 }), 1);
|
||||||
|
assert.equal(bad({ words: Object.fromEntries(Array.from({ length: 65 }, (_, i) => [`w${i}`, 'x'])) }), 1);
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
import { themeDoctor } from '../src/themeDoctor.ts';
|
import { DOCTOR_MESSAGES, themeDoctor } from '../src/themeDoctor.ts';
|
||||||
import { sanitizeSpec } from '../src/themeSpec.ts';
|
import { sanitizeSpec } from '../src/themeSpec.ts';
|
||||||
|
|
||||||
const ids = (raw: unknown) => themeDoctor(sanitizeSpec(raw)).map(advice => advice.id);
|
const ids = (raw: unknown) => themeDoctor(sanitizeSpec(raw)).map(advice => advice.id);
|
||||||
|
|
@ -42,3 +42,34 @@ test('unreadable colors are named with their contrast', () => {
|
||||||
assert.equal(text.kind, 'contrast');
|
assert.equal(text.kind, 'contrast');
|
||||||
assert.match(text.text, /\d\.\d\d:1/);
|
assert.match(text.text, /\d\.\d\d:1/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('every finding says where it is (token or selector), what it found and how to fix it', () => {
|
||||||
|
const css = '.card { border-radius: 4px; }\n.row { border-radius: 2px; }\n.row { border-radius: 3px; }\n@media (min-width: 1px) { .nav a { display: none; } }\n* { margin: 0 }';
|
||||||
|
const theme = sanitizeSpec({ name: 'Where', css, colors: { bg: '#000000', text: '#111111', accent: '#1d9bf0' }, components: { postText: { fontSize: 13 } }, variants: { nav: 'top' } });
|
||||||
|
const found = themeDoctor(theme);
|
||||||
|
const radius = found.filter(item => item.id === 'css-radius').map(item => item.where);
|
||||||
|
assert.deepEqual(radius, ['.card { border-radius }', '.row { border-radius }'], 'one finding per rule, not per property');
|
||||||
|
assert.ok(found.some(item => item.id === 'css-hide' && item.where === '.nav a { display }'), 'a rule inside @media names its own selector');
|
||||||
|
assert.ok(found.some(item => item.id === 'css-universal'));
|
||||||
|
const token = found.find(item => item.id === 'contrast-text')!;
|
||||||
|
assert.equal(token.where, 'colors.text');
|
||||||
|
assert.equal(token.key, 'contrast');
|
||||||
|
assert.deepEqual(Object.keys(token.params), ['token', 'ratio']);
|
||||||
|
assert.match(token.text, /^The text color was adjusted/);
|
||||||
|
assert.ok(found.some(item => item.where === 'components.postText.fontSize' && item.params.size === '13'));
|
||||||
|
assert.ok(found.some(item => item.where === 'variants.nav' && item.params.position === 'top'));
|
||||||
|
for (const item of found) {
|
||||||
|
assert.ok(item.fix.length > 10, `${item.id} has a fix hint`);
|
||||||
|
assert.ok(`wb.doctor.${item.key}.found` in DOCTOR_MESSAGES && `wb.doctor.${item.key}.fix` in DOCTOR_MESSAGES, `${item.key} has catalog words`);
|
||||||
|
assert.ok(!/\{\w+\}/.test(item.text + item.fix), `${item.id}: every slot is filled`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('the doctor\'s words are plain text with only the slots its findings fill', () => {
|
||||||
|
for (const [key, text] of Object.entries(DOCTOR_MESSAGES)) {
|
||||||
|
assert.ok(!/[<>]/.test(text), `${key} has no markup`);
|
||||||
|
for (const slot of text.matchAll(/\{(\w+)\}/g)) assert.ok(['token', 'ratio', 'size', 'position'].includes(slot[1]!), `${key}: {${slot[1]}}`);
|
||||||
|
}
|
||||||
|
const ids = new Set(Object.keys(DOCTOR_MESSAGES).map(key => key.replace(/\.(found|fix)$/, '')));
|
||||||
|
for (const id of ids) assert.ok(`${id}.found` in DOCTOR_MESSAGES && `${id}.fix` in DOCTOR_MESSAGES, id);
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ import { ThemeDots } from '../frame/PaneTheme.tsx';
|
||||||
import { shell, type WebParams } from '../frame/state.ts';
|
import { shell, type WebParams } from '../frame/state.ts';
|
||||||
import { assign } from '../frame/themeScopes.ts';
|
import { assign } from '../frame/themeScopes.ts';
|
||||||
import { tabProfile } from '../profileModel.ts';
|
import { tabProfile } from '../profileModel.ts';
|
||||||
import { Button, ColorField, Row, Section, Segmented, Select, Slider, Toggle, useSettingsQuery, type Option } from './controls.tsx';
|
import { Badge, Button, ColorField, Row, Section, Segmented, Select, Slider, Toggle, useSettingsQuery, type Option } from './controls.tsx';
|
||||||
import { IconPackImport, IconPackReview } from './IconPackInstall.tsx';
|
import { IconPackImport, IconPackReview } from './IconPackInstall.tsx';
|
||||||
import type { IconPack } from '../../../runtime/src/themeIcons.ts';
|
import type { IconPack } from '../../../runtime/src/themeIcons.ts';
|
||||||
import { themeDoctor } from '../../../runtime/src/themeDoctor.ts';
|
import { themeDoctor, type DoctorAdvice } from '../../../runtime/src/themeDoctor.ts';
|
||||||
import { bytesLabel, defaultWeights, loadCatalog, weightsLabel } from './fonts/catalog.ts';
|
import { bytesLabel, defaultWeights, loadCatalog, weightsLabel } from './fonts/catalog.ts';
|
||||||
import { FontRoles } from './fonts/FontRoles.tsx';
|
import { FontRoles } from './fonts/FontRoles.tsx';
|
||||||
import { CustomCssEditor } from './Plugins.tsx';
|
import { CustomCssEditor } from './Plugins.tsx';
|
||||||
|
|
@ -283,6 +283,8 @@ export function Appearance({ notify }: { notify: Notify }) {
|
||||||
<ThemeCssEditor key={choice.preset} css={effective.css} onApply={text => { void override({ css: { text } }); notify(t('wb.appearance.cssApplied', { name: base.name })); }}/>
|
<ThemeCssEditor key={choice.preset} css={effective.css} onApply={text => { void override({ css: { text } }); notify(t('wb.appearance.cssApplied', { name: base.name })); }}/>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
<DoctorReport theme={effective}/>
|
||||||
|
|
||||||
<Section title={t('wb.appearance.scopes')} id="theme-scopes" hint={searching ? undefined : t('wb.appearance.scopesHint')}>
|
<Section title={t('wb.appearance.scopes')} id="theme-scopes" hint={searching ? undefined : t('wb.appearance.scopesHint')}>
|
||||||
<Row label={t('wb.appearance.chrome')} hint={t('wb.appearance.chromeHint')}
|
<Row label={t('wb.appearance.chrome')} hint={t('wb.appearance.chromeHint')}
|
||||||
keywords="chrome window tabs titlebar panel colors own style">
|
keywords="chrome window tabs titlebar panel colors own style">
|
||||||
|
|
@ -299,6 +301,24 @@ export function Appearance({ notify }: { notify: Notify }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Theme choices for a scope row: follow (the level above) plus every theme with its swatch. */
|
/** Theme choices for a scope row: follow (the level above) plus every theme with its swatch. */
|
||||||
|
/** The theme doctor's full report on the theme as it is now: every finding, where it is, what it found, how to fix it. Advice only. */
|
||||||
|
function DoctorReport({ theme }: { theme: ThemeSpec }) {
|
||||||
|
const t = useT();
|
||||||
|
const advice = themeDoctor(theme);
|
||||||
|
const words = (item: DoctorAdvice, part: 'found' | 'fix') => t(`wb.doctor.${item.key}.${part}`, item.params);
|
||||||
|
return <Section title={t('wb.doctor.title')} id="theme-doctor" hint={t('wb.doctor.hint')} action={<Badge tone={advice.length ? undefined : 'ok'}>{t('wb.doctor.count', { count: advice.length })}</Badge>}>
|
||||||
|
{advice.length === 0
|
||||||
|
? <p className="btp-hint">{t('wb.doctor.empty')}</p>
|
||||||
|
: <ul className="bt-doctor" aria-label={t('wb.doctor.title')}>
|
||||||
|
{advice.map((item, index) => <li key={`${item.id}:${item.where}:${index}`} className={`bt-doctor-item is-${item.kind}`}>
|
||||||
|
<span className="bt-doctor-head"><Badge>{t(`wb.doctor.kind.${item.kind}`)}</Badge><strong>{words(item, 'found')}</strong></span>
|
||||||
|
<small className="bt-doctor-line">{t('wb.doctor.where')}: <code>{item.where}</code></small>
|
||||||
|
<small className="bt-doctor-line">{t('wb.doctor.fix')}: {words(item, 'fix')}</small>
|
||||||
|
</li>)}
|
||||||
|
</ul>}
|
||||||
|
</Section>;
|
||||||
|
}
|
||||||
|
|
||||||
function scopeOptions(follow: string): Array<Option<string>> {
|
function scopeOptions(follow: string): Array<Option<string>> {
|
||||||
// Called during render of components that use useT(), so the labels follow the language.
|
// Called during render of components that use useT(), so the labels follow the language.
|
||||||
return [{ value: '', label: follow }, ...panelThemes().store.allThemes().map(theme => ({ value: theme.id, label: theme.name, icon: <ThemeDots theme={theme}/> }))];
|
return [{ value: '', label: follow }, ...panelThemes().store.allThemes().map(theme => ({ value: theme.id, label: theme.name, icon: <ThemeDots theme={theme}/> }))];
|
||||||
|
|
@ -408,7 +428,7 @@ function ImportPanel({ onImport, onCancel }: { onImport(theme: ThemeSpec, warnin
|
||||||
if ('error' in parsed) { setError(parsed.error); return; }
|
if ('error' in parsed) { setError(parsed.error); return; }
|
||||||
// The theme doctor: advice only (never a block); contrast is already in the warnings.
|
// The theme doctor: advice only (never a block); contrast is already in the warnings.
|
||||||
const hints = themeDoctor(parsed.theme).filter(advice => advice.kind !== 'contrast');
|
const hints = themeDoctor(parsed.theme).filter(advice => advice.kind !== 'contrast');
|
||||||
onImport(parsed.theme, hints.length ? [...parsed.warnings, t('wb.appearance.doctorHints', { count: hints.length, hint: hints[0]!.text })] : parsed.warnings);
|
onImport(parsed.theme, hints.length ? [...parsed.warnings, t('wb.appearance.doctorHints', { count: hints.length, hint: t(`wb.doctor.${hints[0]!.key}.found`, hints[0]!.params) })] : parsed.warnings);
|
||||||
};
|
};
|
||||||
return <div className="bt-import">
|
return <div className="bt-import">
|
||||||
<div className="bt-import-drop" onDragOver={event => event.preventDefault()}
|
<div className="bt-import-drop" onDragOver={event => event.preventDefault()}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// site tabs the new delivery (`strings_apply`: the packs that are on, in order, with the inventory
|
// site tabs the new delivery (`strings_apply`: the packs that are on, in order, with the inventory
|
||||||
// slice their keys need); the tabs reload to show it. Packs are data only: nothing here runs code.
|
// slice their keys need); the tabs reload to show it. Packs are data only: nothing here runs code.
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import type { PageInventory } from '../../../runtime/src/stringPacks.ts';
|
import { hashText, type PageInventory } from '../../../runtime/src/stringPacks.ts';
|
||||||
import { invoke } from '../frame/bridge.ts';
|
import { invoke } from '../frame/bridge.ts';
|
||||||
import { useT } from '../frame/hooks.ts';
|
import { useT } from '../frame/hooks.ts';
|
||||||
import { t as translate } from '../frame/i18n.ts';
|
import { t as translate } from '../frame/i18n.ts';
|
||||||
|
|
@ -20,16 +20,41 @@ const ICON = 'M2.5 3.5h7M6 2v1.5M8 3.5c-.6 2.9-2.6 5-5.4 6.1M4.6 6.2c.8 1.2 2 2.
|
||||||
|
|
||||||
type Row = InstalledStrings & { summary: StringsSummary | null };
|
type Row = InstalledStrings & { summary: StringsSummary | null };
|
||||||
|
|
||||||
/** Hands the site tabs the packs that are on (in `packs` order). */
|
/**
|
||||||
export async function applyStringPacks(inventory: PageInventory, packs?: InstalledStrings[]): Promise<void> {
|
* Packs the app itself provides (pack documents as text), applied before the installed ones, so an
|
||||||
|
* installed pack wins where both change a word. They follow the app's own settings (the Twitter
|
||||||
|
* wording is a pack that is only here while its setting is on); they are not listed or removable.
|
||||||
|
*/
|
||||||
|
export type BuiltInPacks = () => string[] | Promise<string[]>;
|
||||||
|
|
||||||
|
const DELIVERED_KEY = 'wayBetter.stringsDelivered';
|
||||||
|
/** What the tabs were last handed ("none" for no delivery), so a start-up check can skip a reload. */
|
||||||
|
const delivered = () => { try { return localStorage.getItem(DELIVERED_KEY) ?? 'none'; } catch { return 'none'; } };
|
||||||
|
|
||||||
|
async function deliveryOf(inventory: PageInventory, packs: InstalledStrings[] | undefined, builtIn: BuiltInPacks | undefined): Promise<string | null> {
|
||||||
const list = packs ?? (await invoke<{ packs: InstalledStrings[] }>('strings_list')).packs;
|
const list = packs ?? (await invoke<{ packs: InstalledStrings[] }>('strings_list')).packs;
|
||||||
const texts: string[] = [];
|
const texts: string[] = [...(await builtIn?.() ?? [])];
|
||||||
for (const pack of list) if (pack.enabled) texts.push(await invoke<string>('strings_read', { id: pack.id }));
|
for (const pack of list) if (pack.enabled) texts.push(await invoke<string>('strings_read', { id: pack.id }));
|
||||||
await invoke('strings_apply', { delivery: buildDelivery(texts, inventory, { translate: translating() }) });
|
return buildDelivery(texts, inventory, { translate: translating() });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createStringPacksSection(options: { inventory: PageInventory; id?: string; icon?: string }): PanelSection {
|
/** Hands the site tabs the packs that are on (built-in ones first, then `packs` in order). */
|
||||||
const { inventory } = options;
|
export async function applyStringPacks(inventory: PageInventory, packs?: InstalledStrings[], builtIn?: BuiltInPacks): Promise<void> {
|
||||||
|
const delivery = await deliveryOf(inventory, packs, builtIn);
|
||||||
|
await invoke('strings_apply', { delivery });
|
||||||
|
try { localStorage.setItem(DELIVERED_KEY, delivery === null ? 'none' : hashText(delivery)); } catch { /* the next start-up check applies again */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** At start: hands the tabs the delivery only when it differs from the one they were last given (a tab reloads for each). */
|
||||||
|
export async function syncStringPacks(inventory: PageInventory, builtIn?: BuiltInPacks): Promise<boolean> {
|
||||||
|
const delivery = await deliveryOf(inventory, undefined, builtIn);
|
||||||
|
if ((delivery === null ? 'none' : hashText(delivery)) === delivered()) return false;
|
||||||
|
await applyStringPacks(inventory, undefined, builtIn);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createStringPacksSection(options: { inventory: PageInventory; builtIn?: BuiltInPacks; id?: string; icon?: string }): PanelSection {
|
||||||
|
const { inventory, builtIn } = options;
|
||||||
|
|
||||||
function StringPacks({ notify, openSection }: SectionProps) {
|
function StringPacks({ notify, openSection }: SectionProps) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
|
|
@ -60,7 +85,7 @@ export function createStringPacksSection(options: { inventory: PageInventory; id
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
try {
|
try {
|
||||||
const { packs } = await invoke<{ packs: InstalledStrings[] }>('strings_set', { order: next.map(row => row.id), enabled: next.filter(row => row.enabled).map(row => row.id) });
|
const { packs } = await invoke<{ packs: InstalledStrings[] }>('strings_set', { order: next.map(row => row.id), enabled: next.filter(row => row.enabled).map(row => row.id) });
|
||||||
await applyStringPacks(inventory, packs);
|
await applyStringPacks(inventory, packs, builtIn);
|
||||||
setRows(packs.map(pack => ({ ...pack, summary: next.find(row => row.id === pack.id)?.summary ?? null })));
|
setRows(packs.map(pack => ({ ...pack, summary: next.find(row => row.id === pack.id)?.summary ?? null })));
|
||||||
notify(t('wb.strings.applied', { site: name }));
|
notify(t('wb.strings.applied', { site: name }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -100,7 +125,7 @@ export function createStringPacksSection(options: { inventory: PageInventory; id
|
||||||
<Button size="sm" tone="danger" disabled={busy} onClick={() => {
|
<Button size="sm" tone="danger" disabled={busy} onClick={() => {
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
void invoke<{ packs: InstalledStrings[] }>('strings_remove', { id: row.id })
|
void invoke<{ packs: InstalledStrings[] }>('strings_remove', { id: row.id })
|
||||||
.then(async ({ packs }) => { await applyStringPacks(inventory, packs); notify(t('wb.strings.removed', { name: row.name })); await load(); })
|
.then(async ({ packs }) => { await applyStringPacks(inventory, packs, builtIn); notify(t('wb.strings.removed', { name: row.name })); await load(); })
|
||||||
.catch(error => notify(String(error), true))
|
.catch(error => notify(String(error), true))
|
||||||
.finally(() => setBusy(false));
|
.finally(() => setBusy(false));
|
||||||
}}>{t('wb.strings.remove')}</Button>
|
}}>{t('wb.strings.remove')}</Button>
|
||||||
|
|
@ -112,7 +137,7 @@ export function createStringPacksSection(options: { inventory: PageInventory; id
|
||||||
try { localStorage.setItem(TRANSLATE_KEY, checked ? '1' : '0'); } catch { /* it still applies once */ }
|
try { localStorage.setItem(TRANSLATE_KEY, checked ? '1' : '0'); } catch { /* it still applies once */ }
|
||||||
setTranslate(checked);
|
setTranslate(checked);
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
void applyStringPacks(inventory).then(() => notify(t('wb.strings.applied', { site: name }))).catch(error => notify(String(error), true)).finally(() => setBusy(false));
|
void applyStringPacks(inventory, undefined, builtIn).then(() => notify(t('wb.strings.applied', { site: name }))).catch(error => notify(String(error), true)).finally(() => setBusy(false));
|
||||||
}}/>
|
}}/>
|
||||||
<div className="btp-strings-text"><strong>{t('wb.strings.translate')}</strong><small>{t('wb.strings.translateHint', { site: name })}</small></div>
|
<div className="btp-strings-text"><strong>{t('wb.strings.translate')}</strong><small>{t('wb.strings.translateHint', { site: name })}</small></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -230,3 +230,11 @@
|
||||||
.wb-fontlist b { font-size: 17px; font-weight: 450; }
|
.wb-fontlist b { font-size: 17px; font-weight: 450; }
|
||||||
.wb-fontlist small { color: var(--c-muted); font: 11px/1.4 var(--f-mono); }
|
.wb-fontlist small { color: var(--c-muted); font: 11px/1.4 var(--f-mono); }
|
||||||
.wb-fontlist ul { margin: 0; padding: 0; list-style: none; }
|
.wb-fontlist ul { margin: 0; padding: 0; list-style: none; }
|
||||||
|
|
||||||
|
/* The theme doctor's full report (advice only). */
|
||||||
|
.bt-doctor { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
|
||||||
|
.bt-doctor-item { display: grid; gap: 3px; padding: 9px 2px; }
|
||||||
|
.bt-doctor-item + .bt-doctor-item { border-block-start: 1px solid var(--c-line-soft); }
|
||||||
|
.bt-doctor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||||
|
.bt-doctor-line { color: var(--c-muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
|
||||||
|
.bt-doctor-line code { font: 11.5px/1.4 var(--f-mono); color: var(--c-text); }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
// are counts, names and paths. The panel reads the translations through the app's i18n instance
|
// are counts, names and paths. The panel reads the translations through the app's i18n instance
|
||||||
// (setShellI18n); tests/panel.test.ts checks that every key the panel uses is here.
|
// (setShellI18n); tests/panel.test.ts checks that every key the panel uses is here.
|
||||||
|
|
||||||
|
import { DOCTOR_MESSAGES } from '../../../runtime/src/themeDoctor.ts';
|
||||||
|
|
||||||
export const PANEL_MESSAGES = {
|
export const PANEL_MESSAGES = {
|
||||||
'wb.appearance.accent': 'Accent',
|
'wb.appearance.accent': 'Accent',
|
||||||
'wb.appearance.accentColor': 'Accent color',
|
'wb.appearance.accentColor': 'Accent color',
|
||||||
|
|
@ -764,6 +766,17 @@ export const PANEL_MESSAGES = {
|
||||||
'wb.ui.select.placeholder': 'Choose…',
|
'wb.ui.select.placeholder': 'Choose…',
|
||||||
'wb.ui.stepper.decrease': 'Decrease {label}',
|
'wb.ui.stepper.decrease': 'Decrease {label}',
|
||||||
'wb.ui.stepper.increase': 'Increase {label}',
|
'wb.ui.stepper.increase': 'Increase {label}',
|
||||||
|
'wb.doctor.title': 'Theme doctor',
|
||||||
|
'wb.doctor.hint': 'Advice about this theme: lighter ways to do the same, costs and contrast. It only advises; nothing is blocked or changed.',
|
||||||
|
'wb.doctor.empty': 'Nothing to report: the theme uses tokens and component settings, and nothing in it is costly.',
|
||||||
|
'wb.doctor.count': '{count, plural, one {# finding} other {# findings}}',
|
||||||
|
'wb.doctor.kind.lighter': 'A lighter way',
|
||||||
|
'wb.doctor.kind.performance': 'Performance',
|
||||||
|
'wb.doctor.kind.accessibility': 'Accessibility',
|
||||||
|
'wb.doctor.kind.contrast': 'Contrast',
|
||||||
|
'wb.doctor.where': 'Where',
|
||||||
|
'wb.doctor.fix': 'Fix',
|
||||||
|
...DOCTOR_MESSAGES,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type PanelKey = keyof typeof PANEL_MESSAGES;
|
export type PanelKey = keyof typeof PANEL_MESSAGES;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ export function packSummary(text: string, inventory: PageInventory): StringsSumm
|
||||||
// The page inventory lists every key once, in its groups: count what a pack can replace.
|
// The page inventory lists every key once, in its groups: count what a pack can replace.
|
||||||
for (const ids of [inventory.text, inventory.closed]) if (ids) for (const id of ids.split(' ')) { if (lookup(id) && translatable(lookup(id)!.kind)) translatableCount += 1; else closed += 1; }
|
for (const ids of [inventory.text, inventory.closed]) if (ids) for (const id of ids.split(' ')) { if (lookup(id) && translatable(lookup(id)!.kind)) translatableCount += 1; else closed += 1; }
|
||||||
translatableCount += Object.keys(inventory.message).length;
|
translatableCount += Object.keys(inventory.message).length;
|
||||||
|
translatableCount += Object.keys(inventory.rich ?? {}).length;
|
||||||
if (record.catalog !== inventory.catalog) {
|
if (record.catalog !== inventory.catalog) {
|
||||||
return { language, translated: 0, translatable: translatableCount, closed, unknown: Object.keys(record.strings).length, refused: 0, sample: [], otherCatalog: true };
|
return { language, translated: 0, translatable: translatableCount, closed, unknown: Object.keys(record.strings).length, refused: 0, sample: [], otherCatalog: true };
|
||||||
}
|
}
|
||||||
|
|
@ -73,12 +74,15 @@ export const coveragePercent = (summary: Pick<StringsSummary, 'translated' | 'tr
|
||||||
export function buildDelivery(texts: readonly string[], inventory: PageInventory, options: { translate?: boolean } = {}): string | null {
|
export function buildDelivery(texts: readonly string[], inventory: PageInventory, options: { translate?: boolean } = {}): string | null {
|
||||||
const packs: unknown[] = [];
|
const packs: unknown[] = [];
|
||||||
const ids = new Set<string>();
|
const ids = new Set<string>();
|
||||||
|
// A pack that rewords the site's own text needs the shape of every key, not a slice.
|
||||||
|
let rewording = false;
|
||||||
for (const text of texts) {
|
for (const text of texts) {
|
||||||
let pack: unknown;
|
let pack: unknown;
|
||||||
try { pack = JSON.parse(text); } catch { continue; }
|
try { pack = JSON.parse(text); } catch { continue; }
|
||||||
let compiled;
|
let compiled;
|
||||||
try { compiled = compilePack(pack, inventory); } catch { continue; }
|
try { compiled = compilePack(pack, inventory); } catch { continue; }
|
||||||
if (!compiled.values.size) continue;
|
if (!compiled.values.size && !compiled.rewrite) continue;
|
||||||
|
if (compiled.rewrite) rewording = true;
|
||||||
packs.push(pack);
|
packs.push(pack);
|
||||||
for (const id of compiled.values.keys()) ids.add(id);
|
for (const id of compiled.values.keys()) ids.add(id);
|
||||||
if (packs.length >= 8) break;
|
if (packs.length >= 8) break;
|
||||||
|
|
@ -86,5 +90,5 @@ export function buildDelivery(texts: readonly string[], inventory: PageInventory
|
||||||
// Translate mode: the whole inventory (the author may change any string), packs or not.
|
// Translate mode: the whole inventory (the author may change any string), packs or not.
|
||||||
if (options.translate) return JSON.stringify({ inventory, packs, translate: true });
|
if (options.translate) return JSON.stringify({ inventory, packs, translate: true });
|
||||||
if (!packs.length) return null;
|
if (!packs.length) return null;
|
||||||
return JSON.stringify({ inventory: sliceInventory(inventory, ids), packs });
|
return JSON.stringify({ inventory: rewording ? inventory : sliceInventory(inventory, ids), packs });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,3 +39,17 @@ test('store model: string packs by file name and by install record', () => {
|
||||||
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': record } as never }), { state: 'update', version: '1.0.0' });
|
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': record } as never }), { state: 'update', version: '1.0.0' });
|
||||||
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': { ...record, sha256: 'b'.repeat(64) } } as never }), { state: 'installed', version: '1.0.0' });
|
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': { ...record, sha256: 'b'.repeat(64) } } as never }), { state: 'installed', version: '1.0.0' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('delivery: a rewording pack counts as usable and brings the whole inventory; rich keys with slots are translatable', () => {
|
||||||
|
const rich: PageInventory = { ...INVENTORY, rich: { d0000001: 2 } };
|
||||||
|
const wording = pack({}, { name: 'Wording', language: 'en-x-twitter', when: { languages: ['en'] }, rewrite: { words: { Post: 'Tweet' } } });
|
||||||
|
const delivery = JSON.parse(buildDelivery([wording, pack({ a0000001: 'Hejmo' })], rich)!);
|
||||||
|
assert.deepEqual(delivery.inventory, rich, 'the whole inventory, not a slice');
|
||||||
|
assert.deepEqual(delivery.packs.map((p: { name: string }) => p.name), ['Wording', 'Esperanto']);
|
||||||
|
assert.equal(buildDelivery([wording], rich) !== null, true);
|
||||||
|
assert.equal(buildDelivery([pack({})], rich), null, 'a pack with neither strings nor a rule changes nothing');
|
||||||
|
const summary = packSummary(pack({ d0000001: 'Legu {e1} antaŭ {e0}.', a0000001: 'Hejmo' }), rich)!;
|
||||||
|
assert.equal(summary.translatable, 5, 'the rich key with slots is counted as translatable');
|
||||||
|
assert.equal(summary.translated, 2);
|
||||||
|
assert.equal(summary.refused, 0);
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ export async function checkPack(packFile, inventories, { verbose = false } = {})
|
||||||
const coverage = rules.coverage(match.inventory, compiled);
|
const coverage = rules.coverage(match.inventory, compiled);
|
||||||
lines.push(`${pack.name} (${pack.language}) for ${pack.site}/${pack.catalog}, inventory build ${match.inventory.build ?? 'unknown'}`);
|
lines.push(`${pack.name} (${pack.language}) for ${pack.site}/${pack.catalog}, inventory build ${match.inventory.build ?? 'unknown'}`);
|
||||||
lines.push(`${report.total} strings: ${report.valid} valid, ${report.rejected.length} refused, ${report.unknown.length} unknown`);
|
lines.push(`${report.total} strings: ${report.valid} valid, ${report.rejected.length} refused, ${report.unknown.length} unknown`);
|
||||||
|
if (pack.when?.languages) lines.push(`Applies only while the site shows: ${pack.when.languages.join(', ')}`);
|
||||||
|
if (pack.rewrite) lines.push(`Rewords ${Object.keys(pack.rewrite.words).length} words inside the site's own text: ${Object.keys(pack.rewrite.words).slice(0, 6).join(', ')}${Object.keys(pack.rewrite.words).length > 6 ? ', …' : ''}`);
|
||||||
const list = (items, render) => {
|
const list = (items, render) => {
|
||||||
for (const item of verbose ? items : items.slice(0, LISTED)) lines.push(` ${render(item)}`);
|
for (const item of verbose ? items : items.slice(0, LISTED)) lines.push(` ${render(item)}`);
|
||||||
if (!verbose && items.length > LISTED) lines.push(` … ${items.length - LISTED} more (--verbose lists all)`);
|
if (!verbose && items.length > LISTED) lines.push(` … ${items.length - LISTED} more (--verbose lists all)`);
|
||||||
|
|
|
||||||
|
|
@ -1244,6 +1244,46 @@
|
||||||
"wb.appearance.icons.remove": "إزالة {name}",
|
"wb.appearance.icons.remove": "إزالة {name}",
|
||||||
"wb.appearance.icons.removed": "أُزيلت حزمة الأيقونات «{name}».",
|
"wb.appearance.icons.removed": "أُزيلت حزمة الأيقونات «{name}».",
|
||||||
"wb.appearance.icons.imported": "حزم الأيقونات المستوردة",
|
"wb.appearance.icons.imported": "حزم الأيقونات المستوردة",
|
||||||
|
"wb.doctor.title": "طبيب السمة",
|
||||||
|
"wb.doctor.hint": "نصائح حول هذه السمة: طرق أخف لفعل الشيء نفسه، والتكاليف، والتباين. هو يقدّم النصح فقط؛ لا يُحظر شيء ولا يتغيّر شيء.",
|
||||||
|
"wb.doctor.empty": "لا شيء للإبلاغ عنه: السمة تستخدم الرموز وإعدادات المكوّنات، ولا شيء فيها مكلف.",
|
||||||
|
"wb.doctor.count": "{count, plural, zero {لا نتائج} one {نتيجة واحدة} two {نتيجتان} few {# نتائج} many {# نتيجة} other {# نتيجة}}",
|
||||||
|
"wb.doctor.kind.lighter": "طريقة أخف",
|
||||||
|
"wb.doctor.kind.performance": "الأداء",
|
||||||
|
"wb.doctor.kind.accessibility": "إمكانية الوصول",
|
||||||
|
"wb.doctor.kind.contrast": "التباين",
|
||||||
|
"wb.doctor.where": "أين",
|
||||||
|
"wb.doctor.fix": "الإصلاح",
|
||||||
|
"wb.doctor.css-radius.found": "تضبط هذه القاعدة أنصاف أقطار الزوايا في CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "اضبطها عبر radius لجزء ضمن components، أو shape.radius لها جميعًا: لا حاجة إلى CSS، ويستمر العمل حتى لو غيّر الموقع أسماء فئاته.",
|
||||||
|
"wb.doctor.css-bevel.found": "ترسم هذه القاعدة حافة مشطوفة بظلال داخلية متراكبة.",
|
||||||
|
"wb.doctor.css-bevel.fix": "استخدم borderStyle \"bevel-out\" أو \"bevel-in\" على جزء ضمن components: فهو يرسم الحافة المشطوفة من ألوان السمة.",
|
||||||
|
"wb.doctor.css-hide.found": "تخفي هذه القاعدة شيئًا باستخدام display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "استخدم visible على جزء ضمن components (الصور الرمزية، العدّادات، الأسماء) أو نمط تخطيط مثل sidebar: hidden؛ وبذلك يمكن للمالك إعادته.",
|
||||||
|
"wb.doctor.css-color.found": "تستخدم هذه القاعدة لونًا حرفيًا.",
|
||||||
|
"wb.doctor.css-color.fix": "سمِّ دورًا (text وmuted وaccent وsurface…) في colors أو في مكوّن، ليشمله فحص التباين.",
|
||||||
|
"wb.doctor.css-font.found": "تضبط هذه القاعدة عائلة خطوط.",
|
||||||
|
"wb.doctor.css-font.fix": "استخدم font.roles: فهو يضبط خطوط المنشورات والعناوين والأرقام والخط أحادي المسافة دون CSS.",
|
||||||
|
"wb.doctor.css-has.found": "تستخدم هذه القاعدة :has()، ويُعاد مطابقتها عند كل تغيير في الصفحة.",
|
||||||
|
"wb.doctor.css-has.fix": "تجنّب :has() في القواعد المتكررة على امتداد الخلاصة، أو اربط القاعدة بجزء.",
|
||||||
|
"wb.doctor.css-universal.found": "تستخدم هذه القاعدة محدِّدًا شاملًا (*) تتم مطابقته مع كل عنصر.",
|
||||||
|
"wb.doctor.css-universal.fix": "اربط القاعدة بجزء بدلًا من ذلك.",
|
||||||
|
"wb.doctor.css-blur.found": "تطمس هذه القاعدة ما خلفها (backdrop-filter)، وهو مكلف في الأجزاء المتكررة.",
|
||||||
|
"wb.doctor.css-blur.fix": "استخدم تعبئة الزجاج في الأشرطة واللوحات: فهي المكان الأرخص للطمس.",
|
||||||
|
"wb.doctor.css-outline-none.found": "تزيل هذه القاعدة مخطط التركيز، فلا يعود تركيز لوحة المفاتيح مرئيًا.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "استخدم decor.focusRing لرسم حلقة تركيز مرئية بدلًا من ذلك.",
|
||||||
|
"wb.doctor.css-motion.found": "تحرّك هذه القاعدة العناصر دون التحقق من تفضيل تقليل الحركة.",
|
||||||
|
"wb.doctor.css-motion.fix": "أبقِ الحركة داخل @media (prefers-reduced-motion: no-preference)، أو دع decor.motion يتولى ذلك عنك.",
|
||||||
|
"wb.doctor.css-size.found": "يزيد طول CSS على 20,000 حرف.",
|
||||||
|
"wb.doctor.css-size.fix": "يعيد الموقع حساب الأنماط مع كل قاعدة؛ والرموز وإعدادات المكوّنات تُترجم إلى قواعد أقل.",
|
||||||
|
"wb.doctor.contrast.found": "تم تعديل لون {token} ليبقى مقروءًا ({ratio}:1 على الخلفية).",
|
||||||
|
"wb.doctor.contrast.fix": "اختر لون {token} أفتح أو أغمق؛ وإلى ذلك الحين تُعرض السمة باللون المعدَّل.",
|
||||||
|
"wb.doctor.glass-post.found": "تم ضبط الزجاج على المنشورات، لكنه لا يُرسم: الطمس على كل منشور في الخلاصة مكلف جدًا.",
|
||||||
|
"wb.doctor.glass-post.fix": "استخدم تعبئة صلبة أو ملوّنة للمنشورات، واحتفظ بالزجاج للأشرطة واللوحات.",
|
||||||
|
"wb.doctor.small-post-text.found": "حجم نص المنشور {size}px، وهو صعب القراءة على كثيرين.",
|
||||||
|
"wb.doctor.small-post-text.fix": "استخدم 14px أو أكثر لحجم نص المنشور، أو كبّر حجم النص في السمة كلها.",
|
||||||
|
"wb.doctor.nav-moved.found": "نُقل التنقل إلى {position}، مما يغيّر المكان الذي يبحث عنه الناس.",
|
||||||
|
"wb.doctor.nav-moved.fix": "ينطبق ذلك فقط على الأجزاء العريضة، ويمكن للمالك إيقاف تغييرات التخطيط. أبقِ الموضع الافتراضي ما لم يتطلب التخطيط غير ذلك.",
|
||||||
"wb.setup.title": "مشاركة إعدادي",
|
"wb.setup.title": "مشاركة إعدادي",
|
||||||
"wb.setup.hint": "سمتك وأيقوناتك ووضعك والميزات المفعّلة، في رابط واحد أو ملف صغير. يمكن لأي شخص استخدامه ليبدأ مما لديك.",
|
"wb.setup.hint": "سمتك وأيقوناتك ووضعك والميزات المفعّلة، في رابط واحد أو ملف صغير. يمكن لأي شخص استخدامه ليبدأ مما لديك.",
|
||||||
"wb.setup.shareLabel": "إعدادك",
|
"wb.setup.shareLabel": "إعدادك",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "{name} entfernen",
|
"wb.appearance.icons.remove": "{name} entfernen",
|
||||||
"wb.appearance.icons.removed": "Das Symbolpaket „{name}“ ist entfernt.",
|
"wb.appearance.icons.removed": "Das Symbolpaket „{name}“ ist entfernt.",
|
||||||
"wb.appearance.icons.imported": "Importierte Symbolpakete",
|
"wb.appearance.icons.imported": "Importierte Symbolpakete",
|
||||||
|
"wb.doctor.title": "Theme-Doktor",
|
||||||
|
"wb.doctor.hint": "Hinweise zu diesem Theme: leichtere Wege zum selben Ergebnis, Kosten und Kontrast. Er rät nur; nichts wird blockiert oder geändert.",
|
||||||
|
"wb.doctor.empty": "Nichts zu melden: Das Theme nutzt Tokens und Komponenteneinstellungen, und nichts darin ist aufwendig.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# Befund} other {# Befunde}}",
|
||||||
|
"wb.doctor.kind.lighter": "Ein leichterer Weg",
|
||||||
|
"wb.doctor.kind.performance": "Leistung",
|
||||||
|
"wb.doctor.kind.accessibility": "Barrierefreiheit",
|
||||||
|
"wb.doctor.kind.contrast": "Kontrast",
|
||||||
|
"wb.doctor.where": "Wo",
|
||||||
|
"wb.doctor.fix": "Lösung",
|
||||||
|
"wb.doctor.css-radius.found": "Diese Regel legt Eckenradien in CSS fest.",
|
||||||
|
"wb.doctor.css-radius.fix": "Lege sie mit dem radius eines Teils unter components fest oder mit shape.radius für alle: Kein CSS nötig, und es funktioniert weiter, wenn die Seite ihre Klassen umbenennt.",
|
||||||
|
"wb.doctor.css-bevel.found": "Diese Regel zeichnet eine abgeschrägte Kante mit gestapelten inneren Schatten.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Verwende borderStyle \"bevel-out\" oder \"bevel-in\" bei einem Teil unter components: Die Schräge wird aus den Farben des Themes gezeichnet.",
|
||||||
|
"wb.doctor.css-hide.found": "Diese Regel blendet etwas mit display: none aus.",
|
||||||
|
"wb.doctor.css-hide.fix": "Verwende visible bei einem Teil unter components (Avatare, Zähler, Namen) oder eine Layout-Variante wie sidebar: hidden; so kann der Besitzer es wieder einblenden.",
|
||||||
|
"wb.doctor.css-color.found": "Diese Regel verwendet eine feste Farbe.",
|
||||||
|
"wb.doctor.css-color.fix": "Nenne in colors oder in einer Komponente eine Rolle (text, muted, accent, surface …), damit die Kontrastprüfung sie erfasst.",
|
||||||
|
"wb.doctor.css-font.found": "Diese Regel legt eine Schriftfamilie fest.",
|
||||||
|
"wb.doctor.css-font.fix": "Verwende font.roles: Damit legst du die Schriften für Posts, Überschriften, Zahlen und Monospace ohne CSS fest.",
|
||||||
|
"wb.doctor.css-has.found": "Diese Regel verwendet :has(), das bei jeder Änderung der Seite erneut geprüft wird.",
|
||||||
|
"wb.doctor.css-has.fix": "Verwende :has() nicht in Regeln, die sich in einer Timeline wiederholen, oder verankere die Regel an einem Teil.",
|
||||||
|
"wb.doctor.css-universal.found": "Diese Regel verwendet einen Universalselektor (*), der mit jedem Element abgeglichen wird.",
|
||||||
|
"wb.doctor.css-universal.fix": "Verankere die Regel stattdessen an einem Teil.",
|
||||||
|
"wb.doctor.css-blur.found": "Diese Regel weichzeichnet, was dahinter liegt (backdrop-filter), was bei sich wiederholenden Teilen aufwendig ist.",
|
||||||
|
"wb.doctor.css-blur.fix": "Nutze die Glasfüllung von Leisten und Panels: Dort ist Weichzeichnen günstiger.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Diese Regel entfernt den Fokusrahmen, sodass der Tastaturfokus nicht mehr sichtbar ist.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Verwende stattdessen decor.focusRing, um einen sichtbaren Fokusring zu zeichnen.",
|
||||||
|
"wb.doctor.css-motion.found": "Diese Regel animiert, ohne auf reduzierte Bewegung zu achten.",
|
||||||
|
"wb.doctor.css-motion.fix": "Halte Bewegung innerhalb von @media (prefers-reduced-motion: no-preference) oder lass decor.motion das für dich erledigen.",
|
||||||
|
"wb.doctor.css-size.found": "Das CSS ist länger als 20.000 Zeichen.",
|
||||||
|
"wb.doctor.css-size.fix": "Die Seite berechnet Stile für jede Regel neu; Tokens und Komponenteneinstellungen werden zu weniger Regeln kompiliert.",
|
||||||
|
"wb.doctor.contrast.found": "Die Farbe {token} wurde angepasst, damit sie lesbar bleibt ({ratio}:1 auf dem Hintergrund).",
|
||||||
|
"wb.doctor.contrast.fix": "Wähle eine hellere oder dunklere Farbe für {token}; bis dahin wird das Theme mit der angepassten angezeigt.",
|
||||||
|
"wb.doctor.glass-post.found": "Glas ist bei Posts gesetzt, wird aber nicht gezeichnet: Weichzeichnen bei jedem Post einer Timeline ist zu aufwendig.",
|
||||||
|
"wb.doctor.glass-post.fix": "Verwende für Posts eine einfarbige oder getönte Füllung und spare Glas für Leisten und Panels auf.",
|
||||||
|
"wb.doctor.small-post-text.found": "Der Posttext ist {size}px groß, was für viele schwer lesbar ist.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Verwende für die Posttextgröße 14px oder mehr oder erhöhe die Textgröße des gesamten Themes.",
|
||||||
|
"wb.doctor.nav-moved.found": "Die Navigation wurde nach {position} verschoben, was ändert, wo man sie sucht.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Das gilt nur bei breiten Bereichen, und der Besitzer kann Layoutänderungen abschalten. Behalte die Standardposition bei, außer das Layout braucht es anders.",
|
||||||
"wb.setup.title": "Mein Setup teilen",
|
"wb.setup.title": "Mein Setup teilen",
|
||||||
"wb.setup.hint": "Dein Theme, deine Symbole, dein Modus und welche Funktionen an sind, als ein Link oder eine kleine Datei. Jeder kann damit dort anfangen, wo du bist.",
|
"wb.setup.hint": "Dein Theme, deine Symbole, dein Modus und welche Funktionen an sind, als ein Link oder eine kleine Datei. Jeder kann damit dort anfangen, wo du bist.",
|
||||||
"wb.setup.shareLabel": "Dein Setup",
|
"wb.setup.shareLabel": "Dein Setup",
|
||||||
|
|
|
||||||
|
|
@ -419,6 +419,46 @@
|
||||||
"wb.appearance.icons.removed": "Removed the icon pack “{name}”.",
|
"wb.appearance.icons.removed": "Removed the icon pack “{name}”.",
|
||||||
"wb.appearance.icons.imported": "Imported icon packs",
|
"wb.appearance.icons.imported": "Imported icon packs",
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {The theme doctor has a hint:} other {The theme doctor has # hints, the first:}} {hint}",
|
"wb.appearance.doctorHints": "{count, plural, one {The theme doctor has a hint:} other {The theme doctor has # hints, the first:}} {hint}",
|
||||||
|
"wb.doctor.title": "Theme doctor",
|
||||||
|
"wb.doctor.hint": "Advice about this theme: lighter ways to do the same, costs and contrast. It only advises; nothing is blocked or changed.",
|
||||||
|
"wb.doctor.empty": "Nothing to report: the theme uses tokens and component settings, and nothing in it is costly.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# finding} other {# findings}}",
|
||||||
|
"wb.doctor.kind.lighter": "A lighter way",
|
||||||
|
"wb.doctor.kind.performance": "Performance",
|
||||||
|
"wb.doctor.kind.accessibility": "Accessibility",
|
||||||
|
"wb.doctor.kind.contrast": "Contrast",
|
||||||
|
"wb.doctor.where": "Where",
|
||||||
|
"wb.doctor.fix": "Fix",
|
||||||
|
"wb.doctor.css-radius.found": "This rule sets corner radii in CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Set them with the radius of a part under components, or shape.radius for all of them: no CSS needed, and it keeps working when the site renames its classes.",
|
||||||
|
"wb.doctor.css-bevel.found": "This rule draws a bevelled edge with stacked inset shadows.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Use borderStyle \"bevel-out\" or \"bevel-in\" on a part under components: it draws the bevel from the theme’s colors.",
|
||||||
|
"wb.doctor.css-hide.found": "This rule hides something with display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Use visible on a part under components (avatars, counts, names) or a layout variant such as sidebar: hidden; the owner can then switch it back.",
|
||||||
|
"wb.doctor.css-color.found": "This rule uses a literal color.",
|
||||||
|
"wb.doctor.css-color.fix": "Name a role (text, muted, accent, surface…) in colors or in a component, so the contrast pass covers it.",
|
||||||
|
"wb.doctor.css-font.found": "This rule sets a font family.",
|
||||||
|
"wb.doctor.css-font.fix": "Use font.roles: it sets the post, heading, numbers and mono faces without CSS.",
|
||||||
|
"wb.doctor.css-has.found": "This rule uses :has(), which is matched again on every change of the page.",
|
||||||
|
"wb.doctor.css-has.fix": "Keep :has() off rules that repeat down a timeline, or anchor the rule on a part.",
|
||||||
|
"wb.doctor.css-universal.found": "This rule uses a universal selector (*), matched against every element.",
|
||||||
|
"wb.doctor.css-universal.fix": "Anchor the rule on a part instead.",
|
||||||
|
"wb.doctor.css-blur.found": "This rule blurs what is behind it (backdrop-filter), which is costly on parts that repeat.",
|
||||||
|
"wb.doctor.css-blur.fix": "Use the glass fill of bars and panels: it is the cheaper place for blur.",
|
||||||
|
"wb.doctor.css-outline-none.found": "This rule removes the focus outline, so keyboard focus is no longer visible.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Use decor.focusRing to draw a visible focus ring instead.",
|
||||||
|
"wb.doctor.css-motion.found": "This rule animates without checking for reduced motion.",
|
||||||
|
"wb.doctor.css-motion.fix": "Keep motion inside @media (prefers-reduced-motion: no-preference), or let decor.motion do it for you.",
|
||||||
|
"wb.doctor.css-size.found": "The CSS is more than 20,000 characters long.",
|
||||||
|
"wb.doctor.css-size.fix": "The site recalculates styles with every rule; tokens and component settings compile to fewer rules.",
|
||||||
|
"wb.doctor.contrast.found": "The {token} color was adjusted to stay readable ({ratio}:1 on the background).",
|
||||||
|
"wb.doctor.contrast.fix": "Pick a lighter or darker {token} color; until then the theme is shown with the adjusted one.",
|
||||||
|
"wb.doctor.glass-post.found": "Glass is set on posts, but it is not drawn: blur on every post of a timeline is too costly.",
|
||||||
|
"wb.doctor.glass-post.fix": "Use a solid or tinted fill for posts and keep glass for bars and panels.",
|
||||||
|
"wb.doctor.small-post-text.found": "Post text is {size}px, which is hard to read for many people.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Use 14px or more for the post text size, or raise the text size of the whole theme.",
|
||||||
|
"wb.doctor.nav-moved.found": "The navigation is moved to the {position}, which changes where people look for it.",
|
||||||
|
"wb.doctor.nav-moved.fix": "It only applies on wide panes, and the owner can turn layout changes off. Keep the default position unless the layout needs it.",
|
||||||
"wb.appearance.icons.site": "The site's own icons",
|
"wb.appearance.icons.site": "The site's own icons",
|
||||||
"wb.appearance.accountTheme": "Account theme · {name}",
|
"wb.appearance.accountTheme": "Account theme · {name}",
|
||||||
"wb.appearance.accountsHint": "Every pane of an account shows its theme unless the pane has its own.",
|
"wb.appearance.accountsHint": "Every pane of an account shows its theme unless the pane has its own.",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Quitar {name}",
|
"wb.appearance.icons.remove": "Quitar {name}",
|
||||||
"wb.appearance.icons.removed": "Paquete de iconos «{name}» quitado.",
|
"wb.appearance.icons.removed": "Paquete de iconos «{name}» quitado.",
|
||||||
"wb.appearance.icons.imported": "Paquetes de iconos importados",
|
"wb.appearance.icons.imported": "Paquetes de iconos importados",
|
||||||
|
"wb.doctor.title": "Doctor del tema",
|
||||||
|
"wb.doctor.hint": "Consejos sobre este tema: formas más ligeras de hacer lo mismo, costes y contraste. Solo aconseja; no bloquea ni cambia nada.",
|
||||||
|
"wb.doctor.empty": "Nada que informar: el tema usa tokens y ajustes de componentes, y nada en él es costoso.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# hallazgo} other {# hallazgos}}",
|
||||||
|
"wb.doctor.kind.lighter": "Una forma más ligera",
|
||||||
|
"wb.doctor.kind.performance": "Rendimiento",
|
||||||
|
"wb.doctor.kind.accessibility": "Accesibilidad",
|
||||||
|
"wb.doctor.kind.contrast": "Contraste",
|
||||||
|
"wb.doctor.where": "Dónde",
|
||||||
|
"wb.doctor.fix": "Solución",
|
||||||
|
"wb.doctor.css-radius.found": "Esta regla define radios de esquina en CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Defínelos con el radius de una parte en components, o con shape.radius para todas: no hace falta CSS y sigue funcionando cuando el sitio cambia los nombres de sus clases.",
|
||||||
|
"wb.doctor.css-bevel.found": "Esta regla dibuja un borde biselado con sombras interiores apiladas.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Usa borderStyle \"bevel-out\" o \"bevel-in\" en una parte de components: dibuja el bisel con los colores del tema.",
|
||||||
|
"wb.doctor.css-hide.found": "Esta regla oculta algo con display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Usa visible en una parte de components (avatares, contadores, nombres) o una variante de diseño como sidebar: hidden; así el propietario puede volver a activarlo.",
|
||||||
|
"wb.doctor.css-color.found": "Esta regla usa un color literal.",
|
||||||
|
"wb.doctor.css-color.fix": "Indica un rol (text, muted, accent, surface…) en colors o en un componente, para que la revisión de contraste lo cubra.",
|
||||||
|
"wb.doctor.css-font.found": "Esta regla define una familia de fuentes.",
|
||||||
|
"wb.doctor.css-font.fix": "Usa font.roles: define las tipografías de publicaciones, títulos, números y monoespaciada sin CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Esta regla usa :has(), que se vuelve a evaluar con cada cambio de la página.",
|
||||||
|
"wb.doctor.css-has.fix": "No uses :has() en reglas que se repiten a lo largo de una cronología, o ancla la regla a una parte.",
|
||||||
|
"wb.doctor.css-universal.found": "Esta regla usa un selector universal (*), que se compara con todos los elementos.",
|
||||||
|
"wb.doctor.css-universal.fix": "Ancla la regla a una parte en su lugar.",
|
||||||
|
"wb.doctor.css-blur.found": "Esta regla desenfoca lo que hay detrás (backdrop-filter), lo cual es costoso en partes que se repiten.",
|
||||||
|
"wb.doctor.css-blur.fix": "Usa el relleno de cristal de barras y paneles: es el lugar más económico para el desenfoque.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Esta regla quita el contorno de enfoque, así que el foco del teclado deja de verse.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Usa decor.focusRing para dibujar un anillo de enfoque visible.",
|
||||||
|
"wb.doctor.css-motion.found": "Esta regla anima sin comprobar si se pidió reducir el movimiento.",
|
||||||
|
"wb.doctor.css-motion.fix": "Mantén el movimiento dentro de @media (prefers-reduced-motion: no-preference), o deja que decor.motion lo haga por ti.",
|
||||||
|
"wb.doctor.css-size.found": "El CSS tiene más de 20.000 caracteres.",
|
||||||
|
"wb.doctor.css-size.fix": "El sitio recalcula los estilos con cada regla; los tokens y los ajustes de componentes se compilan en menos reglas.",
|
||||||
|
"wb.doctor.contrast.found": "El color {token} se ajustó para que siga siendo legible ({ratio}:1 sobre el fondo).",
|
||||||
|
"wb.doctor.contrast.fix": "Elige un color {token} más claro u oscuro; hasta entonces el tema se muestra con el ajustado.",
|
||||||
|
"wb.doctor.glass-post.found": "Se definió cristal en las publicaciones, pero no se dibuja: el desenfoque en cada publicación de una cronología es demasiado costoso.",
|
||||||
|
"wb.doctor.glass-post.fix": "Usa un relleno sólido o teñido para las publicaciones y reserva el cristal para barras y paneles.",
|
||||||
|
"wb.doctor.small-post-text.found": "El texto de las publicaciones es de {size}px, difícil de leer para mucha gente.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Usa 14px o más para el tamaño del texto de las publicaciones, o aumenta el tamaño del texto de todo el tema.",
|
||||||
|
"wb.doctor.nav-moved.found": "La navegación se movió a la posición {position}, lo que cambia dónde la busca la gente.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Solo se aplica en paneles anchos, y el propietario puede desactivar los cambios de diseño. Mantén la posición predeterminada salvo que el diseño lo necesite.",
|
||||||
"wb.setup.title": "Compartir mi configuración",
|
"wb.setup.title": "Compartir mi configuración",
|
||||||
"wb.setup.hint": "Tu tema, tus iconos, tu modo y qué funciones están activas, en un enlace o un archivo pequeño. Cualquiera puede usarlo para empezar desde lo que tienes.",
|
"wb.setup.hint": "Tu tema, tus iconos, tu modo y qué funciones están activas, en un enlace o un archivo pequeño. Cualquiera puede usarlo para empezar desde lo que tienes.",
|
||||||
"wb.setup.shareLabel": "Tu configuración",
|
"wb.setup.shareLabel": "Tu configuración",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Supprimer {name}",
|
"wb.appearance.icons.remove": "Supprimer {name}",
|
||||||
"wb.appearance.icons.removed": "Pack d'icônes « {name} » supprimé.",
|
"wb.appearance.icons.removed": "Pack d'icônes « {name} » supprimé.",
|
||||||
"wb.appearance.icons.imported": "Packs d'icônes importés",
|
"wb.appearance.icons.imported": "Packs d'icônes importés",
|
||||||
|
"wb.doctor.title": "Docteur du thème",
|
||||||
|
"wb.doctor.hint": "Conseils sur ce thème : des moyens plus légers de faire la même chose, les coûts et le contraste. Il ne fait que conseiller ; rien n’est bloqué ni modifié.",
|
||||||
|
"wb.doctor.empty": "Rien à signaler : le thème utilise des tokens et des réglages de composants, et rien n’y est coûteux.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# constat} other {# constats}}",
|
||||||
|
"wb.doctor.kind.lighter": "Un moyen plus léger",
|
||||||
|
"wb.doctor.kind.performance": "Performance",
|
||||||
|
"wb.doctor.kind.accessibility": "Accessibilité",
|
||||||
|
"wb.doctor.kind.contrast": "Contraste",
|
||||||
|
"wb.doctor.where": "Où",
|
||||||
|
"wb.doctor.fix": "Correction",
|
||||||
|
"wb.doctor.css-radius.found": "Cette règle définit des rayons de coin en CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Définissez-les avec le radius d’une partie sous components, ou shape.radius pour toutes : pas de CSS nécessaire, et cela continue de fonctionner quand le site renomme ses classes.",
|
||||||
|
"wb.doctor.css-bevel.found": "Cette règle dessine un bord biseauté avec des ombres internes empilées.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Utilisez borderStyle \"bevel-out\" ou \"bevel-in\" sur une partie sous components : le biseau est dessiné à partir des couleurs du thème.",
|
||||||
|
"wb.doctor.css-hide.found": "Cette règle masque quelque chose avec display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Utilisez visible sur une partie sous components (avatars, compteurs, noms) ou une variante de mise en page comme sidebar: hidden ; le propriétaire peut ensuite le réactiver.",
|
||||||
|
"wb.doctor.css-color.found": "Cette règle utilise une couleur littérale.",
|
||||||
|
"wb.doctor.css-color.fix": "Nommez un rôle (text, muted, accent, surface…) dans colors ou dans un composant, afin que la vérification du contraste le couvre.",
|
||||||
|
"wb.doctor.css-font.found": "Cette règle définit une famille de polices.",
|
||||||
|
"wb.doctor.css-font.fix": "Utilisez font.roles : cela définit les polices des posts, titres, nombres et à chasse fixe sans CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Cette règle utilise :has(), qui est réévalué à chaque changement de la page.",
|
||||||
|
"wb.doctor.css-has.fix": "Évitez :has() dans les règles qui se répètent le long d’un fil, ou ancrez la règle sur une partie.",
|
||||||
|
"wb.doctor.css-universal.found": "Cette règle utilise un sélecteur universel (*), comparé à chaque élément.",
|
||||||
|
"wb.doctor.css-universal.fix": "Ancrez plutôt la règle sur une partie.",
|
||||||
|
"wb.doctor.css-blur.found": "Cette règle floute ce qui se trouve derrière (backdrop-filter), ce qui est coûteux sur des parties répétées.",
|
||||||
|
"wb.doctor.css-blur.fix": "Utilisez le remplissage verre des barres et des panneaux : c’est l’endroit le moins coûteux pour le flou.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Cette règle supprime le contour de focus, si bien que le focus clavier n’est plus visible.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Utilisez decor.focusRing pour dessiner un anneau de focus visible.",
|
||||||
|
"wb.doctor.css-motion.found": "Cette règle anime sans vérifier la préférence de réduction des animations.",
|
||||||
|
"wb.doctor.css-motion.fix": "Gardez le mouvement dans @media (prefers-reduced-motion: no-preference), ou laissez decor.motion s’en charger.",
|
||||||
|
"wb.doctor.css-size.found": "Le CSS dépasse 20 000 caractères.",
|
||||||
|
"wb.doctor.css-size.fix": "Le site recalcule les styles à chaque règle ; les tokens et les réglages de composants se compilent en moins de règles.",
|
||||||
|
"wb.doctor.contrast.found": "La couleur {token} a été ajustée pour rester lisible ({ratio}:1 sur l’arrière-plan).",
|
||||||
|
"wb.doctor.contrast.fix": "Choisissez une couleur {token} plus claire ou plus sombre ; d’ici là, le thème s’affiche avec la couleur ajustée.",
|
||||||
|
"wb.doctor.glass-post.found": "Le verre est défini sur les posts, mais n’est pas dessiné : le flou sur chaque post d’un fil est trop coûteux.",
|
||||||
|
"wb.doctor.glass-post.fix": "Utilisez un remplissage uni ou teinté pour les posts et gardez le verre pour les barres et les panneaux.",
|
||||||
|
"wb.doctor.small-post-text.found": "Le texte des posts fait {size}px, ce qui est difficile à lire pour beaucoup de gens.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Utilisez 14px ou plus pour la taille du texte des posts, ou augmentez la taille du texte de tout le thème.",
|
||||||
|
"wb.doctor.nav-moved.found": "La navigation est déplacée vers {position}, ce qui change l’endroit où l’on la cherche.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Cela ne s’applique que sur les volets larges, et le propriétaire peut désactiver les changements de mise en page. Gardez la position par défaut sauf si la mise en page l’exige.",
|
||||||
"wb.setup.title": "Partager ma configuration",
|
"wb.setup.title": "Partager ma configuration",
|
||||||
"wb.setup.hint": "Votre thème, vos icônes, votre mode et les fonctions activées, en un lien ou un petit fichier. N'importe qui peut s'en servir pour partir de ce que vous avez.",
|
"wb.setup.hint": "Votre thème, vos icônes, votre mode et les fonctions activées, en un lien ou un petit fichier. N'importe qui peut s'en servir pour partir de ce que vous avez.",
|
||||||
"wb.setup.shareLabel": "Votre configuration",
|
"wb.setup.shareLabel": "Votre configuration",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "{name} हटाएँ",
|
"wb.appearance.icons.remove": "{name} हटाएँ",
|
||||||
"wb.appearance.icons.removed": "“{name}” आइकन पैक हटा दिया गया.",
|
"wb.appearance.icons.removed": "“{name}” आइकन पैक हटा दिया गया.",
|
||||||
"wb.appearance.icons.imported": "इम्पोर्ट किए गए आइकन पैक",
|
"wb.appearance.icons.imported": "इम्पोर्ट किए गए आइकन पैक",
|
||||||
|
"wb.doctor.title": "थीम डॉक्टर",
|
||||||
|
"wb.doctor.hint": "इस थीम के बारे में सलाह: वही काम करने के हल्के तरीके, लागत और कंट्रास्ट। यह केवल सलाह देता है; कुछ भी ब्लॉक या बदला नहीं जाता।",
|
||||||
|
"wb.doctor.empty": "बताने लायक कुछ नहीं: थीम टोकन और कॉम्पोनेंट सेटिंग्स का उपयोग करती है, और इसमें कुछ भी महँगा नहीं है।",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# निष्कर्ष} other {# निष्कर्ष}}",
|
||||||
|
"wb.doctor.kind.lighter": "एक हल्का तरीका",
|
||||||
|
"wb.doctor.kind.performance": "परफ़ॉर्मेंस",
|
||||||
|
"wb.doctor.kind.accessibility": "एक्सेसिबिलिटी",
|
||||||
|
"wb.doctor.kind.contrast": "कंट्रास्ट",
|
||||||
|
"wb.doctor.where": "कहाँ",
|
||||||
|
"wb.doctor.fix": "समाधान",
|
||||||
|
"wb.doctor.css-radius.found": "यह नियम CSS में कोनों की त्रिज्या सेट करता है।",
|
||||||
|
"wb.doctor.css-radius.fix": "इन्हें components के अंतर्गत किसी हिस्से के radius से सेट करें, या सभी के लिए shape.radius से: CSS की ज़रूरत नहीं, और साइट के क्लास नाम बदलने पर भी यह काम करता रहता है।",
|
||||||
|
"wb.doctor.css-bevel.found": "यह नियम एक के ऊपर एक इनसेट शैडो से तिरछा किनारा बनाता है।",
|
||||||
|
"wb.doctor.css-bevel.fix": "components के अंतर्गत किसी हिस्से पर borderStyle \"bevel-out\" या \"bevel-in\" का उपयोग करें: यह थीम के रंगों से बेवल बनाता है।",
|
||||||
|
"wb.doctor.css-hide.found": "यह नियम display: none से कुछ छिपाता है।",
|
||||||
|
"wb.doctor.css-hide.fix": "components के अंतर्गत किसी हिस्से पर visible (अवतार, गिनती, नाम) या sidebar: hidden जैसे लेआउट वेरिएंट का उपयोग करें; फिर मालिक उसे वापस चालू कर सकता है।",
|
||||||
|
"wb.doctor.css-color.found": "यह नियम सीधा रंग मान इस्तेमाल करता है।",
|
||||||
|
"wb.doctor.css-color.fix": "colors में या किसी कॉम्पोनेंट में कोई भूमिका (text, muted, accent, surface…) चुनें, ताकि कंट्रास्ट जाँच उसे शामिल करे।",
|
||||||
|
"wb.doctor.css-font.found": "यह नियम फ़ॉन्ट फ़ैमिली सेट करता है।",
|
||||||
|
"wb.doctor.css-font.fix": "font.roles का उपयोग करें: यह CSS के बिना पोस्ट, शीर्षक, अंकों और मोनो के फ़ॉन्ट सेट करता है।",
|
||||||
|
"wb.doctor.css-has.found": "यह नियम :has() का उपयोग करता है, जिसे पेज में हर बदलाव पर फिर से मिलाया जाता है।",
|
||||||
|
"wb.doctor.css-has.fix": "टाइमलाइन में दोहराए जाने वाले नियमों में :has() का उपयोग न करें, या नियम को किसी हिस्से से जोड़ दें।",
|
||||||
|
"wb.doctor.css-universal.found": "यह नियम यूनिवर्सल सेलेक्टर (*) का उपयोग करता है, जिसे हर एलिमेंट से मिलाया जाता है।",
|
||||||
|
"wb.doctor.css-universal.fix": "इसके बजाय नियम को किसी हिस्से से जोड़ें।",
|
||||||
|
"wb.doctor.css-blur.found": "यह नियम अपने पीछे की चीज़ को धुँधला करता है (backdrop-filter), जो दोहराए जाने वाले हिस्सों पर महँगा है।",
|
||||||
|
"wb.doctor.css-blur.fix": "बार और पैनल की ग्लास फ़िल का उपयोग करें: धुँधलापन के लिए वही सस्ती जगह है।",
|
||||||
|
"wb.doctor.css-outline-none.found": "यह नियम फ़ोकस आउटलाइन हटा देता है, इसलिए कीबोर्ड फ़ोकस दिखना बंद हो जाता है।",
|
||||||
|
"wb.doctor.css-outline-none.fix": "इसके बजाय दिखने वाली फ़ोकस रिंग बनाने के लिए decor.focusRing का उपयोग करें।",
|
||||||
|
"wb.doctor.css-motion.found": "यह नियम कम मोशन की पसंद जाँचे बिना एनिमेशन चलाता है।",
|
||||||
|
"wb.doctor.css-motion.fix": "मोशन को @media (prefers-reduced-motion: no-preference) के भीतर रखें, या यह काम decor.motion को करने दें।",
|
||||||
|
"wb.doctor.css-size.found": "CSS 20,000 अक्षरों से लंबी है।",
|
||||||
|
"wb.doctor.css-size.fix": "साइट हर नियम के साथ स्टाइल दोबारा गिनती है; टोकन और कॉम्पोनेंट सेटिंग्स कम नियमों में कंपाइल होती हैं।",
|
||||||
|
"wb.doctor.contrast.found": "{token} रंग को पढ़ने योग्य रखने के लिए बदला गया ({ratio}:1 बैकग्राउंड पर)।",
|
||||||
|
"wb.doctor.contrast.fix": "{token} के लिए हल्का या गहरा रंग चुनें; तब तक थीम बदले हुए रंग के साथ दिखाई जाएगी।",
|
||||||
|
"wb.doctor.glass-post.found": "पोस्ट पर ग्लास सेट है, पर वह बनाया नहीं जाता: टाइमलाइन की हर पोस्ट पर धुँधलापन बहुत महँगा है।",
|
||||||
|
"wb.doctor.glass-post.fix": "पोस्ट के लिए ठोस या हल्के रंग की फ़िल का उपयोग करें और ग्लास को बार और पैनल के लिए रखें।",
|
||||||
|
"wb.doctor.small-post-text.found": "पोस्ट का टेक्स्ट {size}px है, जो कई लोगों के लिए पढ़ना कठिन है।",
|
||||||
|
"wb.doctor.small-post-text.fix": "पोस्ट के टेक्स्ट के आकार के लिए 14px या अधिक रखें, या पूरी थीम का टेक्स्ट आकार बढ़ाएँ।",
|
||||||
|
"wb.doctor.nav-moved.found": "नेविगेशन को {position} पर ले जाया गया है, जिससे लोगों के उसे खोजने की जगह बदल जाती है।",
|
||||||
|
"wb.doctor.nav-moved.fix": "यह केवल चौड़े पैन पर लागू होता है, और मालिक लेआउट बदलाव बंद कर सकता है। जब तक लेआउट को ज़रूरत न हो, डिफ़ॉल्ट स्थिति रखें।",
|
||||||
"wb.setup.title": "मेरा सेटअप शेयर करें",
|
"wb.setup.title": "मेरा सेटअप शेयर करें",
|
||||||
"wb.setup.hint": "आपकी थीम, आइकन, मोड और कौन सी सुविधाएँ चालू हैं, एक लिंक या एक छोटी फ़ाइल में. कोई भी इससे आपके सेटअप से शुरुआत कर सकता है.",
|
"wb.setup.hint": "आपकी थीम, आइकन, मोड और कौन सी सुविधाएँ चालू हैं, एक लिंक या एक छोटी फ़ाइल में. कोई भी इससे आपके सेटअप से शुरुआत कर सकता है.",
|
||||||
"wb.setup.shareLabel": "आपका सेटअप",
|
"wb.setup.shareLabel": "आपका सेटअप",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Hapus {name}",
|
"wb.appearance.icons.remove": "Hapus {name}",
|
||||||
"wb.appearance.icons.removed": "Paket ikon “{name}” dihapus.",
|
"wb.appearance.icons.removed": "Paket ikon “{name}” dihapus.",
|
||||||
"wb.appearance.icons.imported": "Paket ikon yang diimpor",
|
"wb.appearance.icons.imported": "Paket ikon yang diimpor",
|
||||||
|
"wb.doctor.title": "Dokter tema",
|
||||||
|
"wb.doctor.hint": "Saran untuk tema ini: cara yang lebih ringan untuk hasil yang sama, biaya, dan kontras. Hanya memberi saran; tidak ada yang diblokir atau diubah.",
|
||||||
|
"wb.doctor.empty": "Tidak ada yang perlu dilaporkan: tema ini memakai token dan pengaturan komponen, dan tidak ada yang berat di dalamnya.",
|
||||||
|
"wb.doctor.count": "{count, plural, other {# temuan}}",
|
||||||
|
"wb.doctor.kind.lighter": "Cara yang lebih ringan",
|
||||||
|
"wb.doctor.kind.performance": "Performa",
|
||||||
|
"wb.doctor.kind.accessibility": "Aksesibilitas",
|
||||||
|
"wb.doctor.kind.contrast": "Kontras",
|
||||||
|
"wb.doctor.where": "Di mana",
|
||||||
|
"wb.doctor.fix": "Perbaikan",
|
||||||
|
"wb.doctor.css-radius.found": "Aturan ini mengatur radius sudut lewat CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Atur dengan radius sebuah bagian di components, atau shape.radius untuk semuanya: tanpa CSS, dan tetap berfungsi saat situs mengganti nama kelasnya.",
|
||||||
|
"wb.doctor.css-bevel.found": "Aturan ini menggambar tepi miring dengan tumpukan bayangan inset.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Gunakan borderStyle \"bevel-out\" atau \"bevel-in\" pada sebuah bagian di components: tepi miring digambar dari warna tema.",
|
||||||
|
"wb.doctor.css-hide.found": "Aturan ini menyembunyikan sesuatu dengan display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Gunakan visible pada sebuah bagian di components (avatar, hitungan, nama) atau varian tata letak seperti sidebar: hidden; pemilik lalu bisa menampilkannya kembali.",
|
||||||
|
"wb.doctor.css-color.found": "Aturan ini memakai warna literal.",
|
||||||
|
"wb.doctor.css-color.fix": "Sebut sebuah peran (text, muted, accent, surface…) di colors atau di komponen, agar pemeriksaan kontras mencakupnya.",
|
||||||
|
"wb.doctor.css-font.found": "Aturan ini mengatur keluarga font.",
|
||||||
|
"wb.doctor.css-font.fix": "Gunakan font.roles: mengatur font postingan, judul, angka, dan mono tanpa CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Aturan ini memakai :has(), yang dicocokkan ulang di setiap perubahan halaman.",
|
||||||
|
"wb.doctor.css-has.fix": "Jangan pakai :has() pada aturan yang berulang di sepanjang linimasa, atau tautkan aturan ke sebuah bagian.",
|
||||||
|
"wb.doctor.css-universal.found": "Aturan ini memakai selektor universal (*), yang dicocokkan dengan setiap elemen.",
|
||||||
|
"wb.doctor.css-universal.fix": "Tautkan aturan ke sebuah bagian saja.",
|
||||||
|
"wb.doctor.css-blur.found": "Aturan ini mengaburkan apa yang ada di belakangnya (backdrop-filter), yang berat pada bagian yang berulang.",
|
||||||
|
"wb.doctor.css-blur.fix": "Gunakan isian kaca pada bilah dan panel: itu tempat yang lebih murah untuk blur.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Aturan ini menghapus outline fokus, sehingga fokus keyboard tidak terlihat lagi.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Gunakan decor.focusRing untuk menggambar cincin fokus yang terlihat.",
|
||||||
|
"wb.doctor.css-motion.found": "Aturan ini menganimasikan tanpa memeriksa preferensi kurangi gerakan.",
|
||||||
|
"wb.doctor.css-motion.fix": "Simpan gerakan di dalam @media (prefers-reduced-motion: no-preference), atau biarkan decor.motion yang mengurusnya.",
|
||||||
|
"wb.doctor.css-size.found": "CSS-nya lebih dari 20.000 karakter.",
|
||||||
|
"wb.doctor.css-size.fix": "Situs menghitung ulang gaya pada setiap aturan; token dan pengaturan komponen dikompilasi menjadi lebih sedikit aturan.",
|
||||||
|
"wb.doctor.contrast.found": "Warna {token} disesuaikan agar tetap terbaca ({ratio}:1 pada latar belakang).",
|
||||||
|
"wb.doctor.contrast.fix": "Pilih warna {token} yang lebih terang atau lebih gelap; sampai saat itu tema ditampilkan dengan warna yang sudah disesuaikan.",
|
||||||
|
"wb.doctor.glass-post.found": "Kaca diatur pada postingan, tetapi tidak digambar: blur pada setiap postingan di linimasa terlalu berat.",
|
||||||
|
"wb.doctor.glass-post.fix": "Gunakan isian solid atau berwarna untuk postingan dan simpan kaca untuk bilah dan panel.",
|
||||||
|
"wb.doctor.small-post-text.found": "Teks postingan berukuran {size}px, sulit dibaca bagi banyak orang.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Gunakan 14px atau lebih untuk ukuran teks postingan, atau perbesar ukuran teks seluruh tema.",
|
||||||
|
"wb.doctor.nav-moved.found": "Navigasi dipindahkan ke {position}, yang mengubah tempat orang mencarinya.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Ini hanya berlaku pada panel lebar, dan pemilik dapat mematikan perubahan tata letak. Pertahankan posisi bawaan kecuali tata letak membutuhkannya.",
|
||||||
"wb.setup.title": "Bagikan pengaturanku",
|
"wb.setup.title": "Bagikan pengaturanku",
|
||||||
"wb.setup.hint": "Tema, ikon, mode, dan fitur mana yang aktif, sebagai satu tautan atau satu berkas kecil. Siapa pun bisa memakainya untuk mulai dari apa yang kamu punya.",
|
"wb.setup.hint": "Tema, ikon, mode, dan fitur mana yang aktif, sebagai satu tautan atau satu berkas kecil. Siapa pun bisa memakainya untuk mulai dari apa yang kamu punya.",
|
||||||
"wb.setup.shareLabel": "Pengaturanmu",
|
"wb.setup.shareLabel": "Pengaturanmu",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Rimuovi {name}",
|
"wb.appearance.icons.remove": "Rimuovi {name}",
|
||||||
"wb.appearance.icons.removed": "Pacchetto di icone «{name}» rimosso.",
|
"wb.appearance.icons.removed": "Pacchetto di icone «{name}» rimosso.",
|
||||||
"wb.appearance.icons.imported": "Pacchetti di icone importati",
|
"wb.appearance.icons.imported": "Pacchetti di icone importati",
|
||||||
|
"wb.doctor.title": "Dottore del tema",
|
||||||
|
"wb.doctor.hint": "Consigli su questo tema: modi più leggeri per ottenere lo stesso risultato, costi e contrasto. Dà solo consigli; nulla viene bloccato o modificato.",
|
||||||
|
"wb.doctor.empty": "Niente da segnalare: il tema usa token e impostazioni dei componenti, e nulla al suo interno è costoso.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# rilievo} other {# rilievi}}",
|
||||||
|
"wb.doctor.kind.lighter": "Un modo più leggero",
|
||||||
|
"wb.doctor.kind.performance": "Prestazioni",
|
||||||
|
"wb.doctor.kind.accessibility": "Accessibilità",
|
||||||
|
"wb.doctor.kind.contrast": "Contrasto",
|
||||||
|
"wb.doctor.where": "Dove",
|
||||||
|
"wb.doctor.fix": "Correzione",
|
||||||
|
"wb.doctor.css-radius.found": "Questa regola imposta i raggi degli angoli in CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Impostali con il radius di una parte in components, oppure con shape.radius per tutte: nessun CSS necessario, e continua a funzionare quando il sito rinomina le sue classi.",
|
||||||
|
"wb.doctor.css-bevel.found": "Questa regola disegna un bordo smussato con ombre interne sovrapposte.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Usa borderStyle \"bevel-out\" o \"bevel-in\" su una parte in components: disegna lo smusso con i colori del tema.",
|
||||||
|
"wb.doctor.css-hide.found": "Questa regola nasconde qualcosa con display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Usa visible su una parte in components (avatar, contatori, nomi) oppure una variante di layout come sidebar: hidden; così il proprietario può riattivarla.",
|
||||||
|
"wb.doctor.css-color.found": "Questa regola usa un colore letterale.",
|
||||||
|
"wb.doctor.css-color.fix": "Indica un ruolo (text, muted, accent, surface…) in colors o in un componente, così il controllo del contrasto lo copre.",
|
||||||
|
"wb.doctor.css-font.found": "Questa regola imposta una famiglia di caratteri.",
|
||||||
|
"wb.doctor.css-font.fix": "Usa font.roles: imposta i caratteri di post, titoli, numeri e monospazio senza CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Questa regola usa :has(), che viene valutato di nuovo a ogni modifica della pagina.",
|
||||||
|
"wb.doctor.css-has.fix": "Evita :has() nelle regole che si ripetono lungo una timeline, oppure ancora la regola a una parte.",
|
||||||
|
"wb.doctor.css-universal.found": "Questa regola usa un selettore universale (*), confrontato con ogni elemento.",
|
||||||
|
"wb.doctor.css-universal.fix": "Ancora invece la regola a una parte.",
|
||||||
|
"wb.doctor.css-blur.found": "Questa regola sfoca ciò che sta dietro (backdrop-filter), il che è costoso sulle parti che si ripetono.",
|
||||||
|
"wb.doctor.css-blur.fix": "Usa il riempimento vetro di barre e pannelli: è il posto più economico per la sfocatura.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Questa regola rimuove il contorno di focus, quindi il focus da tastiera non è più visibile.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Usa decor.focusRing per disegnare invece un anello di focus visibile.",
|
||||||
|
"wb.doctor.css-motion.found": "Questa regola anima senza controllare la preferenza per il movimento ridotto.",
|
||||||
|
"wb.doctor.css-motion.fix": "Tieni il movimento dentro @media (prefers-reduced-motion: no-preference), oppure lascia che lo faccia decor.motion.",
|
||||||
|
"wb.doctor.css-size.found": "Il CSS supera i 20.000 caratteri.",
|
||||||
|
"wb.doctor.css-size.fix": "Il sito ricalcola gli stili a ogni regola; token e impostazioni dei componenti si compilano in meno regole.",
|
||||||
|
"wb.doctor.contrast.found": "Il colore {token} è stato regolato per restare leggibile ({ratio}:1 sullo sfondo).",
|
||||||
|
"wb.doctor.contrast.fix": "Scegli un colore {token} più chiaro o più scuro; fino ad allora il tema viene mostrato con quello regolato.",
|
||||||
|
"wb.doctor.glass-post.found": "Il vetro è impostato sui post, ma non viene disegnato: la sfocatura su ogni post di una timeline è troppo costosa.",
|
||||||
|
"wb.doctor.glass-post.fix": "Usa un riempimento pieno o tinto per i post e riserva il vetro a barre e pannelli.",
|
||||||
|
"wb.doctor.small-post-text.found": "Il testo dei post è di {size}px, difficile da leggere per molte persone.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Usa 14px o più per la dimensione del testo dei post, oppure aumenta la dimensione del testo dell’intero tema.",
|
||||||
|
"wb.doctor.nav-moved.found": "La navigazione è stata spostata in {position}, il che cambia dove le persone la cercano.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Vale solo sui riquadri larghi, e il proprietario può disattivare le modifiche al layout. Mantieni la posizione predefinita a meno che il layout non lo richieda.",
|
||||||
"wb.setup.title": "Condividi la mia configurazione",
|
"wb.setup.title": "Condividi la mia configurazione",
|
||||||
"wb.setup.hint": "Il tuo tema, le icone, la modalità e quali funzioni sono attive, in un link o in un piccolo file. Chiunque può usarlo per partire da ciò che hai.",
|
"wb.setup.hint": "Il tuo tema, le icone, la modalità e quali funzioni sono attive, in un link o in un piccolo file. Chiunque può usarlo per partire da ciò che hai.",
|
||||||
"wb.setup.shareLabel": "La tua configurazione",
|
"wb.setup.shareLabel": "La tua configurazione",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "{name} を削除",
|
"wb.appearance.icons.remove": "{name} を削除",
|
||||||
"wb.appearance.icons.removed": "アイコンパック「{name}」を削除しました。",
|
"wb.appearance.icons.removed": "アイコンパック「{name}」を削除しました。",
|
||||||
"wb.appearance.icons.imported": "読み込んだアイコンパック",
|
"wb.appearance.icons.imported": "読み込んだアイコンパック",
|
||||||
|
"wb.doctor.title": "テーマドクター",
|
||||||
|
"wb.doctor.hint": "このテーマに関するアドバイスです。同じことをもっと軽くする方法、負荷、コントラストを示します。助言のみで、ブロックや変更は行いません。",
|
||||||
|
"wb.doctor.empty": "報告することはありません。このテーマはトークンとコンポーネント設定を使っていて、負荷の高いものもありません。",
|
||||||
|
"wb.doctor.count": "{count, plural, other {# 件の指摘}}",
|
||||||
|
"wb.doctor.kind.lighter": "もっと軽い方法",
|
||||||
|
"wb.doctor.kind.performance": "パフォーマンス",
|
||||||
|
"wb.doctor.kind.accessibility": "アクセシビリティ",
|
||||||
|
"wb.doctor.kind.contrast": "コントラスト",
|
||||||
|
"wb.doctor.where": "場所",
|
||||||
|
"wb.doctor.fix": "修正",
|
||||||
|
"wb.doctor.css-radius.found": "このルールはCSSで角丸を設定しています。",
|
||||||
|
"wb.doctor.css-radius.fix": "components の各パーツの radius で個別に、または shape.radius ですべてまとめて設定してください。CSSは不要で、サイトがクラス名を変えても動き続けます。",
|
||||||
|
"wb.doctor.css-bevel.found": "このルールは重ねたインセットシャドウで面取りの縁を描いています。",
|
||||||
|
"wb.doctor.css-bevel.fix": "components のパーツで borderStyle \"bevel-out\" または \"bevel-in\" を使ってください。テーマの色から面取りを描きます。",
|
||||||
|
"wb.doctor.css-hide.found": "このルールは display: none で何かを隠しています。",
|
||||||
|
"wb.doctor.css-hide.fix": "components のパーツ(アバター、カウント、名前)の visible や、sidebar: hidden のようなレイアウトバリアントを使ってください。オーナーが元に戻すこともできます。",
|
||||||
|
"wb.doctor.css-color.found": "このルールはリテラルの色を使っています。",
|
||||||
|
"wb.doctor.css-color.fix": "colors またはコンポーネント内でロール(text、muted、accent、surface など)を指定してください。そうすればコントラスト調整の対象になります。",
|
||||||
|
"wb.doctor.css-font.found": "このルールはフォントファミリーを設定しています。",
|
||||||
|
"wb.doctor.css-font.fix": "font.roles を使ってください。CSSなしで、ポスト、見出し、数字、等幅の書体を設定できます。",
|
||||||
|
"wb.doctor.css-has.found": "このルールは :has() を使っており、ページが変わるたびに再評価されます。",
|
||||||
|
"wb.doctor.css-has.fix": "タイムラインで繰り返されるルールには :has() を使わないか、ルールをパーツに紐づけてください。",
|
||||||
|
"wb.doctor.css-universal.found": "このルールは全要素と照合されるユニバーサルセレクター (*) を使っています。",
|
||||||
|
"wb.doctor.css-universal.fix": "代わりにルールをパーツに紐づけてください。",
|
||||||
|
"wb.doctor.css-blur.found": "このルールは背面をぼかしており (backdrop-filter)、繰り返されるパーツでは負荷が高くなります。",
|
||||||
|
"wb.doctor.css-blur.fix": "バーやパネルのガラス塗りを使ってください。ぼかしにはそちらのほうが軽い場所です。",
|
||||||
|
"wb.doctor.css-outline-none.found": "このルールはフォーカスのアウトラインを消しているため、キーボードのフォーカスが見えなくなります。",
|
||||||
|
"wb.doctor.css-outline-none.fix": "代わりに decor.focusRing で見えるフォーカスリングを描いてください。",
|
||||||
|
"wb.doctor.css-motion.found": "このルールは視覚効果の軽減を確認せずにアニメーションさせています。",
|
||||||
|
"wb.doctor.css-motion.fix": "動きは @media (prefers-reduced-motion: no-preference) の中に入れるか、decor.motion に任せてください。",
|
||||||
|
"wb.doctor.css-size.found": "CSSが20,000文字を超えています。",
|
||||||
|
"wb.doctor.css-size.fix": "サイトはルールごとにスタイルを再計算します。トークンとコンポーネント設定のほうが少ないルールにコンパイルされます。",
|
||||||
|
"wb.doctor.contrast.found": "{token} の色は読みやすさを保つために調整されました(背景に対して {ratio}:1)。",
|
||||||
|
"wb.doctor.contrast.fix": "{token} の色をもっと明るく、または暗くしてください。それまではテーマは調整後の色で表示されます。",
|
||||||
|
"wb.doctor.glass-post.found": "ポストにガラスが設定されていますが、描画されません。タイムラインのすべてのポストにぼかしを使うと負荷が高すぎます。",
|
||||||
|
"wb.doctor.glass-post.fix": "ポストには単色または色付きの塗りを使い、ガラスはバーやパネル用にしてください。",
|
||||||
|
"wb.doctor.small-post-text.found": "ポストのテキストが {size}px で、多くの人には読みにくいサイズです。",
|
||||||
|
"wb.doctor.small-post-text.fix": "ポストのテキストサイズは 14px 以上にするか、テーマ全体のテキストサイズを上げてください。",
|
||||||
|
"wb.doctor.nav-moved.found": "ナビゲーションが {position} に移動されており、人が探す場所が変わります。",
|
||||||
|
"wb.doctor.nav-moved.fix": "広いペインでのみ適用され、オーナーはレイアウト変更をオフにできます。レイアウト上必要でなければ、既定の位置のままにしてください。",
|
||||||
"wb.setup.title": "自分の設定を共有",
|
"wb.setup.title": "自分の設定を共有",
|
||||||
"wb.setup.hint": "テーマ、アイコン、モード、オンにしている機能を、1 つのリンクまたは小さなファイルにまとめます。誰でもあなたの設定から始められます。",
|
"wb.setup.hint": "テーマ、アイコン、モード、オンにしている機能を、1 つのリンクまたは小さなファイルにまとめます。誰でもあなたの設定から始められます。",
|
||||||
"wb.setup.shareLabel": "あなたの設定",
|
"wb.setup.shareLabel": "あなたの設定",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "{name} 삭제",
|
"wb.appearance.icons.remove": "{name} 삭제",
|
||||||
"wb.appearance.icons.removed": "아이콘 팩 “{name}”을(를) 삭제했습니다.",
|
"wb.appearance.icons.removed": "아이콘 팩 “{name}”을(를) 삭제했습니다.",
|
||||||
"wb.appearance.icons.imported": "가져온 아이콘 팩",
|
"wb.appearance.icons.imported": "가져온 아이콘 팩",
|
||||||
|
"wb.doctor.title": "테마 닥터",
|
||||||
|
"wb.doctor.hint": "이 테마에 대한 조언: 같은 일을 더 가볍게 하는 방법, 비용, 대비. 조언만 할 뿐 아무것도 차단하거나 변경하지 않아요.",
|
||||||
|
"wb.doctor.empty": "보고할 내용이 없어요. 테마가 토큰과 컴포넌트 설정을 사용하고 있고, 비용이 큰 것도 없어요.",
|
||||||
|
"wb.doctor.count": "{count, plural, other {#건의 결과}}",
|
||||||
|
"wb.doctor.kind.lighter": "더 가벼운 방법",
|
||||||
|
"wb.doctor.kind.performance": "성능",
|
||||||
|
"wb.doctor.kind.accessibility": "접근성",
|
||||||
|
"wb.doctor.kind.contrast": "대비",
|
||||||
|
"wb.doctor.where": "위치",
|
||||||
|
"wb.doctor.fix": "해결",
|
||||||
|
"wb.doctor.css-radius.found": "이 규칙은 CSS로 모서리 반경을 설정해요.",
|
||||||
|
"wb.doctor.css-radius.fix": "components의 부분별 radius로, 또는 전체에 적용하는 shape.radius로 설정하세요. CSS가 필요 없고, 사이트가 클래스 이름을 바꿔도 계속 작동해요.",
|
||||||
|
"wb.doctor.css-bevel.found": "이 규칙은 겹쳐 쌓은 안쪽 그림자로 모따기 모서리를 그려요.",
|
||||||
|
"wb.doctor.css-bevel.fix": "components의 부분에 borderStyle \"bevel-out\" 또는 \"bevel-in\"을 사용하세요. 테마 색상으로 모따기를 그려요.",
|
||||||
|
"wb.doctor.css-hide.found": "이 규칙은 display: none으로 무언가를 숨겨요.",
|
||||||
|
"wb.doctor.css-hide.fix": "components의 부분(아바타, 개수, 이름)에 visible을 쓰거나 sidebar: hidden 같은 레이아웃 변형을 사용하세요. 그러면 소유자가 다시 켤 수 있어요.",
|
||||||
|
"wb.doctor.css-color.found": "이 규칙은 고정 색상 값을 사용해요.",
|
||||||
|
"wb.doctor.css-color.fix": "colors나 컴포넌트에서 역할(text, muted, accent, surface…)을 지정하세요. 그러면 대비 검사에 포함돼요.",
|
||||||
|
"wb.doctor.css-font.found": "이 규칙은 글꼴 계열을 설정해요.",
|
||||||
|
"wb.doctor.css-font.fix": "font.roles를 사용하세요. CSS 없이 게시물, 제목, 숫자, 고정폭 글꼴을 설정해요.",
|
||||||
|
"wb.doctor.css-has.found": "이 규칙은 :has()를 사용하며, 페이지가 바뀔 때마다 다시 매칭돼요.",
|
||||||
|
"wb.doctor.css-has.fix": "타임라인에서 반복되는 규칙에는 :has()를 쓰지 말거나, 규칙을 부분에 고정하세요.",
|
||||||
|
"wb.doctor.css-universal.found": "이 규칙은 모든 요소와 매칭되는 전체 선택자(*)를 사용해요.",
|
||||||
|
"wb.doctor.css-universal.fix": "대신 규칙을 부분에 고정하세요.",
|
||||||
|
"wb.doctor.css-blur.found": "이 규칙은 뒤에 있는 것을 흐리게 하며(backdrop-filter), 반복되는 부분에서는 비용이 커요.",
|
||||||
|
"wb.doctor.css-blur.fix": "바와 패널의 유리 채우기를 사용하세요. 흐림 효과에는 그쪽이 더 저렴해요.",
|
||||||
|
"wb.doctor.css-outline-none.found": "이 규칙은 포커스 윤곽선을 없애서 키보드 포커스가 보이지 않게 돼요.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "대신 decor.focusRing으로 보이는 포커스 링을 그리세요.",
|
||||||
|
"wb.doctor.css-motion.found": "이 규칙은 동작 줄이기 설정을 확인하지 않고 애니메이션을 실행해요.",
|
||||||
|
"wb.doctor.css-motion.fix": "움직임은 @media (prefers-reduced-motion: no-preference) 안에 두거나, decor.motion에 맡기세요.",
|
||||||
|
"wb.doctor.css-size.found": "CSS가 20,000자를 넘어요.",
|
||||||
|
"wb.doctor.css-size.fix": "사이트는 규칙마다 스타일을 다시 계산해요. 토큰과 컴포넌트 설정은 더 적은 규칙으로 컴파일돼요.",
|
||||||
|
"wb.doctor.contrast.found": "{token} 색상은 읽기 쉽도록 조정되었어요(배경 대비 {ratio}:1).",
|
||||||
|
"wb.doctor.contrast.fix": "더 밝거나 어두운 {token} 색상을 고르세요. 그전까지는 조정된 색상으로 테마가 표시돼요.",
|
||||||
|
"wb.doctor.glass-post.found": "게시물에 유리가 설정되어 있지만 그려지지 않아요. 타임라인의 모든 게시물에 흐림 효과를 쓰면 비용이 너무 커요.",
|
||||||
|
"wb.doctor.glass-post.fix": "게시물에는 단색이나 색조 채우기를 사용하고, 유리는 바와 패널에 남겨 두세요.",
|
||||||
|
"wb.doctor.small-post-text.found": "게시물 텍스트가 {size}px로, 많은 사람이 읽기 어려워요.",
|
||||||
|
"wb.doctor.small-post-text.fix": "게시물 텍스트 크기는 14px 이상으로 하거나, 테마 전체의 텍스트 크기를 키우세요.",
|
||||||
|
"wb.doctor.nav-moved.found": "내비게이션이 {position}(으)로 옮겨져서 사람들이 찾는 위치가 달라져요.",
|
||||||
|
"wb.doctor.nav-moved.fix": "넓은 창에서만 적용되며, 소유자가 레이아웃 변경을 끌 수 있어요. 레이아웃에 꼭 필요하지 않다면 기본 위치를 유지하세요.",
|
||||||
"wb.setup.title": "내 설정 공유",
|
"wb.setup.title": "내 설정 공유",
|
||||||
"wb.setup.hint": "테마, 아이콘, 모드, 켜 둔 기능을 링크 하나나 작은 파일 하나로. 누구나 여러분의 설정에서 시작할 수 있습니다.",
|
"wb.setup.hint": "테마, 아이콘, 모드, 켜 둔 기능을 링크 하나나 작은 파일 하나로. 누구나 여러분의 설정에서 시작할 수 있습니다.",
|
||||||
"wb.setup.shareLabel": "내 설정",
|
"wb.setup.shareLabel": "내 설정",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "{name} verwijderen",
|
"wb.appearance.icons.remove": "{name} verwijderen",
|
||||||
"wb.appearance.icons.removed": "Pictogrammenpakket ‘{name}’ verwijderd.",
|
"wb.appearance.icons.removed": "Pictogrammenpakket ‘{name}’ verwijderd.",
|
||||||
"wb.appearance.icons.imported": "Geïmporteerde pictogrammenpakketten",
|
"wb.appearance.icons.imported": "Geïmporteerde pictogrammenpakketten",
|
||||||
|
"wb.doctor.title": "Themadokter",
|
||||||
|
"wb.doctor.hint": "Advies over dit thema: lichtere manieren om hetzelfde te doen, kosten en contrast. Hij adviseert alleen; er wordt niets geblokkeerd of gewijzigd.",
|
||||||
|
"wb.doctor.empty": "Niets te melden: het thema gebruikt tokens en componentinstellingen, en niets erin is kostbaar.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# bevinding} other {# bevindingen}}",
|
||||||
|
"wb.doctor.kind.lighter": "Een lichtere manier",
|
||||||
|
"wb.doctor.kind.performance": "Prestaties",
|
||||||
|
"wb.doctor.kind.accessibility": "Toegankelijkheid",
|
||||||
|
"wb.doctor.kind.contrast": "Contrast",
|
||||||
|
"wb.doctor.where": "Waar",
|
||||||
|
"wb.doctor.fix": "Oplossing",
|
||||||
|
"wb.doctor.css-radius.found": "Deze regel stelt hoekradii in via CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Stel ze in met de radius van een onderdeel onder components, of met shape.radius voor alle: geen CSS nodig, en het blijft werken als de site zijn klassen hernoemt.",
|
||||||
|
"wb.doctor.css-bevel.found": "Deze regel tekent een afgeschuinde rand met gestapelde inset-schaduwen.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Gebruik borderStyle \"bevel-out\" of \"bevel-in\" op een onderdeel onder components: de afschuining wordt getekend met de kleuren van het thema.",
|
||||||
|
"wb.doctor.css-hide.found": "Deze regel verbergt iets met display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Gebruik visible op een onderdeel onder components (avatars, tellers, namen) of een lay-outvariant zoals sidebar: hidden; de eigenaar kan het dan weer aanzetten.",
|
||||||
|
"wb.doctor.css-color.found": "Deze regel gebruikt een letterlijke kleur.",
|
||||||
|
"wb.doctor.css-color.fix": "Noem een rol (text, muted, accent, surface…) in colors of in een component, zodat de contrastcontrole het dekt.",
|
||||||
|
"wb.doctor.css-font.found": "Deze regel stelt een lettertypefamilie in.",
|
||||||
|
"wb.doctor.css-font.fix": "Gebruik font.roles: daarmee stel je de lettertypen voor posts, koppen, cijfers en mono in zonder CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Deze regel gebruikt :has(), dat bij elke wijziging van de pagina opnieuw wordt vergeleken.",
|
||||||
|
"wb.doctor.css-has.fix": "Gebruik :has() niet in regels die zich door een tijdlijn heen herhalen, of verankeer de regel aan een onderdeel.",
|
||||||
|
"wb.doctor.css-universal.found": "Deze regel gebruikt een universele selector (*), die met elk element wordt vergeleken.",
|
||||||
|
"wb.doctor.css-universal.fix": "Verankeer de regel in plaats daarvan aan een onderdeel.",
|
||||||
|
"wb.doctor.css-blur.found": "Deze regel vervaagt wat erachter zit (backdrop-filter), wat kostbaar is bij onderdelen die zich herhalen.",
|
||||||
|
"wb.doctor.css-blur.fix": "Gebruik de glasvulling van balken en panelen: dat is de goedkopere plek voor vervaging.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Deze regel verwijdert de focusomlijning, waardoor de toetsenbordfocus niet meer zichtbaar is.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Gebruik decor.focusRing om in plaats daarvan een zichtbare focusring te tekenen.",
|
||||||
|
"wb.doctor.css-motion.found": "Deze regel animeert zonder te controleren op verminderde beweging.",
|
||||||
|
"wb.doctor.css-motion.fix": "Houd beweging binnen @media (prefers-reduced-motion: no-preference), of laat decor.motion dat voor je doen.",
|
||||||
|
"wb.doctor.css-size.found": "De CSS is langer dan 20.000 tekens.",
|
||||||
|
"wb.doctor.css-size.fix": "De site berekent stijlen opnieuw bij elke regel; tokens en componentinstellingen worden gecompileerd tot minder regels.",
|
||||||
|
"wb.doctor.contrast.found": "De kleur {token} is aangepast zodat hij leesbaar blijft ({ratio}:1 op de achtergrond).",
|
||||||
|
"wb.doctor.contrast.fix": "Kies een lichtere of donkerdere kleur voor {token}; tot die tijd wordt het thema getoond met de aangepaste kleur.",
|
||||||
|
"wb.doctor.glass-post.found": "Glas is ingesteld op posts, maar wordt niet getekend: vervaging op elke post van een tijdlijn is te kostbaar.",
|
||||||
|
"wb.doctor.glass-post.fix": "Gebruik een effen of getinte vulling voor posts en bewaar glas voor balken en panelen.",
|
||||||
|
"wb.doctor.small-post-text.found": "De posttekst is {size}px, wat voor veel mensen moeilijk te lezen is.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Gebruik 14px of meer voor de tekstgrootte van posts, of verhoog de tekstgrootte van het hele thema.",
|
||||||
|
"wb.doctor.nav-moved.found": "De navigatie is verplaatst naar {position}, waardoor mensen haar op een andere plek zoeken.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Dit geldt alleen voor brede vensters, en de eigenaar kan lay-outwijzigingen uitzetten. Houd de standaardpositie aan tenzij de lay-out het nodig heeft.",
|
||||||
"wb.setup.title": "Mijn instellingen delen",
|
"wb.setup.title": "Mijn instellingen delen",
|
||||||
"wb.setup.hint": "Je thema, pictogrammen, modus en welke functies aan staan, als één link of één klein bestand. Iedereen kan het gebruiken om te beginnen bij wat jij hebt.",
|
"wb.setup.hint": "Je thema, pictogrammen, modus en welke functies aan staan, als één link of één klein bestand. Iedereen kan het gebruiken om te beginnen bij wat jij hebt.",
|
||||||
"wb.setup.shareLabel": "Jouw instellingen",
|
"wb.setup.shareLabel": "Jouw instellingen",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Remover {name}",
|
"wb.appearance.icons.remove": "Remover {name}",
|
||||||
"wb.appearance.icons.removed": "Pacote de ícones “{name}” removido.",
|
"wb.appearance.icons.removed": "Pacote de ícones “{name}” removido.",
|
||||||
"wb.appearance.icons.imported": "Pacotes de ícones importados",
|
"wb.appearance.icons.imported": "Pacotes de ícones importados",
|
||||||
|
"wb.doctor.title": "Médico de temas",
|
||||||
|
"wb.doctor.hint": "Conselhos sobre este tema: formas mais leves de fazer o mesmo, custos e contraste. Ele só aconselha; nada é bloqueado ou alterado.",
|
||||||
|
"wb.doctor.empty": "Nada a relatar: o tema usa tokens e configurações de componentes, e nada nele é pesado.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# achado} other {# achados}}",
|
||||||
|
"wb.doctor.kind.lighter": "Um jeito mais leve",
|
||||||
|
"wb.doctor.kind.performance": "Desempenho",
|
||||||
|
"wb.doctor.kind.accessibility": "Acessibilidade",
|
||||||
|
"wb.doctor.kind.contrast": "Contraste",
|
||||||
|
"wb.doctor.where": "Onde",
|
||||||
|
"wb.doctor.fix": "Correção",
|
||||||
|
"wb.doctor.css-radius.found": "Esta regra define raios de canto em CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Defina-os com o radius de uma parte em components, ou com shape.radius para todas: sem CSS, e continua funcionando quando o site renomeia suas classes.",
|
||||||
|
"wb.doctor.css-bevel.found": "Esta regra desenha uma borda chanfrada com sombras internas empilhadas.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Use borderStyle \"bevel-out\" ou \"bevel-in\" em uma parte de components: ele desenha o chanfro com as cores do tema.",
|
||||||
|
"wb.doctor.css-hide.found": "Esta regra oculta algo com display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Use visible em uma parte de components (avatares, contagens, nomes) ou uma variante de layout como sidebar: hidden; assim o dono pode reativá-la.",
|
||||||
|
"wb.doctor.css-color.found": "Esta regra usa uma cor literal.",
|
||||||
|
"wb.doctor.css-color.fix": "Indique um papel (text, muted, accent, surface…) em colors ou em um componente, para que a verificação de contraste o cubra.",
|
||||||
|
"wb.doctor.css-font.found": "Esta regra define uma família de fonte.",
|
||||||
|
"wb.doctor.css-font.fix": "Use font.roles: ele define as fontes de posts, títulos, números e monoespaçada sem CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Esta regra usa :has(), que é avaliado de novo a cada mudança da página.",
|
||||||
|
"wb.doctor.css-has.fix": "Evite :has() em regras que se repetem ao longo da linha do tempo, ou ancore a regra em uma parte.",
|
||||||
|
"wb.doctor.css-universal.found": "Esta regra usa um seletor universal (*), comparado com todos os elementos.",
|
||||||
|
"wb.doctor.css-universal.fix": "Ancore a regra em uma parte.",
|
||||||
|
"wb.doctor.css-blur.found": "Esta regra desfoca o que está atrás (backdrop-filter), o que é pesado em partes que se repetem.",
|
||||||
|
"wb.doctor.css-blur.fix": "Use o preenchimento de vidro de barras e painéis: é o lugar mais barato para o desfoque.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Esta regra remove o contorno de foco, então o foco do teclado deixa de ser visível.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Use decor.focusRing para desenhar um anel de foco visível.",
|
||||||
|
"wb.doctor.css-motion.found": "Esta regra anima sem verificar a preferência por movimento reduzido.",
|
||||||
|
"wb.doctor.css-motion.fix": "Mantenha o movimento dentro de @media (prefers-reduced-motion: no-preference), ou deixe decor.motion fazer isso por você.",
|
||||||
|
"wb.doctor.css-size.found": "O CSS tem mais de 20.000 caracteres.",
|
||||||
|
"wb.doctor.css-size.fix": "O site recalcula os estilos a cada regra; tokens e configurações de componentes são compilados em menos regras.",
|
||||||
|
"wb.doctor.contrast.found": "A cor {token} foi ajustada para continuar legível ({ratio}:1 sobre o fundo).",
|
||||||
|
"wb.doctor.contrast.fix": "Escolha uma cor {token} mais clara ou mais escura; até lá o tema é exibido com a ajustada.",
|
||||||
|
"wb.doctor.glass-post.found": "O vidro está definido nos posts, mas não é desenhado: desfoque em cada post de uma linha do tempo é pesado demais.",
|
||||||
|
"wb.doctor.glass-post.fix": "Use um preenchimento sólido ou colorido para os posts e deixe o vidro para barras e painéis.",
|
||||||
|
"wb.doctor.small-post-text.found": "O texto dos posts tem {size}px, o que é difícil de ler para muita gente.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Use 14px ou mais para o tamanho do texto dos posts, ou aumente o tamanho do texto de todo o tema.",
|
||||||
|
"wb.doctor.nav-moved.found": "A navegação foi movida para {position}, o que muda onde as pessoas a procuram.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Isso só vale em painéis largos, e o dono pode desativar mudanças de layout. Mantenha a posição padrão, a menos que o layout precise.",
|
||||||
"wb.setup.title": "Compartilhar minha configuração",
|
"wb.setup.title": "Compartilhar minha configuração",
|
||||||
"wb.setup.hint": "Seu tema, ícones, modo e quais recursos estão ligados, em um link ou um arquivo pequeno. Qualquer pessoa pode usar para começar do que você tem.",
|
"wb.setup.hint": "Seu tema, ícones, modo e quais recursos estão ligados, em um link ou um arquivo pequeno. Qualquer pessoa pode usar para começar do que você tem.",
|
||||||
"wb.setup.shareLabel": "Sua configuração",
|
"wb.setup.shareLabel": "Sua configuração",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Удалить {name}",
|
"wb.appearance.icons.remove": "Удалить {name}",
|
||||||
"wb.appearance.icons.removed": "Набор значков «{name}» удалён.",
|
"wb.appearance.icons.removed": "Набор значков «{name}» удалён.",
|
||||||
"wb.appearance.icons.imported": "Импортированные наборы значков",
|
"wb.appearance.icons.imported": "Импортированные наборы значков",
|
||||||
|
"wb.doctor.title": "Доктор темы",
|
||||||
|
"wb.doctor.hint": "Советы по этой теме: более лёгкие способы сделать то же самое, затраты и контраст. Он только советует; ничего не блокируется и не меняется.",
|
||||||
|
"wb.doctor.empty": "Сообщать не о чем: тема использует токены и настройки компонентов, и ничего ресурсоёмкого в ней нет.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# замечание} few {# замечания} many {# замечаний} other {# замечания}}",
|
||||||
|
"wb.doctor.kind.lighter": "Более лёгкий способ",
|
||||||
|
"wb.doctor.kind.performance": "Производительность",
|
||||||
|
"wb.doctor.kind.accessibility": "Доступность",
|
||||||
|
"wb.doctor.kind.contrast": "Контраст",
|
||||||
|
"wb.doctor.where": "Где",
|
||||||
|
"wb.doctor.fix": "Исправление",
|
||||||
|
"wb.doctor.css-radius.found": "Это правило задаёт радиусы углов в CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Задайте их через radius части в components или через shape.radius для всех сразу: CSS не нужен, и это продолжает работать, когда сайт переименовывает свои классы.",
|
||||||
|
"wb.doctor.css-bevel.found": "Это правило рисует скошенную кромку наложенными внутренними тенями.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Используйте borderStyle \"bevel-out\" или \"bevel-in\" у части в components: скос рисуется из цветов темы.",
|
||||||
|
"wb.doctor.css-hide.found": "Это правило скрывает что-то через display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Используйте visible у части в components (аватары, счётчики, имена) или вариант макета вроде sidebar: hidden; тогда владелец сможет вернуть это обратно.",
|
||||||
|
"wb.doctor.css-color.found": "Это правило использует конкретный цвет.",
|
||||||
|
"wb.doctor.css-color.fix": "Укажите роль (text, muted, accent, surface…) в colors или в компоненте, чтобы проверка контраста его учитывала.",
|
||||||
|
"wb.doctor.css-font.found": "Это правило задаёт семейство шрифтов.",
|
||||||
|
"wb.doctor.css-font.fix": "Используйте font.roles: он задаёт шрифты постов, заголовков, чисел и моноширинный без CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Это правило использует :has(), которое заново сопоставляется при каждом изменении страницы.",
|
||||||
|
"wb.doctor.css-has.fix": "Не используйте :has() в правилах, повторяющихся по всей ленте, или привяжите правило к части.",
|
||||||
|
"wb.doctor.css-universal.found": "Это правило использует универсальный селектор (*), который сопоставляется с каждым элементом.",
|
||||||
|
"wb.doctor.css-universal.fix": "Вместо этого привяжите правило к части.",
|
||||||
|
"wb.doctor.css-blur.found": "Это правило размывает то, что находится позади (backdrop-filter), а это дорого для повторяющихся частей.",
|
||||||
|
"wb.doctor.css-blur.fix": "Используйте стеклянную заливку панелей и областей: для размытия это самое дешёвое место.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Это правило убирает контур фокуса, поэтому фокус клавиатуры перестаёт быть виден.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Используйте decor.focusRing, чтобы вместо этого нарисовать видимое кольцо фокуса.",
|
||||||
|
"wb.doctor.css-motion.found": "Это правило анимирует, не проверяя настройку уменьшения движения.",
|
||||||
|
"wb.doctor.css-motion.fix": "Держите движение внутри @media (prefers-reduced-motion: no-preference) или поручите это decor.motion.",
|
||||||
|
"wb.doctor.css-size.found": "CSS длиннее 20 000 символов.",
|
||||||
|
"wb.doctor.css-size.fix": "Сайт пересчитывает стили для каждого правила; токены и настройки компонентов компилируются в меньшее число правил.",
|
||||||
|
"wb.doctor.contrast.found": "Цвет {token} скорректирован, чтобы оставаться читаемым ({ratio}:1 на фоне).",
|
||||||
|
"wb.doctor.contrast.fix": "Выберите более светлый или более тёмный цвет {token}; до тех пор тема показывается со скорректированным.",
|
||||||
|
"wb.doctor.glass-post.found": "Стекло задано для постов, но не рисуется: размытие на каждом посте ленты слишком затратно.",
|
||||||
|
"wb.doctor.glass-post.fix": "Используйте для постов сплошную или тонированную заливку, а стекло оставьте для панелей и областей.",
|
||||||
|
"wb.doctor.small-post-text.found": "Текст поста имеет размер {size}px, и многим его трудно читать.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Используйте для размера текста поста 14px или больше либо увеличьте размер текста всей темы.",
|
||||||
|
"wb.doctor.nav-moved.found": "Навигация перемещена в положение {position}, из-за чего люди будут искать её в другом месте.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Это действует только на широких панелях, и владелец может отключить изменения макета. Оставьте положение по умолчанию, если макет не требует иного.",
|
||||||
"wb.setup.title": "Поделиться моими настройками",
|
"wb.setup.title": "Поделиться моими настройками",
|
||||||
"wb.setup.hint": "Ваша тема, значки, режим и включённые функции — одной ссылкой или одним небольшим файлом. Любой может начать с того, что есть у вас.",
|
"wb.setup.hint": "Ваша тема, значки, режим и включённые функции — одной ссылкой или одним небольшим файлом. Любой может начать с того, что есть у вас.",
|
||||||
"wb.setup.shareLabel": "Ваши настройки",
|
"wb.setup.shareLabel": "Ваши настройки",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "ลบ {name}",
|
"wb.appearance.icons.remove": "ลบ {name}",
|
||||||
"wb.appearance.icons.removed": "ลบแพ็กไอคอน “{name}” แล้ว",
|
"wb.appearance.icons.removed": "ลบแพ็กไอคอน “{name}” แล้ว",
|
||||||
"wb.appearance.icons.imported": "แพ็กไอคอนที่นำเข้า",
|
"wb.appearance.icons.imported": "แพ็กไอคอนที่นำเข้า",
|
||||||
|
"wb.doctor.title": "หมอธีม",
|
||||||
|
"wb.doctor.hint": "คำแนะนำเกี่ยวกับธีมนี้: วิธีที่เบากว่าในการทำสิ่งเดียวกัน ต้นทุน และคอนทราสต์ ทำหน้าที่แนะนำเท่านั้น ไม่มีอะไรถูกบล็อกหรือเปลี่ยนแปลง",
|
||||||
|
"wb.doctor.empty": "ไม่มีอะไรต้องรายงาน: ธีมใช้โทเค็นและการตั้งค่าคอมโพเนนต์ และไม่มีอะไรที่สิ้นเปลืองทรัพยากร",
|
||||||
|
"wb.doctor.count": "{count, plural, other {# ข้อสังเกต}}",
|
||||||
|
"wb.doctor.kind.lighter": "วิธีที่เบากว่า",
|
||||||
|
"wb.doctor.kind.performance": "ประสิทธิภาพ",
|
||||||
|
"wb.doctor.kind.accessibility": "การเข้าถึง",
|
||||||
|
"wb.doctor.kind.contrast": "คอนทราสต์",
|
||||||
|
"wb.doctor.where": "ตำแหน่ง",
|
||||||
|
"wb.doctor.fix": "วิธีแก้",
|
||||||
|
"wb.doctor.css-radius.found": "กฎนี้กำหนดรัศมีมุมด้วย CSS",
|
||||||
|
"wb.doctor.css-radius.fix": "กำหนดด้วย radius ของส่วนหนึ่งใต้ components หรือ shape.radius สำหรับทุกส่วน: ไม่ต้องใช้ CSS และยังใช้ได้แม้เว็บไซต์เปลี่ยนชื่อคลาส",
|
||||||
|
"wb.doctor.css-bevel.found": "กฎนี้วาดขอบเอียงด้วยเงาด้านในซ้อนกัน",
|
||||||
|
"wb.doctor.css-bevel.fix": "ใช้ borderStyle \"bevel-out\" หรือ \"bevel-in\" กับส่วนหนึ่งใต้ components: ระบบจะวาดขอบเอียงจากสีของธีม",
|
||||||
|
"wb.doctor.css-hide.found": "กฎนี้ซ่อนบางอย่างด้วย display: none",
|
||||||
|
"wb.doctor.css-hide.fix": "ใช้ visible กับส่วนหนึ่งใต้ components (อวาตาร์ ตัวนับ ชื่อ) หรือตัวเลือกเลย์เอาต์ เช่น sidebar: hidden เจ้าของจะได้เปิดกลับมาได้",
|
||||||
|
"wb.doctor.css-color.found": "กฎนี้ใช้สีแบบระบุตรง ๆ",
|
||||||
|
"wb.doctor.css-color.fix": "ระบุบทบาท (text, muted, accent, surface…) ใน colors หรือในคอมโพเนนต์ เพื่อให้การตรวจคอนทราสต์ครอบคลุม",
|
||||||
|
"wb.doctor.css-font.found": "กฎนี้กำหนดตระกูลฟอนต์",
|
||||||
|
"wb.doctor.css-font.fix": "ใช้ font.roles: กำหนดฟอนต์ของโพสต์ หัวข้อ ตัวเลข และ mono ได้โดยไม่ต้องใช้ CSS",
|
||||||
|
"wb.doctor.css-has.found": "กฎนี้ใช้ :has() ซึ่งจะถูกจับคู่ใหม่ทุกครั้งที่หน้าเปลี่ยน",
|
||||||
|
"wb.doctor.css-has.fix": "อย่าใช้ :has() กับกฎที่ซ้ำตลอดไทม์ไลน์ หรือผูกกฎกับส่วนหนึ่ง",
|
||||||
|
"wb.doctor.css-universal.found": "กฎนี้ใช้ตัวเลือกสากล (*) ซึ่งถูกจับคู่กับทุกองค์ประกอบ",
|
||||||
|
"wb.doctor.css-universal.fix": "ผูกกฎกับส่วนหนึ่งแทน",
|
||||||
|
"wb.doctor.css-blur.found": "กฎนี้เบลอสิ่งที่อยู่ด้านหลัง (backdrop-filter) ซึ่งสิ้นเปลืองในส่วนที่ซ้ำกันหลายครั้ง",
|
||||||
|
"wb.doctor.css-blur.fix": "ใช้การเติมแบบกระจกของแถบและแผง: เป็นที่ที่เบลอได้ถูกกว่า",
|
||||||
|
"wb.doctor.css-outline-none.found": "กฎนี้ลบเส้นขอบโฟกัสออก ทำให้มองไม่เห็นโฟกัสของคีย์บอร์ดอีกต่อไป",
|
||||||
|
"wb.doctor.css-outline-none.fix": "ใช้ decor.focusRing เพื่อวาดวงแหวนโฟกัสที่มองเห็นได้แทน",
|
||||||
|
"wb.doctor.css-motion.found": "กฎนี้ทำแอนิเมชันโดยไม่ตรวจสอบการลดการเคลื่อนไหว",
|
||||||
|
"wb.doctor.css-motion.fix": "เก็บการเคลื่อนไหวไว้ใน @media (prefers-reduced-motion: no-preference) หรือให้ decor.motion จัดการให้",
|
||||||
|
"wb.doctor.css-size.found": "CSS ยาวเกิน 20,000 ตัวอักษร",
|
||||||
|
"wb.doctor.css-size.fix": "เว็บไซต์คำนวณสไตล์ใหม่ทุกกฎ โทเค็นและการตั้งค่าคอมโพเนนต์คอมไพล์เป็นกฎที่น้อยกว่า",
|
||||||
|
"wb.doctor.contrast.found": "สี {token} ถูกปรับเพื่อให้ยังอ่านได้ ({ratio}:1 บนพื้นหลัง)",
|
||||||
|
"wb.doctor.contrast.fix": "เลือกสี {token} ที่สว่างขึ้นหรือเข้มขึ้น ระหว่างนี้ธีมจะแสดงด้วยสีที่ปรับแล้ว",
|
||||||
|
"wb.doctor.glass-post.found": "ตั้งค่ากระจกไว้กับโพสต์ แต่ไม่ถูกวาด: การเบลอทุกโพสต์ในไทม์ไลน์สิ้นเปลืองเกินไป",
|
||||||
|
"wb.doctor.glass-post.fix": "ใช้การเติมสีทึบหรือสีอ่อนกับโพสต์ และเก็บกระจกไว้ใช้กับแถบและแผง",
|
||||||
|
"wb.doctor.small-post-text.found": "ข้อความโพสต์มีขนาด {size}px ซึ่งอ่านยากสำหรับหลายคน",
|
||||||
|
"wb.doctor.small-post-text.fix": "ใช้ 14px ขึ้นไปสำหรับขนาดข้อความโพสต์ หรือเพิ่มขนาดข้อความของทั้งธีม",
|
||||||
|
"wb.doctor.nav-moved.found": "การนำทางถูกย้ายไปที่ {position} ซึ่งเปลี่ยนที่ที่ผู้คนมองหามัน",
|
||||||
|
"wb.doctor.nav-moved.fix": "ใช้เฉพาะแผงที่กว้าง และเจ้าของปิดการเปลี่ยนเลย์เอาต์ได้ คงตำแหน่งเริ่มต้นไว้ เว้นแต่เลย์เอาต์จำเป็นต้องใช้",
|
||||||
"wb.setup.title": "แชร์การตั้งค่าของฉัน",
|
"wb.setup.title": "แชร์การตั้งค่าของฉัน",
|
||||||
"wb.setup.hint": "ธีม ไอคอน โหมด และฟีเจอร์ที่เปิดอยู่ของคุณ เป็นลิงก์เดียวหรือไฟล์เล็กๆ ไฟล์เดียว ใครก็ใช้เริ่มจากสิ่งที่คุณมีได้",
|
"wb.setup.hint": "ธีม ไอคอน โหมด และฟีเจอร์ที่เปิดอยู่ของคุณ เป็นลิงก์เดียวหรือไฟล์เล็กๆ ไฟล์เดียว ใครก็ใช้เริ่มจากสิ่งที่คุณมีได้",
|
||||||
"wb.setup.shareLabel": "การตั้งค่าของคุณ",
|
"wb.setup.shareLabel": "การตั้งค่าของคุณ",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "{name} kaldır",
|
"wb.appearance.icons.remove": "{name} kaldır",
|
||||||
"wb.appearance.icons.removed": "“{name}” simge paketi kaldırıldı.",
|
"wb.appearance.icons.removed": "“{name}” simge paketi kaldırıldı.",
|
||||||
"wb.appearance.icons.imported": "İçe aktarılan simge paketleri",
|
"wb.appearance.icons.imported": "İçe aktarılan simge paketleri",
|
||||||
|
"wb.doctor.title": "Tema doktoru",
|
||||||
|
"wb.doctor.hint": "Bu tema hakkında öneriler: aynı işi yapmanın daha hafif yolları, maliyetler ve kontrast. Yalnızca önerir; hiçbir şey engellenmez ya da değiştirilmez.",
|
||||||
|
"wb.doctor.empty": "Bildirilecek bir şey yok: tema belirteçleri ve bileşen ayarlarını kullanıyor, içinde maliyetli bir şey yok.",
|
||||||
|
"wb.doctor.count": "{count, plural, one {# bulgu} other {# bulgu}}",
|
||||||
|
"wb.doctor.kind.lighter": "Daha hafif bir yol",
|
||||||
|
"wb.doctor.kind.performance": "Performans",
|
||||||
|
"wb.doctor.kind.accessibility": "Erişilebilirlik",
|
||||||
|
"wb.doctor.kind.contrast": "Kontrast",
|
||||||
|
"wb.doctor.where": "Nerede",
|
||||||
|
"wb.doctor.fix": "Çözüm",
|
||||||
|
"wb.doctor.css-radius.found": "Bu kural köşe yarıçaplarını CSS ile ayarlıyor.",
|
||||||
|
"wb.doctor.css-radius.fix": "Bunları components altındaki bir parçanın radius değeriyle ya da hepsi için shape.radius ile ayarla: CSS gerekmez, site sınıf adlarını değiştirse de çalışmaya devam eder.",
|
||||||
|
"wb.doctor.css-bevel.found": "Bu kural, üst üste eklenmiş iç gölgelerle eğimli bir kenar çiziyor.",
|
||||||
|
"wb.doctor.css-bevel.fix": "components altındaki bir parçada borderStyle \"bevel-out\" ya da \"bevel-in\" kullan: eğimi temanın renklerinden çizer.",
|
||||||
|
"wb.doctor.css-hide.found": "Bu kural bir şeyi display: none ile gizliyor.",
|
||||||
|
"wb.doctor.css-hide.fix": "components altındaki bir parçada (avatarlar, sayaçlar, adlar) visible kullan ya da sidebar: hidden gibi bir yerleşim varyantı seç; böylece sahibi tekrar açabilir.",
|
||||||
|
"wb.doctor.css-color.found": "Bu kural sabit bir renk kullanıyor.",
|
||||||
|
"wb.doctor.css-color.fix": "colors içinde ya da bir bileşende bir rol (text, muted, accent, surface…) belirt; böylece kontrast denetimi onu kapsar.",
|
||||||
|
"wb.doctor.css-font.found": "Bu kural bir yazı tipi ailesi ayarlıyor.",
|
||||||
|
"wb.doctor.css-font.fix": "font.roles kullan: gönderi, başlık, sayı ve eş aralıklı yazı tiplerini CSS olmadan ayarlar.",
|
||||||
|
"wb.doctor.css-has.found": "Bu kural, sayfadaki her değişiklikte yeniden eşleştirilen :has() kullanıyor.",
|
||||||
|
"wb.doctor.css-has.fix": ":has() değerini zaman akışında tekrar eden kurallarda kullanma ya da kuralı bir parçaya bağla.",
|
||||||
|
"wb.doctor.css-universal.found": "Bu kural her öğeyle eşleştirilen bir evrensel seçici (*) kullanıyor.",
|
||||||
|
"wb.doctor.css-universal.fix": "Bunun yerine kuralı bir parçaya bağla.",
|
||||||
|
"wb.doctor.css-blur.found": "Bu kural arkasındakini bulanıklaştırıyor (backdrop-filter); tekrar eden parçalarda bu maliyetlidir.",
|
||||||
|
"wb.doctor.css-blur.fix": "Çubukların ve panellerin cam dolgusunu kullan: bulanıklık için en ucuz yer burasıdır.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Bu kural odak çerçevesini kaldırıyor, böylece klavye odağı görünmez oluyor.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Bunun yerine görünür bir odak halkası çizmek için decor.focusRing kullan.",
|
||||||
|
"wb.doctor.css-motion.found": "Bu kural, hareketi azalt tercihini denetlemeden animasyon yapıyor.",
|
||||||
|
"wb.doctor.css-motion.fix": "Hareketi @media (prefers-reduced-motion: no-preference) içinde tut ya da bunu decor.motion yapsın.",
|
||||||
|
"wb.doctor.css-size.found": "CSS 20.000 karakterden uzun.",
|
||||||
|
"wb.doctor.css-size.fix": "Site her kuralda stilleri yeniden hesaplar; belirteçler ve bileşen ayarları daha az kurala derlenir.",
|
||||||
|
"wb.doctor.contrast.found": "{token} rengi okunabilir kalması için ayarlandı (arka planda {ratio}:1).",
|
||||||
|
"wb.doctor.contrast.fix": "Daha açık ya da daha koyu bir {token} rengi seç; o zamana kadar tema ayarlanmış renkle gösterilir.",
|
||||||
|
"wb.doctor.glass-post.found": "Gönderilerde cam ayarlanmış ama çizilmiyor: bir zaman akışındaki her gönderide bulanıklık çok maliyetli.",
|
||||||
|
"wb.doctor.glass-post.fix": "Gönderiler için düz ya da renk tonlu bir dolgu kullan, camı çubuklara ve panellere bırak.",
|
||||||
|
"wb.doctor.small-post-text.found": "Gönderi metni {size}px; bu birçok kişi için okunması zor bir boyut.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Gönderi metin boyutu için 14px veya daha büyük kullan ya da tüm temanın metin boyutunu artır.",
|
||||||
|
"wb.doctor.nav-moved.found": "Gezinme {position} konumuna taşınmış; bu, insanların onu nerede aradığını değiştirir.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Yalnızca geniş bölmelerde geçerlidir ve sahibi yerleşim değişikliklerini kapatabilir. Yerleşim gerektirmedikçe varsayılan konumu koru.",
|
||||||
"wb.setup.title": "Kurulumumu paylaş",
|
"wb.setup.title": "Kurulumumu paylaş",
|
||||||
"wb.setup.hint": "Temanı, simgelerini, modunu ve hangi özelliklerin açık olduğunu tek bir bağlantı ya da küçük bir dosya olarak. Herkes senin kurulumundan başlamak için kullanabilir.",
|
"wb.setup.hint": "Temanı, simgelerini, modunu ve hangi özelliklerin açık olduğunu tek bir bağlantı ya da küçük bir dosya olarak. Herkes senin kurulumundan başlamak için kullanabilir.",
|
||||||
"wb.setup.shareLabel": "Kurulumun",
|
"wb.setup.shareLabel": "Kurulumun",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "Xóa {name}",
|
"wb.appearance.icons.remove": "Xóa {name}",
|
||||||
"wb.appearance.icons.removed": "Đã xóa gói biểu tượng “{name}”.",
|
"wb.appearance.icons.removed": "Đã xóa gói biểu tượng “{name}”.",
|
||||||
"wb.appearance.icons.imported": "Gói biểu tượng đã nhập",
|
"wb.appearance.icons.imported": "Gói biểu tượng đã nhập",
|
||||||
|
"wb.doctor.title": "Bác sĩ chủ đề",
|
||||||
|
"wb.doctor.hint": "Lời khuyên về chủ đề này: cách nhẹ hơn để làm cùng một việc, chi phí và độ tương phản. Chỉ đưa ra lời khuyên; không có gì bị chặn hay thay đổi.",
|
||||||
|
"wb.doctor.empty": "Không có gì để báo cáo: chủ đề dùng token và cài đặt thành phần, và không có gì trong đó tốn kém.",
|
||||||
|
"wb.doctor.count": "{count, plural, other {# phát hiện}}",
|
||||||
|
"wb.doctor.kind.lighter": "Một cách nhẹ hơn",
|
||||||
|
"wb.doctor.kind.performance": "Hiệu năng",
|
||||||
|
"wb.doctor.kind.accessibility": "Khả năng truy cập",
|
||||||
|
"wb.doctor.kind.contrast": "Độ tương phản",
|
||||||
|
"wb.doctor.where": "Ở đâu",
|
||||||
|
"wb.doctor.fix": "Cách sửa",
|
||||||
|
"wb.doctor.css-radius.found": "Quy tắc này đặt bán kính góc bằng CSS.",
|
||||||
|
"wb.doctor.css-radius.fix": "Hãy đặt bằng radius của một phần trong components, hoặc shape.radius cho tất cả: không cần CSS, và vẫn hoạt động khi trang đổi tên class.",
|
||||||
|
"wb.doctor.css-bevel.found": "Quy tắc này vẽ viền vát bằng các bóng đổ bên trong xếp chồng.",
|
||||||
|
"wb.doctor.css-bevel.fix": "Dùng borderStyle \"bevel-out\" hoặc \"bevel-in\" cho một phần trong components: viền vát được vẽ từ màu của chủ đề.",
|
||||||
|
"wb.doctor.css-hide.found": "Quy tắc này ẩn một thứ bằng display: none.",
|
||||||
|
"wb.doctor.css-hide.fix": "Dùng visible cho một phần trong components (ảnh đại diện, số đếm, tên) hoặc một biến thể bố cục như sidebar: hidden; chủ sở hữu có thể bật lại.",
|
||||||
|
"wb.doctor.css-color.found": "Quy tắc này dùng một màu cố định.",
|
||||||
|
"wb.doctor.css-color.fix": "Hãy nêu một vai trò (text, muted, accent, surface…) trong colors hoặc trong một thành phần, để bước kiểm tra độ tương phản bao quát được nó.",
|
||||||
|
"wb.doctor.css-font.found": "Quy tắc này đặt một họ phông chữ.",
|
||||||
|
"wb.doctor.css-font.fix": "Dùng font.roles: nó đặt phông chữ cho bài đăng, tiêu đề, số và mono mà không cần CSS.",
|
||||||
|
"wb.doctor.css-has.found": "Quy tắc này dùng :has(), vốn bị so khớp lại mỗi khi trang thay đổi.",
|
||||||
|
"wb.doctor.css-has.fix": "Đừng dùng :has() trong các quy tắc lặp lại dọc theo dòng thời gian, hoặc gắn quy tắc vào một phần.",
|
||||||
|
"wb.doctor.css-universal.found": "Quy tắc này dùng bộ chọn toàn cục (*), bị so khớp với mọi phần tử.",
|
||||||
|
"wb.doctor.css-universal.fix": "Hãy gắn quy tắc vào một phần thay vào đó.",
|
||||||
|
"wb.doctor.css-blur.found": "Quy tắc này làm mờ những gì phía sau (backdrop-filter), rất tốn kém với các phần lặp lại.",
|
||||||
|
"wb.doctor.css-blur.fix": "Dùng lớp nền kính của thanh và bảng: đó là nơi làm mờ rẻ hơn.",
|
||||||
|
"wb.doctor.css-outline-none.found": "Quy tắc này xóa viền tiêu điểm, nên tiêu điểm bàn phím không còn nhìn thấy được.",
|
||||||
|
"wb.doctor.css-outline-none.fix": "Hãy dùng decor.focusRing để vẽ vòng tiêu điểm nhìn thấy được.",
|
||||||
|
"wb.doctor.css-motion.found": "Quy tắc này tạo hoạt ảnh mà không kiểm tra tùy chọn giảm chuyển động.",
|
||||||
|
"wb.doctor.css-motion.fix": "Giữ chuyển động bên trong @media (prefers-reduced-motion: no-preference), hoặc để decor.motion làm việc đó cho bạn.",
|
||||||
|
"wb.doctor.css-size.found": "CSS dài hơn 20.000 ký tự.",
|
||||||
|
"wb.doctor.css-size.fix": "Trang tính lại kiểu cho từng quy tắc; token và cài đặt thành phần được biên dịch thành ít quy tắc hơn.",
|
||||||
|
"wb.doctor.contrast.found": "Màu {token} đã được điều chỉnh để vẫn dễ đọc ({ratio}:1 trên nền).",
|
||||||
|
"wb.doctor.contrast.fix": "Hãy chọn màu {token} sáng hơn hoặc tối hơn; cho đến lúc đó chủ đề được hiển thị với màu đã điều chỉnh.",
|
||||||
|
"wb.doctor.glass-post.found": "Kính được đặt cho bài đăng nhưng không được vẽ: làm mờ trên mọi bài đăng của dòng thời gian quá tốn kém.",
|
||||||
|
"wb.doctor.glass-post.fix": "Dùng nền đặc hoặc có pha màu cho bài đăng và để dành kính cho thanh và bảng.",
|
||||||
|
"wb.doctor.small-post-text.found": "Chữ của bài đăng cỡ {size}px, nhiều người khó đọc.",
|
||||||
|
"wb.doctor.small-post-text.fix": "Dùng 14px trở lên cho cỡ chữ bài đăng, hoặc tăng cỡ chữ của cả chủ đề.",
|
||||||
|
"wb.doctor.nav-moved.found": "Thanh điều hướng được chuyển sang {position}, làm thay đổi nơi mọi người tìm nó.",
|
||||||
|
"wb.doctor.nav-moved.fix": "Điều này chỉ áp dụng trên ngăn rộng, và chủ sở hữu có thể tắt các thay đổi bố cục. Hãy giữ vị trí mặc định trừ khi bố cục cần khác.",
|
||||||
"wb.setup.title": "Chia sẻ thiết lập của tôi",
|
"wb.setup.title": "Chia sẻ thiết lập của tôi",
|
||||||
"wb.setup.hint": "Chủ đề, biểu tượng, chế độ và những tính năng đang bật của bạn, trong một liên kết hoặc một tệp nhỏ. Ai cũng có thể dùng để bắt đầu từ những gì bạn có.",
|
"wb.setup.hint": "Chủ đề, biểu tượng, chế độ và những tính năng đang bật của bạn, trong một liên kết hoặc một tệp nhỏ. Ai cũng có thể dùng để bắt đầu từ những gì bạn có.",
|
||||||
"wb.setup.shareLabel": "Thiết lập của bạn",
|
"wb.setup.shareLabel": "Thiết lập của bạn",
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,46 @@
|
||||||
"wb.appearance.icons.remove": "移除 {name}",
|
"wb.appearance.icons.remove": "移除 {name}",
|
||||||
"wb.appearance.icons.removed": "已移除圖示包「{name}」。",
|
"wb.appearance.icons.removed": "已移除圖示包「{name}」。",
|
||||||
"wb.appearance.icons.imported": "已匯入的圖示包",
|
"wb.appearance.icons.imported": "已匯入的圖示包",
|
||||||
|
"wb.doctor.title": "主題醫生",
|
||||||
|
"wb.doctor.hint": "關於此主題的建議:用更輕量的方式達到相同效果、成本與對比度。它只提供建議,不會封鎖或更改任何內容。",
|
||||||
|
"wb.doctor.empty": "沒有需要回報的項目:此主題使用了 token 與元件設定,也沒有任何高成本的內容。",
|
||||||
|
"wb.doctor.count": "{count, plural, other {# 項發現}}",
|
||||||
|
"wb.doctor.kind.lighter": "更輕量的做法",
|
||||||
|
"wb.doctor.kind.performance": "效能",
|
||||||
|
"wb.doctor.kind.accessibility": "無障礙",
|
||||||
|
"wb.doctor.kind.contrast": "對比度",
|
||||||
|
"wb.doctor.where": "位置",
|
||||||
|
"wb.doctor.fix": "修正",
|
||||||
|
"wb.doctor.css-radius.found": "此規則以 CSS 設定圓角半徑。",
|
||||||
|
"wb.doctor.css-radius.fix": "請用 components 下某個部件的 radius 來設定,或用 shape.radius 一次套用到全部:不需要 CSS,網站更改類別名稱後也能繼續運作。",
|
||||||
|
"wb.doctor.css-bevel.found": "此規則以多層內陰影繪製斜角邊緣。",
|
||||||
|
"wb.doctor.css-bevel.fix": "請在 components 下的部件使用 borderStyle \"bevel-out\" 或 \"bevel-in\":它會依主題的顏色繪製斜角。",
|
||||||
|
"wb.doctor.css-hide.found": "此規則用 display: none 隱藏了某些內容。",
|
||||||
|
"wb.doctor.css-hide.fix": "請在 components 下的部件(頭像、數量、名稱)使用 visible,或使用 sidebar: hidden 這類版面變體;擁有者之後可以再把它開啟。",
|
||||||
|
"wb.doctor.css-color.found": "此規則使用了寫死的顏色。",
|
||||||
|
"wb.doctor.css-color.fix": "請在 colors 或元件中指定一個角色(text、muted、accent、surface…),讓對比度檢查涵蓋到它。",
|
||||||
|
"wb.doctor.css-font.found": "此規則設定了字型家族。",
|
||||||
|
"wb.doctor.css-font.fix": "請使用 font.roles:它不需要 CSS 就能設定貼文、標題、數字與等寬字型。",
|
||||||
|
"wb.doctor.css-has.found": "此規則使用了 :has(),頁面每次變動都會重新比對。",
|
||||||
|
"wb.doctor.css-has.fix": "請避免在時間軸中重複出現的規則裡使用 :has(),或將規則錨定在某個部件上。",
|
||||||
|
"wb.doctor.css-universal.found": "此規則使用了萬用選擇器 (*),會與每個元素進行比對。",
|
||||||
|
"wb.doctor.css-universal.fix": "請改為將規則錨定在某個部件上。",
|
||||||
|
"wb.doctor.css-blur.found": "此規則會模糊後方內容 (backdrop-filter),在重複出現的部件上成本很高。",
|
||||||
|
"wb.doctor.css-blur.fix": "請使用列與面板的玻璃填色:那裡是成本較低的模糊位置。",
|
||||||
|
"wb.doctor.css-outline-none.found": "此規則移除了焦點外框,使鍵盤焦點不再可見。",
|
||||||
|
"wb.doctor.css-outline-none.fix": "請改用 decor.focusRing 繪製清楚可見的焦點環。",
|
||||||
|
"wb.doctor.css-motion.found": "此規則在未檢查「減少動態效果」設定的情況下執行動畫。",
|
||||||
|
"wb.doctor.css-motion.fix": "請將動態效果放在 @media (prefers-reduced-motion: no-preference) 內,或交給 decor.motion 處理。",
|
||||||
|
"wb.doctor.css-size.found": "CSS 超過 20,000 個字元。",
|
||||||
|
"wb.doctor.css-size.fix": "網站會針對每條規則重新計算樣式;token 與元件設定編譯後的規則較少。",
|
||||||
|
"wb.doctor.contrast.found": "{token} 顏色已經過調整以維持可讀性(與背景的對比為 {ratio}:1)。",
|
||||||
|
"wb.doctor.contrast.fix": "請選擇較亮或較暗的 {token} 顏色;在此之前,主題會以調整後的顏色顯示。",
|
||||||
|
"wb.doctor.glass-post.found": "貼文已設定玻璃效果,但不會繪製:對時間軸上每則貼文都做模糊,成本太高。",
|
||||||
|
"wb.doctor.glass-post.fix": "貼文請使用純色或帶色調的填色,並把玻璃效果留給列與面板。",
|
||||||
|
"wb.doctor.small-post-text.found": "貼文文字為 {size}px,對許多人來說難以閱讀。",
|
||||||
|
"wb.doctor.small-post-text.fix": "貼文文字大小請使用 14px 以上,或調大整個主題的文字大小。",
|
||||||
|
"wb.doctor.nav-moved.found": "導覽列已移到{position},這會改變人們尋找它的位置。",
|
||||||
|
"wb.doctor.nav-moved.fix": "這只會套用在寬窗格,且擁有者可以關閉版面變更。除非版面需要,否則請保留預設位置。",
|
||||||
"wb.setup.title": "分享我的設定",
|
"wb.setup.title": "分享我的設定",
|
||||||
"wb.setup.hint": "你的主題、圖示、模式以及開啟了哪些功能,做成一個連結或一個小檔案。任何人都能用它從你的設定開始。",
|
"wb.setup.hint": "你的主題、圖示、模式以及開啟了哪些功能,做成一個連結或一個小檔案。任何人都能用它從你的設定開始。",
|
||||||
"wb.setup.shareLabel": "你的設定",
|
"wb.setup.shareLabel": "你的設定",
|
||||||
|
|
|
||||||
|
|
@ -78,3 +78,21 @@ test('command: the config, --inventory, usage and the binary', async () => {
|
||||||
assert.equal(run.status, 1);
|
assert.equal(run.status, 1);
|
||||||
assert.match(execFileSync(process.execPath, [BIN, '--help'], { encoding: 'utf8' }), /waybetter strings check/);
|
assert.match(execFileSync(process.execPath, [BIN, '--help'], { encoding: 'utf8' }), /waybetter strings check/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('check: a rewording pack with a language condition is described, and a rich value with its element slots passes', async () => {
|
||||||
|
const dir = app({}, { when: { languages: ['en'] }, rewrite: { words: { Post: 'Tweet', posts: 'tweets' } } });
|
||||||
|
const result = await checkPack(join(dir, 'pack.json'), [join(dir, 'demo.web.inventory.json')]);
|
||||||
|
assert.equal(result.errors, 0);
|
||||||
|
const text = result.lines.join('\n');
|
||||||
|
assert.match(text, /Applies only while the site shows: en/);
|
||||||
|
assert.match(text, /Rewords 2 words inside the site's own text: Post, posts/);
|
||||||
|
const rich = app({ c0000001: 'Legu {e1} antaŭ {e0}.' });
|
||||||
|
json(join(rich, 'demo.web.inventory.json'), { format: 1, site: 'demo', catalog: 'web', base: 'en', entries: { c0000001: { kind: 'rich', slots: 2, hash: '00000000004' } } });
|
||||||
|
const done = await checkPack(join(rich, 'pack.json'), [join(rich, 'demo.web.inventory.json')]);
|
||||||
|
assert.equal(done.errors, 0);
|
||||||
|
assert.match(done.lines.join('\n'), /1 strings: 1 valid, 0 refused/);
|
||||||
|
const bad = app({ c0000001: 'Legu {e7}.' });
|
||||||
|
json(join(bad, 'demo.web.inventory.json'), { format: 1, site: 'demo', catalog: 'web', base: 'en', entries: { c0000001: { kind: 'rich', slots: 2, hash: '00000000004' } } });
|
||||||
|
const refused = await checkPack(join(bad, 'pack.json'), [join(bad, 'demo.web.inventory.json')]);
|
||||||
|
assert.equal(refused.errors, 1);
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue