mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +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 = [
|
||||
// "../../packages/core/src/protos",
|
||||
// "../../packages/closed/protos",
|
||||
"../../packages/closed/protos",
|
||||
"../../packages/website-ue/src/protos",
|
||||
];
|
||||
|
||||
@@ -67,7 +67,7 @@ for (const root of roots) {
|
||||
|
||||
if (command.length + newLine.length < MAX_COMMAND_LENGTH) {
|
||||
command += newLine;
|
||||
files.pop();
|
||||
console.log(` ${files.pop()}`);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -53,30 +53,37 @@ export class ServerAPI extends AbstractAPI {
|
||||
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 configPath = `${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`;
|
||||
|
||||
for (const namespace of config.namespaces) {
|
||||
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>;
|
||||
try {
|
||||
const config = await fetch(configPath)
|
||||
.then((response) => response.text())
|
||||
.then((text) => parse(text) as LocalizationConfig);
|
||||
|
||||
for (const key in parsed) {
|
||||
strings[key] = parsed[key].replaceAll('\\"', '"');
|
||||
}
|
||||
for (const namespace of config.namespaces) {
|
||||
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