Cloudflare Pages / Build and verify the site (push) Successful in 3m29s
Use the verified dependency lock across native hosts and bundled apps. Preserve saved styles, local app reactivation, and offline packages while integrating the latest practice, Habits, Lumi, and figure preview updates.
38 lines
1.4 KiB
Ziran
38 lines
1.4 KiB
Ziran
// Exercise the actual packaged assets, including the lifetime of catalog
|
|
// slices when the root closes and reloads. No embedded locale fallback exists
|
|
// in the integration host, so a missing package resource cannot be hidden.
|
|
#import, file "../src/app/locale.zi";
|
|
#import, file "../src/app/assets.zi";
|
|
#import "locale_parser"
|
|
|
|
PackagedLocaleMatches :: (code: string) -> bool {
|
|
if !LocaleUse(code) {
|
|
return false
|
|
}
|
|
active := LocaleAssetForCode(code)
|
|
english := AssetRead("locales/en.txt")
|
|
if !active.found || !english.found {
|
|
return false
|
|
}
|
|
cursor: s32 = 0
|
|
checked: s32 = 0
|
|
while cursor < cast(s32)english.data.count {
|
|
line := LocaleNextLine(english.data, cursor)
|
|
cursor = line.next
|
|
if line.end - line.start > 2 &&
|
|
english.data[line.start] == cast(u8)91 &&
|
|
english.data[line.end - 1] == cast(u8)93 {
|
|
key := english.data[line.start + 1:line.end - 1]
|
|
expected := LocaleFindText(active.data, key)
|
|
if !expected.found || expected.text.count == 0 ||
|
|
LocaleText(key) != expected.text {
|
|
print("Packaged locale % key %: expected % bytes, actual % bytes, found=%\n",
|
|
code, key, expected.text.count, LocaleText(key).count, expected.found)
|
|
return false
|
|
}
|
|
checked += 1
|
|
}
|
|
}
|
|
return checked > 600
|
|
}
|