~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/parseJapkougo.js



import fs from 'node:fs/promises';
const jaBookNames = {
'Genesis': '創世記',
'Exodus': '出エジプト記',
'Leviticus': 'レビ記',
'Numbers': '民数記',
'Deuteronomy': '申命記',
'Joshua': 'ヨシュア記',
'Judges': '士師記',
'Ruth': 'ルツ記',
'1 Samuel': 'サムエル記上',
'2 Samuel': 'サムエル記下',
'1 Kings': '列王紀上',
'2 Kings': '列王紀下',
'1 Chronicles': '歴代志上',
'2 Chronicles': '歴代志下',
'Ezra': 'エズラ記',
'Nehemiah': 'ネヘミヤ記',
'Esther': 'エステル記',
'Job': 'ヨブ記',
'Psalms': '詩篇',
'Proverbs': '箴言',
'Ecclesiastes': '伝道の書',
'Song of Solomon': '雅歌',
'Isaiah': 'イザヤ書',
'Jeremiah': 'エレミヤ書',
'Lamentations': '哀歌',
'Ezekiel': 'エゼキエル書',
'Daniel': 'ダニエル書',
'Hosea': 'ホセア書',
'Joel': 'ヨエル書',
'Amos': 'アモス書',
'Obadiah': 'オバデヤ書',
'Jonah': 'ヨナ書',
'Micah': 'ミカ書',
'Nahum': 'ナホム書',
'Habakkuk': 'ハバクク書',
'Zephaniah': 'ゼパニヤ書',
'Haggai': 'ハガイ書',
'Zechariah': 'ゼカリヤ書',
'Malachi': 'マラキ書',
'Matthew': 'マタイによる福音書',
'Mark': 'マルコによる福音書',
'Luke': 'ルカによる福音書',
'John': 'ヨハネによる福音書',
'Acts': '使徒行伝',
'Romans': 'ローマ人への手紙',
'1 Corinthians': 'コリント人への第一の手紙',
'2 Corinthians': 'コリント人への第二の手紙',
'Galatians': 'ガラテヤ人への手紙',
'Ephesians': 'エペソ人への手紙',
'Philippians': 'ピリピ人への手紙',
'Colossians': 'コロサイ人への手紙',
'1 Thessalonians': 'テサロニケ人への第一の手紙',
'2 Thessalonians': 'テサロニケ人への第二の手紙',
'1 Timothy': 'テモテへの第一の手紙',
'2 Timothy': 'テモテへの第二の手紙',
'Titus': 'テトスへの手紙',
'Philemon': 'ピレモンへの手紙',
'Hebrews': 'ヘブル人への手紙',
'James': 'ヤコブの手紙',
'1 Peter': 'ペテロの第一の手紙',
'2 Peter': 'ペテロの第二の手紙',
'1 John': 'ヨハネの第一の手紙',
'2 John': 'ヨハネの第二の手紙',
'3 John': 'ヨハネの第三の手紙',
'Jude': 'ユダの手紙',
'Revelation of John': 'ヨハネの黙示録',
};
// Read headings from en_kjv.txt (keyed by bookIndex-chapterIndex-verseIndex)
const kjvData = await fs.readFile('./files/en_kjv.txt', 'utf8');
const kjvLines = kjvData.split('\n');
const headingMap = {};
for (const line of kjvLines) {
if (!line) continue;
const parts = line.split('|');
const key = `${parts[1]}-${parts[2]}-${parts[3]}`;
headingMap[key] = parts[4] || '';
}
const data = JSON.parse(await fs.readFile('./json/japkougo.json', 'utf8'));
const outputLines = [];
for (let bookIndex = 0; bookIndex < data.books.length; bookIndex++) {
const book = data.books[bookIndex];
const bookName = jaBookNames[book.name] || book.name;
for (let chapterIndex = 0; chapterIndex < book.chapters.length; chapterIndex++) {
const chapter = book.chapters[chapterIndex];
for (let verseIndex = 0; verseIndex < chapter.verses.length; verseIndex++) {
const verse = chapter.verses[verseIndex];
const verseText = verse.text.trim();
const key = `${bookIndex}-${chapterIndex}-${verseIndex}`;
const heading = headingMap[key] || '';
outputLines.push(`${bookName}|${bookIndex}|${chapterIndex}|${verseIndex}|${heading}|${verseText}`);
}
}
}
await fs.writeFile('./files/ja.txt', outputLines.join('\n'), 'utf8');
console.log(`Written ${outputLines.length} verses to files/ja.txt`);