~repos /only-bible-app

#kotlin#android#ios

GIT_CONFIG_PARAMETERS="'http.version=HTTP/1.1'" git clone https://git.pyrossh.dev/only-bible-app.git
Discussions: https://groups.google.com/g/rust-embed-devs

The only bible app you will ever need. No ads. No in-app purchases. No distractions.



scripts/addBookNames.js



import fs from "node:fs";
import path from "node:path";
const d = JSON.parse(fs.readFileSync(path.join(import.meta.dirname, "headings.json"), "utf8"));
const filesDir = path.join(import.meta.dirname, "files");
const txtFiles = fs.readdirSync(filesDir).filter((f) => f.endsWith(".txt"));
// Build bookIndex -> bookName for each language
const langBookNames = {};
for (const f of txtFiles) {
const lang = f.replace(".txt", "");
const content = fs.readFileSync(path.join(filesDir, f), "utf8");
const names = {};
for (const line of content.split("\n")) {
if (!line.trim()) continue;
const parts = line.split("|");
const bookIdx = parseInt(parts[1]);
if (!(bookIdx in names)) names[bookIdx] = parts[0];
}
langBookNames[lang] = names;
}
// Update each book's bookName with all languages
for (let i = 0; i < d.length; i++) {
for (const [lang, names] of Object.entries(langBookNames)) {
if (names[i]) {
d[i].bookName[lang] = names[i];
}
}
}
fs.writeFileSync(path.join(import.meta.dirname, "headings.json"), JSON.stringify(d, null, 2) + "\n");
console.log(`Done — added book names from ${txtFiles.length} languages`);