mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
i18n: fix the LGTM review findings and tidy the branch texts
- i18n scanner: lastError sink, no false sinks on defaults and ternaries - shared src/i18n/marker.js for modules that only mark strings - wind field messages move to wind/fields.js; CITY_POIS imports from cityPois.js - drop review IDs, change history and stale references from comments and docs Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
0ed05568f7
commit
20f4cf3763
178 files changed
+918
-948
No files matched your search
@@ -3,9 +3,8 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { setLocale, t } from '../../i18n/index.js';
|
||||
import { WIND_FIELDS } from './fields.js';
|
||||
import { SCALAR_UNAVAILABLE, WIND_FIELDS } from './fields.js';
|
||||
import { fieldUnavailableText } from './rendering.js';
|
||||
import { SCALAR_UNAVAILABLE } from './source.js';
|
||||
|
||||
for (const locale of ['es', 'ru']) {
|
||||
test(`${locale}: every field's unavailable status has a translation`, () => {
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
import { msg } from '../../i18n/marker.js';
|
||||
import { normalizeLongitude, sampleWind } from './model.js';
|
||||
|
||||
// Imported by src/tools: the catalog-free marker, not src/i18n/index.js. The
|
||||
// texts stay English data and the wind layer and layer panel show them
|
||||
// translated.
|
||||
|
||||
/** Status of a scalar overlay the provider could not supply, by overlay. */
|
||||
export const SCALAR_UNAVAILABLE = Object.freeze({
|
||||
temperature: msg('Temperature field unavailable'),
|
||||
pressure: msg('Mean sea level pressure field unavailable'),
|
||||
});
|
||||
|
||||
/** Fixed physical scales shared by imagery and the field legend. */
|
||||
export const WIND_FIELDS = Object.freeze({
|
||||
speed: Object.freeze({
|
||||
|
||||
@@ -7,17 +7,16 @@ import { orderWeatherImagery } from '../weather/imageryOrder.js';
|
||||
import { NO_IMAGERY_HOST } from '../weather/imageryHost.js';
|
||||
import { msg } from '../../i18n/index.js';
|
||||
import { createWindGpuRendering } from './gpuRendering.js';
|
||||
import { SCALAR_UNAVAILABLE } from './source.js';
|
||||
import { advectParticle, sampleWind } from './model.js';
|
||||
import {
|
||||
createFieldRaster,
|
||||
SCALAR_UNAVAILABLE,
|
||||
trailEraseAlpha,
|
||||
windTrailColor,
|
||||
} from './fields.js';
|
||||
|
||||
// A scalar overlay that cannot be drawn, in English for diagnostics; the
|
||||
// panel status shows it translated (index.js). The scalar texts are the ones
|
||||
// the source reports. setOptions only accepts these overlays.
|
||||
// English for diagnostics; the row status shows it translated (index.js). The
|
||||
// scalar texts are the source's own; setOptions accepts only these overlays.
|
||||
const FIELD_UNAVAILABLE = Object.freeze({
|
||||
speed: msg('Wind speed field unavailable'),
|
||||
...SCALAR_UNAVAILABLE,
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { readWindBody } from '../../sources/windBody.js';
|
||||
import { SCALAR_UNAVAILABLE } from './fields.js';
|
||||
|
||||
// Imported by src/tools: no i18n here. The texts stay English data and the
|
||||
// wind layer and layer panel show them translated.
|
||||
const msg = (text) => text;
|
||||
|
||||
/** Status of a scalar overlay the provider could not supply, by overlay. */
|
||||
export const SCALAR_UNAVAILABLE = Object.freeze({
|
||||
temperature: msg('Temperature field unavailable'),
|
||||
pressure: msg('Mean sea level pressure field unavailable'),
|
||||
});
|
||||
|
||||
/** Create a bounded, cancellable source for the same-origin wind provider. */
|
||||
export function createWindSource({
|
||||
fetchImpl = (...args) => globalThis.fetch(...args),
|
||||
|
||||
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
|
||||
import { setLocale } from '../../i18n/index.js';
|
||||
import { createWindLayer } from './index.js';
|
||||
|
||||
test('stale wind forecast is marked in the UI language (K-40)', async () => {
|
||||
test('stale wind forecast is marked in the UI language', async () => {
|
||||
const rendering = Object.fromEntries(
|
||||
['attach', 'start', 'stop', 'clear', 'destroy', 'setField'].map((n) => [
|
||||
n,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// K-38: wind source failures are English data (src/layers/wind/source.js) and
|
||||
// Wind source failures are English data (src/layers/wind/source.js) and
|
||||
// are shown in the UI language; the HTTP line keeps its status number.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
@@ -39,7 +39,7 @@ async function serverManifestOnUpstreamFailure() {
|
||||
return JSON.parse(body);
|
||||
}
|
||||
|
||||
test('en: the upstream failure reason reads as before (K-17)', async () => {
|
||||
test('en: the upstream failure reason reads as before', async () => {
|
||||
const manifest = await serverManifestOnUpstreamFailure();
|
||||
const layer = harness({ getSnapshot: async () => manifest });
|
||||
await layer.update();
|
||||
|
||||
Reference in new issue
Block a user