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
@@ -1,6 +1,6 @@
|
||||
// Imported by the server: no i18n here. The text stays English data; layers
|
||||
// show it translated (translateKnown).
|
||||
const msg = (text) => text;
|
||||
// Imported by the server: the catalog-free marker, not src/i18n/index.js. The
|
||||
// text stays English data; layers show it translated (translateKnown).
|
||||
import { msg } from '../i18n/marker.js';
|
||||
|
||||
const tooLarge = () =>
|
||||
Object.assign(new Error(msg('Upstream response too large')), {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readResponseBytesCapped } from './httpBody.js';
|
||||
import { setLocale, translateKnown } from '../i18n/index.js';
|
||||
import { readResponseBytesCapped, readResponseTextCapped } from './httpBody.js';
|
||||
|
||||
/**
|
||||
* A Response that streams `chunk` forever until the reader cancels it. The
|
||||
@@ -131,3 +132,19 @@ test('falls back to arrayBuffer() for a body with no stream reader', async () =>
|
||||
assert.equal(buf.byteLength, 16);
|
||||
assert.equal(buf[0], 9);
|
||||
});
|
||||
|
||||
for (const locale of ['es', 'ru']) {
|
||||
test(`${locale}: an oversized upstream response is translated`, async () => {
|
||||
const response = new Response('x'.repeat(10), {
|
||||
headers: { 'content-length': '10' },
|
||||
});
|
||||
const error = await readResponseTextCapped(response, 4).catch((e) => e);
|
||||
assert.equal(error.message, 'Upstream response too large');
|
||||
setLocale(locale);
|
||||
try {
|
||||
assert.notEqual(translateKnown(error.message), error.message);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user