From 0275b5a43910f216e219e9c902623a0b7a1ecfd3 Mon Sep 17 00:00:00 2001 From: Caleb Campbell Date: Fri, 26 Dec 2025 09:12:04 +1100 Subject: [PATCH 1/6] 3 - Began the work of internationalization. --- src/books/books.de.ts | 70 +++++++++++++++++++++++++++++ src/{books.ts => books/books.en.ts} | 2 +- src/i18n/de/books.ts | 70 +++++++++++++++++++++++++++++ src/i18n/de/settings.ts | 65 +++++++++++++++++++++++++++ src/i18n/en/books.ts | 70 +++++++++++++++++++++++++++++ src/i18n/en/index.ts | 7 +++ src/i18n/en/settings.ts | 67 +++++++++++++++++++++++++++ src/i18n/index.ts | 5 +++ src/i18n/models.ts | 21 +++++++++ src/passage-reference.ts | 6 +-- 10 files changed, 379 insertions(+), 4 deletions(-) create mode 100644 src/books/books.de.ts rename src/{books.ts => books/books.en.ts} (99%) create mode 100644 src/i18n/de/books.ts create mode 100644 src/i18n/de/settings.ts create mode 100644 src/i18n/en/books.ts create mode 100644 src/i18n/en/index.ts create mode 100644 src/i18n/en/settings.ts create mode 100644 src/i18n/index.ts create mode 100644 src/i18n/models.ts diff --git a/src/books/books.de.ts b/src/books/books.de.ts new file mode 100644 index 0000000..7b7a30b --- /dev/null +++ b/src/books/books.de.ts @@ -0,0 +1,70 @@ +import { Book } from "./books.en"; + +export const BOOKS_DE: Book[] = [ + { name: "1. Mose", aliases: ["Genesis", "Gen", "1Mo"] }, + { name: "2. Mose", aliases: ["Exodus", "Ex", "2Mo"] }, + { name: "3. Mose", aliases: ["Levitikus", "Lev", "3Mo"] }, + { name: "4. Mose", aliases: ["Numeri", "Num", "4Mo"] }, + { name: "5. Mose", aliases: ["Deuteronomium", "Dtn", "5Mo"] }, + { name: "Josua", aliases: ["Jos", "Jos"] }, + { name: "Richter", aliases: ["Ri", "Richt"] }, + { name: "Rut", aliases: ["Rut", "Ru"] }, + { name: "1. Samuel", aliases: ["1Sam", "1Sa"] }, + { name: "2. Samuel", aliases: ["2Sam", "2Sa"] }, + { name: "1. Könige", aliases: ["1Kön", "1Kö"] }, + { name: "2. Könige", aliases: ["2Kön", "2Kö"] }, + { name: "1. Chronik", aliases: ["1Chr", "1Ch"] }, + { name: "2. Chronik", aliases: ["2Chr", "2Ch"] }, + { name: "Esra", aliases: ["Esr", "Esr"] }, + { name: "Nehemia", aliases: ["Neh", "Neh"] }, + { name: "Ester", aliases: ["Esther", "Est", "Est"] }, + { name: "Ijob", aliases: ["Hiob", "Ijob", "Hi"] }, + { name: "Psalmen", aliases: ["Psalter", "Ps"] }, + { name: "Sprüche", aliases: ["Sprüche Salomos", "Spr"] }, + { name: "Kohelet", aliases: ["Prediger", "Koh", "Pred"] }, + { name: "Hoheslied", aliases: ["Lied der Lieder", "Hld", "Hl"] }, + { name: "Jesaja", aliases: ["Jes"] }, + { name: "Jeremia", aliases: ["Jer"] }, + { name: "Klagelieder", aliases: ["Threni", "Klgl", "Kla"] }, + { name: "Ezechiel", aliases: ["Hesekiel", "Ez", "Hes"] }, + { name: "Daniel", aliases: ["Dan"] }, + { name: "Hosea", aliases: ["Hos", "Hos"] }, + { name: "Joel", aliases: ["Joe"] }, + { name: "Amos", aliases: ["Am", "Amos"] }, + { name: "Obadja", aliases: ["Ob", "Oba"] }, + { name: "Jona", aliases: ["Jon"] }, + { name: "Micha", aliases: ["Mi", "Mic"] }, + { name: "Nahum", aliases: ["Nah"] }, + { name: "Habakuk", aliases: ["Hab", "Hab"] }, + { name: "Zefanja", aliases: ["Zephanja", "Zef", "Zeph"] }, + { name: "Haggai", aliases: ["Hag"] }, + { name: "Sacharja", aliases: ["Sach"] }, + { name: "Maleachi", aliases: ["Mal"] }, + { name: "Matthäus", aliases: ["Mt"] }, + { name: "Markus", aliases: ["Mk"] }, + { name: "Lukas", aliases: ["Lk"] }, + { name: "Johannes", aliases: ["Joh"] }, + { name: "Apostelgeschichte", aliases: ["Taten der Apostel", "Apg"] }, + { name: "Römer", aliases: ["Röm", "Rö"] }, + { name: "1. Korinther", aliases: ["1Kor", "1Ko"] }, + { name: "2. Korinther", aliases: ["2Kor", "2Ko"] }, + { name: "Galater", aliases: ["Gal", "Gal"] }, + { name: "Epheser", aliases: ["Eph", "Eph"] }, + { name: "Philipper", aliases: ["Phil"] }, + { name: "Kolosser", aliases: ["Kol"] }, + { name: "1. Thessalonicher", aliases: ["1Thes", "1Th"] }, + { name: "2. Thessalonicher", aliases: ["2Thes", "2Th"] }, + { name: "1. Timotheus", aliases: ["1Tim", "1Ti"] }, + { name: "2. Timotheus", aliases: ["2Tim", "2Ti"] }, + { name: "Titus", aliases: ["Tit"] }, + { name: "Philemon", aliases: ["Phlm", "Phm"] }, + { name: "Hebräer", aliases: ["Hebr", "Heb"] }, + { name: "Jakobus", aliases: ["Jak", "Jak"] }, + { name: "1. Petrus", aliases: ["1Pet", "1Pe"] }, + { name: "2. Petrus", aliases: ["2Pet", "2Pe"] }, + { name: "1. Johannes", aliases: ["1Joh", "1Jo"] }, + { name: "2. Johannes", aliases: ["2Joh", "2Jo"] }, + { name: "3. Johannes", aliases: ["3Joh", "3Jo"] }, + { name: "Judas", aliases: ["Jud"] }, + { name: "Offenbarung", aliases: ["Apokalypse", "Off", "Apk"] }, +]; \ No newline at end of file diff --git a/src/books.ts b/src/books/books.en.ts similarity index 99% rename from src/books.ts rename to src/books/books.en.ts index cc6c701..ff1e179 100644 --- a/src/books.ts +++ b/src/books/books.en.ts @@ -3,7 +3,7 @@ export interface Book { aliases: string[]; } -export const BOOKS: Book[] = [ +export const BOOKS_EN: Book[] = [ { name: "Genesis", aliases: ["gen"] }, { name: "Exodus", aliases: ["exo", "ex", "exod"] }, { name: "Leviticus", aliases: ["lev"] }, diff --git a/src/i18n/de/books.ts b/src/i18n/de/books.ts new file mode 100644 index 0000000..7ce9750 --- /dev/null +++ b/src/i18n/de/books.ts @@ -0,0 +1,70 @@ +import { Book } from "../models"; + +export const BOOKS_DE: Book[] = [ + { id: "gen", name: "1. Mose", aliases: ["Genesis", "Gen", "1Mo"] }, + { id: "exo", name: "2. Mose", aliases: ["Exodus", "Ex", "2Mo"] }, + { id: "lev", name: "3. Mose", aliases: ["Levitikus", "Lev", "3Mo"] }, + { id: "num", name: "4. Mose", aliases: ["Numeri", "Num", "4Mo"] }, + { id: "deu", name: "5. Mose", aliases: ["Deuteronomium", "Dtn", "5Mo"] }, + { id: "jos", name: "Josua", aliases: ["Jos", "Jos"] }, + { id: "jdg", name: "Richter", aliases: ["Ri", "Richt"] }, + { id: "rut", name: "Rut", aliases: ["Rut", "Ru"] }, + { id: "1sa", name: "1. Samuel", aliases: ["1Sam", "1Sa"] }, + { id: "2sa", name: "2. Samuel", aliases: ["2Sam", "2Sa"] }, + { id: "1ki", name: "1. Könige", aliases: ["1Kön", "1Kö"] }, + { id: "2ki", name: "2. Könige", aliases: ["2Kön", "2Kö"] }, + { id: "1ch", name: "1. Chronik", aliases: ["1Chr", "1Ch"] }, + { id: "2ch", name: "2. Chronik", aliases: ["2Chr", "2Ch"] }, + { id: "ezr", name: "Esra", aliases: ["Esr", "Esr"] }, + { id: "neh", name: "Nehemia", aliases: ["Neh", "Neh"] }, + { id: "est", name: "Ester", aliases: ["Esther", "Est", "Est"] }, + { id: "job", name: "Ijob", aliases: ["Hiob", "Ijob", "Hi"] }, + { id: "psa", name: "Psalmen", aliases: ["Psalter", "Ps"] }, + { id: "pro", name: "Sprüche", aliases: ["Sprüche Salomos", "Spr"] }, + { id: "ecc", name: "Kohelet", aliases: ["Prediger", "Koh", "Pred"] }, + { id: "sng", name: "Hoheslied", aliases: ["Lied der Lieder", "Hld", "Hl"] }, + { id: "isa", name: "Jesaja", aliases: ["Jes"] }, + { id: "jer", name: "Jeremia", aliases: ["Jer"] }, + { id: "lam", name: "Klagelieder", aliases: ["Threni", "Klgl", "Kla"] }, + { id: "ezk", name: "Ezechiel", aliases: ["Hesekiel", "Ez", "Hes"] }, + { id: "dan", name: "Daniel", aliases: ["Dan"] }, + { id: "hos", name: "Hosea", aliases: ["Hos", "Hos"] }, + { id: "jol", name: "Joel", aliases: ["Joe"] }, + { id: "amo", name: "Amos", aliases: ["Am", "Amos"] }, + { id: "oba", name: "Obadja", aliases: ["Ob", "Oba"] }, + { id: "jon", name: "Jona", aliases: ["Jon"] }, + { id: "mic", name: "Micha", aliases: ["Mi", "Mic"] }, + { id: "nam", name: "Nahum", aliases: ["Nah"] }, + { id: "hab", name: "Habakuk", aliases: ["Hab", "Hab"] }, + { id: "zep", name: "Zefanja", aliases: ["Zephanja", "Zef", "Zeph"] }, + { id: "hag", name: "Haggai", aliases: ["Hag"] }, + { id: "zec", name: "Sacharja", aliases: ["Sach"] }, + { id: "mal", name: "Maleachi", aliases: ["Mal"] }, + { id: "mat", name: "Matthäus", aliases: ["Mt"] }, + { id: "mrk", name: "Markus", aliases: ["Mk"] }, + { id: "luk", name: "Lukas", aliases: ["Lk"] }, + { id: "jhn", name: "Johannes", aliases: ["Joh"] }, + { id: "act", name: "Apostelgeschichte", aliases: ["Taten der Apostel", "Apg"] }, + { id: "rom", name: "Römer", aliases: ["Röm", "Rö"] }, + { id: "1co", name: "1. Korinther", aliases: ["1Kor", "1Ko"] }, + { id: "2co", name: "2. Korinther", aliases: ["2Kor", "2Ko"] }, + { id: "gal", name: "Galater", aliases: ["Gal", "Gal"] }, + { id: "eph", name: "Epheser", aliases: ["Eph", "Eph"] }, + { id: "php", name: "Philipper", aliases: ["Phil"] }, + { id: "col", name: "Kolosser", aliases: ["Kol"] }, + { id: "1th", name: "1. Thessalonicher", aliases: ["1Thes", "1Th"] }, + { id: "2th", name: "2. Thessalonicher", aliases: ["2Thes", "2Th"] }, + { id: "1ti", name: "1. Timotheus", aliases: ["1Tim", "1Ti"] }, + { id: "2ti", name: "2. Timotheus", aliases: ["2Tim", "2Ti"] }, + { id: "tit", name: "Titus", aliases: ["Tit"] }, + { id: "phm", name: "Philemon", aliases: ["Phlm", "Phm"] }, + { id: "heb", name: "Hebräer", aliases: ["Hebr", "Heb"] }, + { id: "jas", name: "Jakobus", aliases: ["Jak", "Jak"] }, + { id: "1pe", name: "1. Petrus", aliases: ["1Pet", "1Pe"] }, + { id: "2pe", name: "2. Petrus", aliases: ["2Pet", "2Pe"] }, + { id: "1jn", name: "1. Johannes", aliases: ["1Joh", "1Jo"] }, + { id: "2jn", name: "2. Johannes", aliases: ["2Joh", "2Jo"] }, + { id: "3jn", name: "3. Johannes", aliases: ["3Joh", "3Jo"] }, + { id: "jud", name: "Judas", aliases: ["Jud"] }, + { id: "rev", name: "Offenbarung", aliases: ["Apokalypse", "Off", "Apk"] }, +]; \ No newline at end of file diff --git a/src/i18n/de/settings.ts b/src/i18n/de/settings.ts new file mode 100644 index 0000000..e488975 --- /dev/null +++ b/src/i18n/de/settings.ts @@ -0,0 +1,65 @@ +import { Settings } from "../models"; + +export const SETTINGS: Settings = { + required: { + name: 'Required Settings', + controls: { + biblesPath: { + name: 'Bibles path', + description: 'The path to the folder containing your bibles.' + }, + } + }, + + optional: { + name: 'Optional Settings', + controls: { + defaultVersion: { + name: 'Default version', + description: 'The version to use by default - shorthand. This should correspond to a folder in the bibles folder selected above.' + }, + defaultPassageFormat: { + name: 'Default passage format', + description: 'The markdown format to use for passages by default.' + }, + bibleFormat: { + name: 'Bible format', + description: 'The formatting style you use for your vault bibles. Local Bible Ref relies on this to parse passages correctly.' + } + } + }, + + quoteFormat: { + name: 'Quote Format Settings', + description: 'Settings for the quote passage format.', + controls: { + includeReference: { + name: 'Include reference', + description: 'Whether to include a reference to the passage.' + }, + referencePosition: { + name: 'Reference position', + description: 'The position of the reference in relation to the quoted text.' + }, + linkToPassage: { + name: 'Link to passage', + description: 'Whether to link the reference to the passage in your vault Bible.' + } + } + }, + + calloutFormat: { + name: 'Callout Format Settings', + description: 'Settings for the callout passage format.', + controls: { + calloutType: { + name: 'Callout type', + description: 'The type of callout to use for the passage.' + }, + linkToPassage: { + name: 'Link to passage', + description: 'Whether to link the reference to the passage in your vault Bible.' + } + } + } +} \ No newline at end of file diff --git a/src/i18n/en/books.ts b/src/i18n/en/books.ts new file mode 100644 index 0000000..d364ac1 --- /dev/null +++ b/src/i18n/en/books.ts @@ -0,0 +1,70 @@ +import { Book } from "../models"; + +export const BOOKS: Book[] = [ + { id: "gen", name: "Genesis", aliases: ["gen"] }, + { id: "exo", name: "Exodus", aliases: ["exo", "ex", "exod"] }, + { id: "lev", name: "Leviticus", aliases: ["lev"] }, + { id: "num", name: "Numbers", aliases: ["num"] }, + { id: "deu", name: "Deuteronomy", aliases: ["deu", "deut"] }, + { id: "jos", name: "Joshua", aliases: ["jos", "josh"] }, + { id: "jdg", name: "Judges", aliases: ["jdg", "judg"] }, + { id: "rut", name: "Ruth", aliases: ["rut"] }, + { id: "1sa", name: "1 Samuel", aliases: ["1sa", "1samuel", "1 sam", "1st sam", "1st samuel", "first samuel"] }, + { id: "2sa", name: "2 Samuel", aliases: ["2sa", "2samuel", "2 sam", "2nd sam", "2nd samuel", "second samuel"] }, + { id: "1ki", name: "1 Kings", aliases: ["1ki", "1kings", "1 kgs", "1st kgs", "1st kings", "first kings"] }, + { id: "2ki", name: "2 Kings", aliases: ["2ki", "2kings", "2 kgs", "2nd kgs", "2nd kings", "second kings"] }, + { id: "1ch", name: "1 Chronicles", aliases: ["1ch", "1chronicles", "1 chr", "1st chr", "1st chronicles", "first chronicles"] }, + { id: "2ch", name: "2 Chronicles", aliases: ["2ch", "2chronicles", "2 chr", "2nd chr", "2nd chronicles", "second chronicles"] }, + { id: "ezr", name: "Ezra", aliases: ["ezr"] }, + { id: "neh", name: "Nehemiah", aliases: ["neh"] }, + { id: "est", name: "Esther", aliases: ["est", "esth"] }, + { id: "job", name: "Job", aliases: ["job"] }, + { id: "psa", name: "Psalms", aliases: ["psa", "ps", "psalm"] }, + { id: "pro", name: "Proverbs", aliases: ["pro", "prov"] }, + { id: "ecc", name: "Ecclesiastes", aliases: ["ecc", "eccl"] }, + { id: "sng", name: "Song of Songs", aliases: ["sng", "Song of Solomon", "song"] }, + { id: "isa", name: "Isaiah", aliases: ["isa"] }, + { id: "jer", name: "Jeremiah", aliases: ["jer"] }, + { id: "lam", name: "Lamentations", aliases: ["lam"] }, + { id: "ezk", name: "Ezekiel", aliases: ["ezk", "ezek"] }, + { id: "dan", name: "Daniel", aliases: ["dan"] }, + { id: "hos", name: "Hosea", aliases: ["hos"] }, + { id: "jol", name: "Joel", aliases: ["jol"] }, + { id: "amo", name: "Amos", aliases: ["amo"] }, + { id: "oba", name: "Obadiah", aliases: ["oba", "obad"] }, + { id: "jon", name: "Jonah", aliases: ["jon"] }, + { id: "mic", name: "Micah", aliases: ["mic"] }, + { id: "nam", name: "Nahum", aliases: ["nam"] }, + { id: "hab", name: "Habakkuk", aliases: ["hab"] }, + { id: "zep", name: "Zephaniah", aliases: ["zep", "zeph"] }, + { id: "hag", name: "Haggai", aliases: ["hag"] }, + { id: "zec", name: "Zechariah", aliases: ["zec", "zech"] }, + { id: "mal", name: "Malachi", aliases: ["mal"] }, + { id: "mat", name: "Matthew", aliases: ["mat", "matt"] }, + { id: "mrk", name: "Mark", aliases: ["mrk"] }, + { id: "luk", name: "Luke", aliases: ["luk"] }, + { id: "jhn", name: "John", aliases: ["jhn"] }, + { id: "act", name: "Acts", aliases: ["act"] }, + { id: "rom", name: "Romans", aliases: ["rom"] }, + { id: "1co", name: "1 Corinthians", aliases: ["1co", "1corinthians", "1 cor", "1st cor", "1st corinthians", "first corinthians"] }, + { id: "2co", name: "2 Corinthians", aliases: ["2co", "2corinthians", "2 cor", "2nd cor", "2nd corinthians", "second corinthians"] }, + { id: "gal", name: "Galatians", aliases: ["gal"] }, + { id: "eph", name: "Ephesians", aliases: ["eph"] }, + { id: "php", name: "Philippians", aliases: ["php", "phil"] }, + { id: "col", name: "Colossians", aliases: ["col"] }, + { id: "1th", name: "1 Thessalonians", aliases: ["1th", "1thessalonians", "1 thess", "1st thess", "1st thessalonians", "first thessalonians"] }, + { id: "2th", name: "2 Thessalonians", aliases: ["2th", "2thessalonians", "2 thess", "2nd thess", "2nd thessalonians", "second thessalonians"] }, + { id: "1ti", name: "1 Timothy", aliases: ["1ti", "1timothy", "1 tim", "1st tim", "1st timothy", "first timothy"] }, + { id: "2ti", name: "2 Timothy", aliases: ["2ti", "2timothy", "2 tim", "2nd tim", "2nd timothy", "second timothy"] }, + { id: "tit", name: "Titus", aliases: ["tit"] }, + { id: "phm", name: "Philemon", aliases: ["phm", "phlm"] }, + { id: "heb", name: "Hebrews", aliases: ["heb"] }, + { id: "jas", name: "James", aliases: ["jas"] }, + { id: "1pe", name: "1 Peter", aliases: ["1pe", "1peter", "1 pet", "1st pet", "1st peter", "first peter"] }, + { id: "2pe", name: "2 Peter", aliases: ["2pe", "2peter", "2 pet", "2nd pet", "2nd peter", "second peter"] }, + { id: "1jn", name: "1 John", aliases: ["1jn", "1john", "1st john", "first john"] }, + { id: "2jn", name: "2 John", aliases: ["2jn", "2john", "2nd john", "second john"] }, + { id: "3jn", name: "3 John", aliases: ["3jn", "3john", "3rd john", "third john"] }, + { id: "jud", name: "Jude", aliases: ["jud"] }, + { id: "rev", name: "Revelation", aliases: ["rev"] }, +]; diff --git a/src/i18n/en/index.ts b/src/i18n/en/index.ts new file mode 100644 index 0000000..c4db40b --- /dev/null +++ b/src/i18n/en/index.ts @@ -0,0 +1,7 @@ +import { BOOKS } from "./books"; +import { SETTINGS } from "./settings"; + +export const EN = { + BOOKS, + SETTINGS, +} \ No newline at end of file diff --git a/src/i18n/en/settings.ts b/src/i18n/en/settings.ts new file mode 100644 index 0000000..316ae06 --- /dev/null +++ b/src/i18n/en/settings.ts @@ -0,0 +1,67 @@ +import { Settings } from "../models"; + +export const SETTINGS: Settings = { + required: { + name: 'Required Settings', + controls: { + biblesPath: { + name: 'Bibles path', + description: 'The path to the folder containing your bibles.', + placeholder: 'e.g. Data/Bibles' + }, + } + }, + + optional: { + name: 'Optional Settings', + controls: { + defaultVersion: { + name: 'Default version', + description: 'The version to use by default - shorthand. This should correspond to a folder in the bibles folder selected above.', + placeholder: 'e.g. NIV' + }, + defaultPassageFormat: { + name: 'Default passage format', + description: 'The markdown format to use for passages by default.' + }, + bibleFormat: { + name: 'Bible format', + description: 'The formatting style you use for your vault bibles. Local Bible Ref relies on this to parse passages correctly.' + } + } + }, + + quoteFormat: { + name: 'Quote Format Settings', + description: 'Settings for the quote passage format.', + controls: { + includeReference: { + name: 'Include reference', + description: 'Whether to include a reference to the passage.' + }, + referencePosition: { + name: 'Reference position', + description: 'The position of the reference in relation to the quoted text.' + }, + linkToPassage: { + name: 'Link to passage', + description: 'Whether to link the reference to the passage in your vault Bible.' + } + } + }, + + calloutFormat: { + name: 'Callout Format Settings', + description: 'Settings for the callout passage format.', + controls: { + calloutType: { + name: 'Callout type', + description: 'The type of callout to use for the passage.' + }, + linkToPassage: { + name: 'Link to passage', + description: 'Whether to link the reference to the passage in your vault Bible.' + } + } + } +} \ No newline at end of file diff --git a/src/i18n/index.ts b/src/i18n/index.ts new file mode 100644 index 0000000..792a17e --- /dev/null +++ b/src/i18n/index.ts @@ -0,0 +1,5 @@ +import { EN } from "./en"; + +export const I18N = { + EN, +} \ No newline at end of file diff --git a/src/i18n/models.ts b/src/i18n/models.ts new file mode 100644 index 0000000..3436f09 --- /dev/null +++ b/src/i18n/models.ts @@ -0,0 +1,21 @@ +export interface Book { + id: string; + name: string; + aliases: string[]; +} + +export interface Settings { + [key: string]: SettingsGroup +} + +interface SettingsGroup { + name: string; + description?: string; + controls: { [key: string]: Control }; +} + +interface Control { + name: string; + description?: string; + placeholder?: string; +} \ No newline at end of file diff --git a/src/passage-reference.ts b/src/passage-reference.ts index 95be902..f934037 100644 --- a/src/passage-reference.ts +++ b/src/passage-reference.ts @@ -1,4 +1,4 @@ -import { Book, BOOKS } from "./books"; +import { Book, BOOKS_EN } from "./books/books.en"; export default class PassageReference implements ChapterReference, PassageOptions { startChapter: number; @@ -52,7 +52,7 @@ export default class PassageReference implements ChapterReference, PassageOption /** Builds the passage matching regular expression. */ static get regExp(): RegExp { let regExpString = "^\\-\\- ?("; - regExpString += BOOKS.map( + regExpString += BOOKS_EN.map( (b) => `${b.name}|${b.aliases.join("|")}` ).join("|"); regExpString += ") ?(\\d{1,3}(?::\\d{1,3})?" + @@ -149,7 +149,7 @@ export default class PassageReference implements ChapterReference, PassageOption /** Retrieves a book based on its alias. */ private static getBook(alias: string): Book | undefined { alias = alias.toLowerCase(); - return BOOKS.find((book) => { + return BOOKS_EN.find((book) => { const aliases = book.aliases.map((a) => a.toLowerCase()); if (book.name.toLowerCase() === alias) return book; if (aliases.includes(alias)) return book; From 054744e35b002e05425d9f4873795350fef748b5 Mon Sep 17 00:00:00 2001 From: Caleb Campbell Date: Fri, 26 Dec 2025 09:43:29 +1100 Subject: [PATCH 2/6] 3 - Added Prettier for formatting and formatted. --- .github/workflows/release.yml | 6 +- .prettierrc.yml | 4 + README.md | 18 +- esbuild.config.mjs | 54 ++-- main.ts | 11 +- package-lock.json | 161 ++++-------- package.json | 4 +- src/books/books.de.ts | 70 ------ src/books/books.en.ts | 244 ------------------ src/i18n/de/books.ts | 142 ++++++----- src/i18n/de/index.ts | 7 + src/i18n/de/settings.ts | 127 +++++----- src/i18n/en/books.ts | 276 +++++++++++++++----- src/i18n/en/index.ts | 10 +- src/i18n/en/settings.ts | 129 +++++----- src/i18n/index.ts | 8 +- src/i18n/models.ts | 18 +- src/local-bible-ref-setting-tab.ts | 392 ++++++++++++++++------------- src/passage-reference.ts | 57 +++-- src/passage-suggest.ts | 131 +++++----- src/path-suggest.ts | 44 ++-- src/settings.ts | 62 ++--- src/version-suggest.ts | 52 ++-- styles.css | 4 +- tsconfig.json | 37 ++- version-bump.mjs | 10 +- 26 files changed, 955 insertions(+), 1123 deletions(-) create mode 100644 .prettierrc.yml delete mode 100644 src/books/books.de.ts delete mode 100644 src/books/books.en.ts create mode 100644 src/i18n/de/index.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 350e329..c945a00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release Obsidian plugin on: push: tags: - - "*" + - '*' jobs: build: @@ -16,7 +16,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "18.x" + node-version: '18.x' - name: Build plugin run: | @@ -32,4 +32,4 @@ jobs: gh release create "$tag" \ --title="$tag" \ --draft \ - main.js manifest.json styles.css \ No newline at end of file + main.js manifest.json styles.css diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000..b53f47a --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,4 @@ +singleQuote: true +tabWidth: 2 +trailingComma: 'es5' +useTabs: true diff --git a/README.md b/README.md index a4e3939..56d0ad3 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,21 @@ Quickly and easily reference Bible passages stored locally in your vault. ### Inspiration -This plugin takes heavy inspiration from the [Bible Reference](https://github.com/tim-hub/obsidian-bible-reference) and [Bible Linker](https://github.com/kuchejak/obsidian-bible-linker-plugin) plugins - please check them out! I've been using the *Bible Reference* plugin for a while (which has been great) and I love the simplicity of referencing passages using the `--` prefix. I also loved the idea of storing a Bible locally because then I can reference Bible passages even when I'm offline, as well as use my vault Bible for reading. Unfortunately, the markdown format of the *Bible Linker* local Bible is not great for reading, and I prefer the simplicity of using the `--` prefix to fetch Bible passages. There's also some referencing limitations in the *Bible Reference* plugin and occasionally some odd additions to passages returned from the [Boll's Life](https://bolls.life/) API. So, this is an amalgamation of those two plugins. +This plugin takes heavy inspiration from the [Bible Reference](https://github.com/tim-hub/obsidian-bible-reference) and [Bible Linker](https://github.com/kuchejak/obsidian-bible-linker-plugin) plugins - please check them out! I've been using the _Bible Reference_ plugin for a while (which has been great) and I love the simplicity of referencing passages using the `--` prefix. I also loved the idea of storing a Bible locally because then I can reference Bible passages even when I'm offline, as well as use my vault Bible for reading. Unfortunately, the markdown format of the _Bible Linker_ local Bible is not great for reading, and I prefer the simplicity of using the `--` prefix to fetch Bible passages. There's also some referencing limitations in the _Bible Reference_ plugin and occasionally some odd additions to passages returned from the [Boll's Life](https://bolls.life/) API. So, this is an amalgamation of those two plugins. ### Getting Started To start with, you will need to format a Bible for your own vault. -If you would like to use your vault Bible for reading, I would encourage you to format it in the original *Local Bible Ref* format. Some instructions on this can be found [below](#bible-markdown-format). I've also already formatted the Public Domain World English Bible so you can [download](https://github.com/camelChief/markdown-webp) that and just get started. If you don't want to go to all that hassle, you can use your existing *Bible Linker* Bible with this plugin! In order to do that, simply select "Bible Linker" as your Bible format in the *Local Bible Ref* settings. +If you would like to use your vault Bible for reading, I would encourage you to format it in the original _Local Bible Ref_ format. Some instructions on this can be found [below](#bible-markdown-format). I've also already formatted the Public Domain World English Bible so you can [download](https://github.com/camelChief/markdown-webp) that and just get started. If you don't want to go to all that hassle, you can use your existing _Bible Linker_ Bible with this plugin! In order to do that, simply select "Bible Linker" as your Bible format in the _Local Bible Ref_ settings. -Once you've done that, open up the *Local Bible Ref* settings and fill in at least the *Bibles path* field. Then, to use the plugin, simply open a new note and use the `--` reference prefix to grab a passage of scripture. There are also additional options (similar to terminal command options) you can provide to the reference to indicate which version to use and what markdown format to display the passage in. More information can be found [below](#usage). +Once you've done that, open up the _Local Bible Ref_ settings and fill in at least the _Bibles path_ field. Then, to use the plugin, simply open a new note and use the `--` reference prefix to grab a passage of scripture. There are also additional options (similar to terminal command options) you can provide to the reference to indicate which version to use and what markdown format to display the passage in. More information can be found [below](#usage). ## Usage ### References -In order to fetch a Bible passage, simply type in a Bible reference prefixed with `--`: `--John 1:1`. *Local Bible Ref* currently supports Bible references in the form: +In order to fetch a Bible passage, simply type in a Bible reference prefixed with `--`: `--John 1:1`. _Local Bible Ref_ currently supports Bible references in the form: - Single verse: `--gen1:1` - Multi verse: `--gen1:1-3` @@ -33,19 +33,19 @@ In order to fetch a Bible passage, simply type in a Bible reference prefixed wit The referencing syntax also allows for a lot of flexibility: - Short and full name references: `--gen1` + `--genesis1` -- Lowercase, uppercase and mixed-case references: ``--gEnEsis1`` +- Lowercase, uppercase and mixed-case references: `--gEnEsis1` - Spacing (not more than a single space): `-- Genesis 1:1 - 2:2` ### Options -*Local Bible Ref* also allows you to provide a few options to a reference to specify which version you would like to use as well as what markdown format to use. Add an option to a reference by adding a `+` followed by the option (in any order): `--gen1:1-5+esv` +_Local Bible Ref_ also allows you to provide a few options to a reference to specify which version you would like to use as well as what markdown format to use. Add an option to a reference by adding a `+` followed by the option (in any order): `--gen1:1-5+esv` You can also pass multiple options by simply chaining them: `-- John 1:1 +quote +esv` Syntax: `--[+