Merge branch 'translation-selection'

This commit is contained in:
Benjamin A. Shelton 2026-08-19 15:04:07 -06:00
commit 4becab01d6
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
6 changed files with 352 additions and 226 deletions

View file

@ -61,6 +61,7 @@ const meta = `{
<dialog data-scripture="" <dialog data-scripture=""
class="p-0 rounded-sm w-full lg:max-w-lg xl:max-w-lg 2xl:max-w-lg m-auto flex-col flex hidden scripture"> class="p-0 rounded-sm w-full lg:max-w-lg xl:max-w-lg 2xl:max-w-lg m-auto flex-col flex hidden scripture">
<div tabindex="-1" autofocus class="p-4"> <div tabindex="-1" autofocus class="p-4">
<div>
<button data-close=""> <button data-close="">
<span class="align-middle mr-1">close</span> <span class="align-middle mr-1">close</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle inline" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle inline" viewBox="0 0 16 16">
@ -68,12 +69,18 @@ const meta = `{
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/> <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
</svg> </svg>
</button> </button>
</div>
<div class="mt-6">
<select class="translation text-sm mt-0 p-2 text-gray-400 bg-gray-700 border-1 dark:border-gray-800 rounded-sm w-full">
<option value="BSB">Berean Standard Bible (BSB)</option>
</select>
</div>
<div class="spinner"> <div class="spinner">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book-fill hidden" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book-fill hidden" viewBox="0 0 16 16">
<path d="M8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/> <path d="M8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
</svg> </svg>
</div> </div>
<article class="mt-6"> <article class="mt-2">
</article> </article>
</div> </div>
</dialog> </dialog>

View file

@ -149,14 +149,14 @@ dialog.scripture {
@apply mt-0 pl-14; @apply mt-0 pl-14;
} }
button[data-close] { button[data-close] {
@apply absolute top-0 right-0 pr-2 pb-2 pt-2 text-sm text-gray-500 cursor-pointer hover:text-red-900; @apply absolute top-0 right-0 pr-2 pb-4 pt-2 text-sm text-gray-500 cursor-pointer hover:text-red-900;
@apply dark:text-gray-400 dark:hover:text-red-500; @apply dark:text-gray-400 dark:hover:text-red-500;
span { span {
text-transform: uppercase; text-transform: uppercase;
} }
} }
h1 { h1 {
@apply font-bold mb-2 text-2xl; @apply font-bold mb-2 mt-0 text-2xl;
@apply dark:text-neutral-300; @apply dark:text-neutral-300;
} }
nav { nav {

File diff suppressed because one or more lines are too long

View file

@ -1,15 +1,10 @@
import { aliases, meta } from './meta.js'; import { aliases, defaulttx, meta, translations } from './meta.js';
import { hasLocalStorage } from './utils.js';
export const modal = (el) => { export const modal = (el) => {
}; };
const translations = {
'BSB': 'Berean Standard Bible',
'MSB': 'Majority Standard Bible',
};
function parseRef(ref) { function parseRef(ref) {
ref = ref.replace(/%3[Aa]/, ':').replace(/\+/, ' '); ref = ref.replace(/%3[Aa]/, ':').replace(/\+/, ' ');
const m = ref.match(/((\d+(\+|\s))?[a-zA-Z]+)(\+|\s)?([0-9]+)?\:?([0-9]+(-?[0-9]+)?)?/); const m = ref.match(/((\d+(\+|\s))?[a-zA-Z]+)(\+|\s)?([0-9]+)?\:?([0-9]+(-?[0-9]+)?)?/);
@ -75,125 +70,216 @@ function parseRef(ref) {
return refdata; return refdata;
} }
function render(dialog, response, refs) { class RenderScripture {
const content = response?.chapter?.content; translation = 'BSB';
let inSpan = false; dialog = null;
sel = null;
ls = false;
ref = {};
if (dialog === null || dialog === undefined) { constructor(dialog) {
return; this.dialog = dialog;
}
const section = document.createElement('section'); if (hasLocalStorage()) {
const article = dialog?.querySelector('article'); this.ls = true;
let para = document.createElement('p'); this.translation = localStorage.getItem('__translation') || 'BSB';
const heading = document.createElement('h1');
heading.insertAdjacentText('beforeend',
`${refs.fullTitle()}`);
article.insertAdjacentElement('beforeend', heading);
for (const c of content) {
if (c.type === 'heading') {
continue;
} }
let verse = document.createElement('span'); const elems = document.querySelectorAll('a[data-scripture]');
elems.forEach((e) => {
e.addEventListener('click', (evt) => {
this.anchorClick(evt)
});
});
const sel = this.dialog[0]?.querySelector('select.translation');
sel?.addEventListener('change', (evt) => {
this.txnOnChange(evt)
});
this.sel = sel;
switch (c.type) { this.dialog[0]?.addEventListener('click', (evt) => {
case 'line_break': if (evt.target === this.dialog[0]) {
if (inSpan) { this.closeDialog()
section.insertAdjacentElement('beforeend', para);
para = document.createElement('p');
} }
break; });
case 'verse': this.dialog[0]?.querySelector('button[data-close]')?.addEventListener('click', (evt) => {
if (!('number' in c)) { evt.preventDefault();
this.closeDialog();
});
}
anchorClick(evt) {
const scripture = evt.target.attributes.getNamedItem('data-scripture');
const refs = parseRef(scripture.value);
const tx = refs.meta?.tx || 'BSB';
this.ref = refs;
evt.preventDefault();
this.dialog[0]?.showModal();
this.dialog[0]?.setAttribute('data-scripture', scripture.value);
this.dialog[0]?.classList.remove("hidden");
this.dialog[0]?.querySelector('.spinner svg')
.classList.remove('hidden');
this.buildTranslationList(this.sel);
this.readScripture(refs);
}
buildTranslationList(sel) {
sel?.replaceChildren();
for (const tx in translations) {
const testament = meta[this.ref.book].ts;
if (translations[tx][2].indexOf(testament) == -1) {
continue; continue;
} }
if (!('verses' in refs) || (c.number >= refs.verses.start && c.number <= refs.verses.end)) { const opt = document.createElement('option');
inSpan = true; opt.setAttribute('value', tx);
} else { opt.insertAdjacentText('beforeend', translations[tx][0]);
inSpan = false; if (tx == this.translation) {
opt.setAttribute('selected', 'selected');
} }
if (inSpan) { sel?.insertAdjacentElement('beforeend', opt);
verse.insertAdjacentText('beforeend', c.number); }
verse.classList.add('verse'); }
para.insertAdjacentElement('beforeend', verse);
verse = document.createElement('span'); closeDialog() {
for (const v of c.content) { this.dialog[0]?.close();
if (typeof(v) === 'string') { this.dialog[0]?.classList.add('hidden');
para.insertAdjacentText('beforeend', v+' '); this.dialog[0]?.querySelector('article')?.replaceChildren();
continue }
}
if ('lineBreak' in v) { txnOnChange(evt) {
if (para.innerHTML.length != 0 || para.innerText.length != 0) { const tx = evt.target.selectedOptions[0].value;
section.insertAdjacentElement('beforeend', para); this.translation = tx;
para = document.createElement('p'); if (this.ls) {
localStorage.setItem('__translation', tx);
}
const refs = parseRef(this.dialog[0]?.getAttribute('data-scripture'));
this.dialog[0]?.querySelector('article')?.replaceChildren();
this.dialog[0]?.querySelector('.spinner svg')
.classList.remove('hidden');
this.readScripture(refs);
}
readScripture(refs) {
// Current translation.
let tx = this.translation;
// Previous translation.
const px = this.translation;
const book = refs.book;
const chapter = refs.chapter;
const testament = meta[book].ts;
// If the current translation doesn't contain the testament, switch to
// the default translation that does.
if (translations[tx][2].indexOf(testament) == -1) {
tx = defaulttx[testament];
this.translation = tx;
}
const uri = `https://bible.helloao.org/api/${tx}/${book.toUpperCase()}/${chapter}.json`;
fetch(uri)
.then((response) => {
if (!response.ok) {
console.error('query failed');
console.log(response);
return;
}
return response.json();
})
.then((response) => {
this.render(response, refs);
this.dialog[0]?.querySelector('.spinner svg')
.classList.add('hidden');
// Switch translation back if it's forced to a different
// translation from book availability.
if (this.translation != px) {
this.translation = px;
}
});
}
render(response, refs) {
const content = response?.chapter?.content;
let inSpan = false;
if (this.dialog === null || this.dialog === undefined) {
return;
}
const section = document.createElement('section');
const article = this.dialog[0]?.querySelector('article');
let para = document.createElement('p');
const heading = document.createElement('h1');
heading.insertAdjacentText('beforeend',
`${refs.fullTitle()}`);
article.insertAdjacentElement('beforeend', heading);
for (const c of content) {
if (c.type === 'heading') {
continue;
}
let verse = document.createElement('span');
switch (c.type) {
case 'line_break':
if (inSpan) {
section.insertAdjacentElement('beforeend', para);
para = document.createElement('p');
}
break;
case 'verse':
if (!('number' in c)) {
continue;
}
if (!('verses' in refs) || (c.number >= refs.verses.start && c.number <= refs.verses.end)) {
inSpan = true;
} else {
inSpan = false;
}
if (inSpan) {
verse.insertAdjacentText('beforeend', c.number);
verse.classList.add('verse');
para.insertAdjacentElement('beforeend', verse);
verse = document.createElement('span');
for (const v of c.content) {
if (typeof(v) === 'string') {
para.insertAdjacentText('beforeend', v+' ');
continue
} }
//para.insertAdjacentElement('beforeend', document.createElement('br')); if ('lineBreak' in v) {
//para = document.createElement('p');
}
if ('text' in v) {
para.insertAdjacentText('beforeend', v.text);
if ('poem' in v) {
para.classList.add('poem-'+v.poem);
if (para.innerHTML.length != 0 || para.innerText.length != 0) { if (para.innerHTML.length != 0 || para.innerText.length != 0) {
section.insertAdjacentElement('beforeend', section.insertAdjacentElement('beforeend', para);
para); para = document.createElement('p');
}
}
if ('text' in v) {
para.insertAdjacentText('beforeend', v.text);
if ('poem' in v) {
para.classList.add('poem-'+v.poem);
if (para.innerHTML.length != 0 || para.innerText.length != 0) {
section.insertAdjacentElement('beforeend',
para);
}
para = document.createElement('p');
} }
para = document.createElement('p');
} }
} }
} }
break;
default:
console.error('unhandled type:', c.type);
} }
break;
default:
console.error('unhandled type:', c.type);
} }
//console.log(c); section.insertAdjacentElement('beforeend', para);
article.insertAdjacentElement('beforeend', section);
} }
section.insertAdjacentElement('beforeend', para);
article.insertAdjacentElement('beforeend', section);
} }
export const bindModals = () => { export const bindModals = () => {
const elems = document.querySelectorAll('a[data-scripture]'); const elems = document.querySelectorAll('a[data-scripture]');
const dialog = document.querySelectorAll('dialog[data-scripture]'); const dialog = document.querySelectorAll('dialog[data-scripture]');
elems.forEach((e) => { const renderer = new RenderScripture(dialog);
e.addEventListener('click', (evt) => {
const scripture = e.attributes.getNamedItem('data-scripture');
const refs = parseRef(scripture.value);
const tx = refs.meta?.tx || 'BSB';
evt.preventDefault();
const uri = `https://bible.helloao.org/api/${tx}/${refs.book.toUpperCase()}/${refs.chapter}.json`;
dialog[0]?.showModal();
dialog[0]?.setAttribute('data-scripture', scripture);
dialog[0]?.classList.remove("hidden");
dialog[0]?.querySelector('.spinner svg')
.classList.remove('hidden');
fetch(uri)
.then((response) => {
return response.json();
})
.then((response) => {
render(dialog[0], response, refs);
dialog[0]?.querySelector('.spinner svg')
.classList.add('hidden');
});
});
});
dialog[0]?.addEventListener('click', (evt) => {
if (evt.target === dialog[0]) {
dialog[0]?.close();
dialog[0]?.classList.add('hidden');
dialog[0]?.querySelector('article')?.replaceChildren();
}
});
dialog[0]?.querySelector('button[data-close]')?.addEventListener('click', (evt) => {
evt.preventDefault();
dialog[0]?.close();
dialog[0]?.classList.add('hidden');
dialog[0]?.querySelector('article')?.replaceChildren();
});
}; };

16
src/utils/utils.js Normal file
View file

@ -0,0 +1,16 @@
export const hasLocalStorage = () => {
try {
var ls = localStorage;
var key = "__test";
ls.setItem(key, key);
ls.removeItem(key);
return true;
} catch (e) {
return (
e instanceof DOMException &&
e.name === "QuotaExceededError" &&
localStorage &&
localStorage.length !== 0
);
}
}

View file

@ -475,126 +475,139 @@ aliases = {i.lower(): k for k, v in alias_map.items() for i in v}
for k in alias_map.keys(): for k in alias_map.keys():
aliases[k] = k aliases[k] = k
use_translations = [ shorthand_defaults = {
"AAB", # Accessible Ancients Bible AAB "OT": "BSB",
"BSB", # Berean Standard Bible BSB "NT": "BSB",
"ENGWEBP", # World English Bible WEB "APO": "eng_kja",
"GHT", # Garth's Hyper-literal Translation GHT "LXX": "eng_lxx",
"eng_abt", # American Standard Version Byzantine Text ASVBT }
"eng_asv", # American Standard Version (1901) ASV
#"eng_bbe", # Bible in Basic English BBE use_translations = {
"eng_boy", # Updated Brenton English Septuagint UBES "BSB": ["Berean Standard Bible", "BSB", ["OT", "NT"]],
"eng_bre", # Brenton Septuagint Translation BST "eng_msb": ["Majority Standard Bible", "MSB", ["NT"]],
"eng_emtv", # English Majority Text Version EMTV "eng_lsv": ["Literal Standard Version", "LSV", ["OT", "NT"]],
#"eng_f35", # The New Testament with Commentary TNTC "eng_net": ["NET Bible", "NETB", ["OT", "NT"]],
"eng_fbv", # Free Bible Version FBV "eng_asv": ["American Standard Version (1901)", "ASV", ["OT", "NT"]],
"eng_glw", # God's Living Word GLW "eng_abt": ["American Standard Version Byzantine Text", "ASVBT", ["OT", "NT"]],
#"eng_gnv", # Geneva Bible 1599 GNV "eng_kjv": ["King James (Authorized) Version", "KJAV", ["OT", "NT"]],
"eng_kja", # King James Version + Apocrypha KJVA "eng_kja": ["King James Version + Apocrypha", "KJVA", ["OT", "NT", "APO"]],
"eng_kjv", # King James (Authorized) Version KJAV "eng_rv5": ["Revised Version with Apocrypha (1895)", "RVA", ["OT", "NT", "APO"]],
"eng_lsv", # Literal Standard Version LSV "eng_ylt": ["Young's Literal Translation", "YLT", ["OT", "NT"]],
"eng_lxx", # LXX2012: Septuagint in American English 2012 LXXSA "AAB": ["Accessible Ancients Bible", "AAB", ["OT", "NT"]],
"eng_msb", # Majority Standard Bible MSB "eng_fbv": ["Free Bible Version", "FBV", ["OT", "NT"]],
"eng_net", # NET Bible NETB "eng_wbs": ["Noah Webster Bible", "NWB", ["OT", "NT"]],
"eng_pev", # Plain English Version PEV "eng_ulb": ["Unlocked Literal Bible", "ULB", ["OT", "NT"]],
"eng_rv5", # Revised Version with Apocrypha (1895) RVA "ENGWEBP": ["World English Bible", "WEB", ["OT", "NT"]],
"eng_t4t", # Translation for Translators T4T "eng_web": ["World English Bible Classic", "WEBC", ["OT", "NT"]],
"eng_tce", # Text-Critical English New Testament TCENT "eng_webu": ["World English Bible Updated", "WEBU", ["OT", "NT"]],
#"eng_tnt", # Tyndale New Testament TNT "eng_lxx": ["Septuagint in American English (2012)", "LXXSA", ["OT", "APO"]],
"eng_ulb", # Unlocked Literal Bible ULB "eng_bre": ["Brenton Septuagint Translation", "BST", ["OT", "APO"]],
"eng_w88", # Wycliffe Bible W88 "eng_boy": ["Updated Brenton English Septuagint", "UBES", ["OT", "APO"]],
"eng_wbs", # Noah Webster Bible NWB # Broken: Parser?
"eng_web", # World English Bible Classic WEBC #"GHT": ["Garth's Hyper-literal Translation", "GHT"],
"eng_webu", # World English Bible Updated WEBU #"eng_bbe": ["Bible in Basic English BBE"],
"eng_wyc2017", # Wycliffe's Bible with Modern Spelling WBMS # Broken: Parser?
"eng_wyc2018", # Wycliffe's Bible with Modern Spelling (Enhanced) WBMSE #"eng_emtv": ["English Majority Text Version", "EMTV"],
"eng_ylt", # Young's Literal Translation YLT #"eng_f35": ["The New Testament with Commentary TNTC"],
] # Broken: Parser?
#"eng_glw": ["God's Living Word", "GLW"],
#"eng_gnv": ["Geneva Bible 1599 GNV"],
# Broken: Reads like heresy.
#"eng_pev": ["Plain English Version", "PEV"],
# Broken: Empty content.
#"eng_t4t": ["Translation for Translators", "T4T"],
# Broken: Parser?
#"eng_tce": ["Text-Critical English New Testament", "TCENT"],
#"eng_tnt": ["Tyndale New Testament TNT"],
#"eng_w88": ["Wycliffe Bible", "W88"],
#"eng_wyc2017": ["Wycliffe's Bible with Modern Spelling", "WBMS"],
#"eng_wyc2018": ["Wycliffe's Bible with Modern Spelling(Enhanced)", "WBMSE"],
}
bookmeta = { bookmeta = {
'gen': {'tx': 'BSB'}, 'gen': {'tx': 'BSB', 'ts': 'OT'},
'exo': {'tx': 'BSB'}, 'exo': {'tx': 'BSB', 'ts': 'OT'},
'lev': {'tx': 'BSB'}, 'lev': {'tx': 'BSB', 'ts': 'OT'},
'num': {'tx': 'BSB'}, 'num': {'tx': 'BSB', 'ts': 'OT'},
'deu': {'tx': 'BSB'}, 'deu': {'tx': 'BSB', 'ts': 'OT'},
'jos': {'tx': 'BSB'}, 'jos': {'tx': 'BSB', 'ts': 'OT'},
'jdg': {'tx': 'BSB'}, 'jdg': {'tx': 'BSB', 'ts': 'OT'},
'rut': {'tx': 'BSB'}, 'rut': {'tx': 'BSB', 'ts': 'OT'},
'1sa': {'tx': 'BSB'}, '1sa': {'tx': 'BSB', 'ts': 'OT'},
'2sa': {'tx': 'BSB'}, '2sa': {'tx': 'BSB', 'ts': 'OT'},
'1ki': {'tx': 'BSB'}, '1ki': {'tx': 'BSB', 'ts': 'OT'},
'2ki': {'tx': 'BSB'}, '2ki': {'tx': 'BSB', 'ts': 'OT'},
'1ch': {'tx': 'BSB'}, '1ch': {'tx': 'BSB', 'ts': 'OT'},
'2ch': {'tx': 'BSB'}, '2ch': {'tx': 'BSB', 'ts': 'OT'},
'ezr': {'tx': 'BSB'}, 'ezr': {'tx': 'BSB', 'ts': 'OT'},
'neh': {'tx': 'BSB'}, 'neh': {'tx': 'BSB', 'ts': 'OT'},
'est': {'tx': 'BSB'}, 'est': {'tx': 'BSB', 'ts': 'OT'},
'job': {'tx': 'BSB'}, 'job': {'tx': 'BSB', 'ts': 'OT'},
'psa': {'tx': 'BSB'}, 'psa': {'tx': 'BSB', 'ts': 'OT'},
'pro': {'tx': 'BSB'}, 'pro': {'tx': 'BSB', 'ts': 'OT'},
'ecc': {'tx': 'BSB'}, 'ecc': {'tx': 'BSB', 'ts': 'OT'},
'sng': {'tx': 'BSB'}, 'sng': {'tx': 'BSB', 'ts': 'OT'},
'isa': {'tx': 'BSB'}, 'isa': {'tx': 'BSB', 'ts': 'OT'},
'jer': {'tx': 'BSB'}, 'jer': {'tx': 'BSB', 'ts': 'OT'},
'lam': {'tx': 'BSB'}, 'lam': {'tx': 'BSB', 'ts': 'OT'},
'ezk': {'tx': 'BSB'}, 'ezk': {'tx': 'BSB', 'ts': 'OT'},
'dan': {'tx': 'BSB'}, 'dan': {'tx': 'BSB', 'ts': 'OT'},
'hos': {'tx': 'BSB'}, 'hos': {'tx': 'BSB', 'ts': 'OT'},
'jol': {'tx': 'BSB'}, 'jol': {'tx': 'BSB', 'ts': 'OT'},
'amo': {'tx': 'BSB'}, 'amo': {'tx': 'BSB', 'ts': 'OT'},
'oba': {'tx': 'BSB'}, 'oba': {'tx': 'BSB', 'ts': 'OT'},
'jon': {'tx': 'BSB'}, 'jon': {'tx': 'BSB', 'ts': 'OT'},
'mic': {'tx': 'BSB'}, 'mic': {'tx': 'BSB', 'ts': 'OT'},
'nam': {'tx': 'BSB'}, 'nam': {'tx': 'BSB', 'ts': 'OT'},
'hab': {'tx': 'BSB'}, 'hab': {'tx': 'BSB', 'ts': 'OT'},
'zep': {'tx': 'BSB'}, 'zep': {'tx': 'BSB', 'ts': 'OT'},
'hag': {'tx': 'BSB'}, 'hag': {'tx': 'BSB', 'ts': 'OT'},
'zec': {'tx': 'BSB'}, 'zec': {'tx': 'BSB', 'ts': 'OT'},
'mal': {'tx': 'BSB'}, 'mal': {'tx': 'BSB', 'ts': 'OT'},
'mat': {'tx': 'BSB'}, 'mat': {'tx': 'BSB', 'ts': 'NT'},
'mrk': {'tx': 'BSB'}, 'mrk': {'tx': 'BSB', 'ts': 'NT'},
'luk': {'tx': 'BSB'}, 'luk': {'tx': 'BSB', 'ts': 'NT'},
'jhn': {'tx': 'BSB'}, 'jhn': {'tx': 'BSB', 'ts': 'NT'},
'act': {'tx': 'BSB'}, 'act': {'tx': 'BSB', 'ts': 'NT'},
'rom': {'tx': 'BSB'}, 'rom': {'tx': 'BSB', 'ts': 'NT'},
'1co': {'tx': 'BSB'}, '1co': {'tx': 'BSB', 'ts': 'NT'},
'2co': {'tx': 'BSB'}, '2co': {'tx': 'BSB', 'ts': 'NT'},
'gal': {'tx': 'BSB'}, 'gal': {'tx': 'BSB', 'ts': 'NT'},
'eph': {'tx': 'BSB'}, 'eph': {'tx': 'BSB', 'ts': 'NT'},
'php': {'tx': 'BSB'}, 'php': {'tx': 'BSB', 'ts': 'NT'},
'col': {'tx': 'BSB'}, 'col': {'tx': 'BSB', 'ts': 'NT'},
'1th': {'tx': 'BSB'}, '1th': {'tx': 'BSB', 'ts': 'NT'},
'2th': {'tx': 'BSB'}, '2th': {'tx': 'BSB', 'ts': 'NT'},
'1ti': {'tx': 'BSB'}, '1ti': {'tx': 'BSB', 'ts': 'NT'},
'2ti': {'tx': 'BSB'}, '2ti': {'tx': 'BSB', 'ts': 'NT'},
'tit': {'tx': 'BSB'}, 'tit': {'tx': 'BSB', 'ts': 'NT'},
'phm': {'tx': 'BSB'}, 'phm': {'tx': 'BSB', 'ts': 'NT'},
'heb': {'tx': 'BSB'}, 'heb': {'tx': 'BSB', 'ts': 'NT'},
'jas': {'tx': 'BSB'}, 'jas': {'tx': 'BSB', 'ts': 'NT'},
'1pe': {'tx': 'BSB'}, '1pe': {'tx': 'BSB', 'ts': 'NT'},
'2pe': {'tx': 'BSB'}, '2pe': {'tx': 'BSB', 'ts': 'NT'},
'1jn': {'tx': 'BSB'}, '1jn': {'tx': 'BSB', 'ts': 'NT'},
'2jn': {'tx': 'BSB'}, '2jn': {'tx': 'BSB', 'ts': 'NT'},
'3jn': {'tx': 'BSB'}, '3jn': {'tx': 'BSB', 'ts': 'NT'},
'jud': {'tx': 'BSB'}, 'jud': {'tx': 'BSB', 'ts': 'NT'},
'rev': {'tx': 'BSB'}, 'rev': {'tx': 'BSB', 'ts': 'NT'},
# Apocrypha. # Apocrypha.
'tob': {'tx': 'eng_lxx'}, 'tob': {'tx': 'eng_lxx', 'ts': 'APO'},
'jdt': {'tx': 'eng_lxx'}, 'jdt': {'tx': 'eng_lxx', 'ts': 'APO'},
'wis': {'tx': 'eng_lxx'}, 'wis': {'tx': 'eng_lxx', 'ts': 'APO'},
'sir': {'tx': 'eng_lxx'}, 'sir': {'tx': 'eng_lxx', 'ts': 'APO'},
'bar': {'tx': 'eng_lxx'}, 'bar': {'tx': 'eng_lxx', 'ts': 'APO'},
'bel': {'tx': 'eng_lxx'}, 'bel': {'tx': 'eng_lxx', 'ts': 'APO'},
'sus': {'tx': 'eng_lxx'}, 'sus': {'tx': 'eng_lxx', 'ts': 'APO'},
'1ma': {'tx': 'eng_lxx'}, '1ma': {'tx': 'eng_lxx', 'ts': 'APO'},
'2ma': {'tx': 'eng_lxx'}, '2ma': {'tx': 'eng_lxx', 'ts': 'APO'},
'3ma': {'tx': 'eng_lxx'}, '3ma': {'tx': 'eng_lxx', 'ts': 'APO'},
'4ma': {'tx': 'eng_lxx'}, '4ma': {'tx': 'eng_lxx', 'ts': 'APO'},
'1es': {'tx': 'eng_lxx'}, '1es': {'tx': 'eng_lxx', 'ts': 'APO'},
# Not present in all LXX. # Not present in all LXX.
'lje': {'tx': 'eng_lxx'}, 'lje': {'tx': 'eng_lxx', 'ts': 'APO'},
's3y': {'tx': 'eng_lxx'}, 's3y': {'tx': 'eng_lxx', 'ts': 'APO'},
'man': {'tx': 'eng_lxx'}, 'man': {'tx': 'eng_lxx', 'ts': 'APO'},
} }
for k, v in bookmeta.items(): for k, v in bookmeta.items():
if k in alias_map: if k in alias_map:
@ -623,7 +636,8 @@ def write_meta(file="meta.js"):
fp.write(b"// Translation meta\n\n") fp.write(b"// Translation meta\n\n")
fp.write(f"export const aliases = {json.dumps(aliases)};\n\n".encode("utf8")) fp.write(f"export const aliases = {json.dumps(aliases)};\n\n".encode("utf8"))
fp.write(f"export const translations = {json.dumps(use_translations)};\n\n".encode("utf8")) fp.write(f"export const translations = {json.dumps(use_translations)};\n\n".encode("utf8"))
fp.write(f"export const meta = {json.dumps(bookmeta)};\n".encode("utf8")) fp.write(f"export const meta = {json.dumps(bookmeta)};\n\n".encode("utf8"))
fp.write(f"export const defaulttx = {json.dumps(shorthand_defaults)};\n\n".encode("utf8"))
if __name__ == "__main__": if __name__ == "__main__":
pass pass