mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: lenient strings
This commit is contained in:
1 parent
3b757562d2
commit
32b5593d07
2 files changed
+29
-22
No files matched your search
@@ -11,7 +11,7 @@ const TS_PROTO_EXECUTABLE_LOCATIONS = [
|
|||||||
|
|
||||||
const roots = [
|
const roots = [
|
||||||
// "../../packages/core/src/protos",
|
// "../../packages/core/src/protos",
|
||||||
// "../../packages/closed/protos",
|
"../../packages/closed/protos",
|
||||||
"../../packages/website-ue/src/protos",
|
"../../packages/website-ue/src/protos",
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ for (const root of roots) {
|
|||||||
|
|
||||||
if (command.length + newLine.length < MAX_COMMAND_LENGTH) {
|
if (command.length + newLine.length < MAX_COMMAND_LENGTH) {
|
||||||
command += newLine;
|
command += newLine;
|
||||||
files.pop();
|
console.log(` ${files.pop()}`);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,30 +53,37 @@ export class ServerAPI extends AbstractAPI {
|
|||||||
throw new Error("No suitable production remote storage found");
|
throw new Error("No suitable production remote storage found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = await fetch(
|
|
||||||
`${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`
|
|
||||||
)
|
|
||||||
.then((response) => response.text())
|
|
||||||
.then((text) => parse(text) as LocalizationConfig);
|
|
||||||
const strings: Record<string, string> = {};
|
const strings: Record<string, string> = {};
|
||||||
|
const configPath = `${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`;
|
||||||
|
|
||||||
for (const namespace of config.namespaces) {
|
try {
|
||||||
Object.assign(
|
const config = await fetch(configPath)
|
||||||
strings,
|
.then((response) => response.text())
|
||||||
await fetch(
|
.then((text) => parse(text) as LocalizationConfig);
|
||||||
`${remoteStorage.url}/${remoteStorage.relative_path}/${namespace}/${locale}.yaml`
|
|
||||||
)
|
|
||||||
.then((response) => response.text())
|
|
||||||
.then((text) => {
|
|
||||||
const strings: Record<string, string> = {};
|
|
||||||
const parsed = parse(text) as Record<string, string>;
|
|
||||||
|
|
||||||
for (const key in parsed) {
|
for (const namespace of config.namespaces) {
|
||||||
strings[key] = parsed[key].replaceAll('\\"', '"');
|
Object.assign(
|
||||||
}
|
strings,
|
||||||
|
await fetch(
|
||||||
|
`${remoteStorage.url}/${remoteStorage.relative_path}/${namespace}/${locale}.yaml`
|
||||||
|
)
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((text) => {
|
||||||
|
const strings: Record<string, string> = {};
|
||||||
|
const parsed = parse(text) as Record<string, string>;
|
||||||
|
|
||||||
return strings;
|
for (const key in parsed) {
|
||||||
})
|
strings[key] = parsed[key].replaceAll('\\"', '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(
|
||||||
|
`Failed to fetch config from ${configPath}. Returning empty strings. This will throw an error in production. Error:`,
|
||||||
|
error
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user