refactor(cockpit): a provider words its text with getLocale and onLocaleChange from the ./i18n entry; the ./i18n/locale export, which gave only those two, is removed

This commit is contained in:
Denis Groshev committed 2026-11-13 07:39:27 +01:00
1 parent a7d722a1f4
commit 22f43aab01
8 files changed
+17 -51

No files matched your search

+3 -3
View File
@@ -248,7 +248,7 @@ their `this`; one that throws or returns a promise is treated as having
failed.
```js
import { getLocale, onLocaleChange } from '@gods-eye-view/core/i18n/locale';
import { getLocale, onLocaleChange } from '@gods-eye-view/core/i18n';
import { pointAtS } from '@gods-eye-view/core/layers/rail/paths';
const words = {
@@ -302,7 +302,7 @@ const ride = {
createApplicationControls({ /* ... */ services: { cockpitSubjects: [ride] } });
```
`@gods-eye-view/core/i18n/locale` gives `getLocale()` and `onLocaleChange()`:
The `./i18n` entry gives `getLocale()` and `onLocaleChange()`:
Core translates only its own strings, so a provider words its labels, entry
face and HUD for the page's language (labels may be functions, as above; the
HUD is read again on a change). `@gods-eye-view/core/layers/rail/paths` is the
@@ -313,7 +313,7 @@ and Transit read APIs in `src/layers/rail/cockpitSubject.js` and
`src/layers/transit/cockpitSubject.js`. A snapshot read again while nothing in
it changed is the one read before, so `read` may take one on every update; a
train's `path.line` is a frozen copy of its line, for `pointAtS` and
`projectOnPath`. The `i18n/locale` and `layers/rail/paths` exports and the
`projectOnPath`. The `layers/rail/paths` export and the
Rail and Transit read APIs (`getSelectedTrain`, `getSelectedVehicle`,
`getCockpitSubject` and the snapshots they return, `path.line` among them)
are experimental and may change without notice.
+3 -4
View File
@@ -2251,7 +2251,7 @@ picture under the HUD (with passing light streaks, which stop under reduced
motion), arrow-key look-around when the provider asks for it, and a progress
line along the bottom edge (`src/cockpitProgress.js`: close ticks merge,
labels never overlap). Core translates none of the provider's text: a host
words it for the page's language (`@gods-eye-view/core/i18n/locale`:
words it for the page's language (`@gods-eye-view/core/i18n`:
`getLocale`, `onLocaleChange`). Its entry face, labels and look may be
functions, read again when they are shown and on a change of language, as the
HUD view is.
@@ -2267,9 +2267,8 @@ feed held, clicks and Escape left to the view; the held copy stays the one
drawn of its train while held, another feed's copy hidden, and it keeps
moving, still selected, when its category is turned off) and
`focusTrain(key)` (false for a train the layer does not draw); its pure path
module is exported as `@gods-eye-view/core/layers/rail/paths`. That export,
`@gods-eye-view/core/i18n/locale` and these read APIs are experimental and may
change without notice. A snapshot read again while nothing in it changed is
module is exported as `@gods-eye-view/core/layers/rail/paths`. That export
and these read APIs are experimental and may change without notice. A snapshot read again while nothing in it changed is
the one read before, and its `path.line` is a frozen copy. Transit
offers the same for a vehicle (`getSelectedVehicle`, `getCockpitSubject`,
`setCockpitSubject`, `focusVehicle`): a held vehicle keeps playing when it is