Prefer CN device matches

This commit is contained in:
2026-04-24 10:15:55 +08:00
parent c9a2d13945
commit d36669103e
7 changed files with 42441 additions and 44883 deletions
+7 -2
View File
@@ -1688,7 +1688,10 @@ NOH-AL00 -> nohal00</pre>
}
function isCnSourceFile(sourceFile) {
return /_cn\.md$/i.test(sourceFile || "");
const source = String(sourceFile || "").trim().toLowerCase();
if (!source) return false;
if (source === "local/manual_catalog.json") return true;
return !(/_en\.md$/i.test(source) || /_global_en\.md$/i.test(source));
}
function buildInitialSourceOrder() {
@@ -2045,7 +2048,9 @@ NOH-AL00 -> nohal00</pre>
const topBase = brandStrictMatches.length
? brandStrictMatches
: (manufacturerStrictMatches.length ? manufacturerStrictMatches : allMatches);
const top = topBase.slice(0, 200);
const preferredTopBase = topBase.filter((x) => isCnSourceFile(x.record && x.record.source_file));
const topSourceBase = preferredTopBase.length ? preferredTopBase : topBase;
const top = topSourceBase.slice(0, 1);
const best = top.length ? top[0] : null;