Tutorial 3: Translation End-to-End
This tutorial is for users who want to download translation data and show Arabic + translated text in a reliable way.
1) What This Resource Is
Translation resources provide translated Quran text keyed by ayah, with multiple export formats.
Depending on the selected package, you may get:
- Simple translation text (
JSON/SQLite) - Footnote-tagged translation (
<sup foot_note="...">) - Inline-footnote translation (
[[...]]) - Text chunk format for structured rendering
Primary category:
2) When to Use It
Use translation data when you are building:
- Multilingual Quran readers
- Arabic + translation views for learning apps
- Search and discovery experiences in non-Arabic languages
3) How to Get Your First Example Resource
- Open https://qul.tarteel.ai/resources/translation.
- Keep the default listing order and open the first published card.
- Confirm the resource detail page includes:
-
Translation Previewtab -
Helptab
-
- Confirm available download formats shown on the page:
simple.jsonsimple.sqlite- Optional footnote/chunk variants (when provided by that translation)
This keeps onboarding concrete without hardcoding a resource ID.
4) What the Preview Shows (Website-Aligned)
On the translation detail page:
-
Translation Previewtab:-
Jump to Ayahselector - Previous/next ayah navigation
- Arabic ayah block + translated text block
-
-
Helptab:- Export format examples
- Simple structures (nested array, key-value)
- Footnote structures (tags, inline notes, text chunks)
Practical meaning:
- If you only need plain text, use a simple format.
- If you need footnotes or formatting control, use footnote-tag/chunk formats.
5) Download and Use (Step-by-Step)
- Download your selected translation package.
- Inspect what format you received:
- Plain string by ayah key
- Object with translation text + footnotes (
t,f) - Chunk array with mixed text/objects
- Normalize to one stable key format in app code (recommended:
surah:ayah). - Load Quran Script data for Arabic text.
- Join Arabic + translation rows by the same ayah key.
- Render translations by format-aware rules.
- Validate at least 5 consecutive ayahs so you catch format edge cases.
Starter integration snippet (JavaScript):
JavaScript
// Convert source rows to one stable key like "73:4".
const ayahKeyFromRow = (row) => row.ayah_key || `${row.surah}:${row.ayah}`;
// Build lookup map for fast joins with Arabic script rows.
const buildTranslationIndex = (rows) =>
rows.reduce((index, row) => {
index[ayahKeyFromRow(row)] = row.translation;
return index;
}, {});
// Normalize the different translation payload shapes into one renderable object.
const normalizeTranslationPayload = (payload) => {
// Simple plain-text translation.
if (typeof payload === "string") return { text: payload, notes: [] };
// Footnote-tag format: { t: "...<sup foot_note='x'>1</sup>...", f: { x: "note" } }
if (payload && typeof payload === "object" && payload.t) {
const noteIds = [];
const text = payload.t.replace(/<sup foot_note="([^"]+)">([^<]+)<\/sup>/g, (_, id, label) => {
noteIds.push(id);
return `[${label}]`;
});
const notes = noteIds.map((id) => ({ id, text: payload.f?.[id] || "" }));
return { text, notes };
}
// Text chunk format: ["plain", {type: "i", text: "italic"}, {type: "f", f: "12", text: "1"}]
if (Array.isArray(payload)) {
const textParts = [];
const notes = [];
payload.forEach((chunk) => {
if (typeof chunk === "string") textParts.push(chunk);
else if (chunk?.type === "i") textParts.push(chunk.text);
else if (chunk?.type === "f") {
textParts.push(`[${chunk.text}]`);
notes.push({ id: chunk.f, text: `Footnote ${chunk.f}` });
}
});
return { text: textParts.join(""), notes };
}
return { text: "", notes: [] };
};
6) Real-World Example: Arabic + Translation + Footnotes
Goal:
- User picks an ayah and sees Arabic text plus translation, with footnotes when available.
Inputs:
- Quran Script package (Arabic text)
- Translation package (simple or footnote/chunk format)
Processing:
- User selects ayah key (example:
73:4). - App loads Arabic text by ayah key.
- App loads translation payload by same ayah key.
- App normalizes payload to text + notes.
- UI renders translation and optional footnote list.
Expected output:
- Arabic and translation stay correctly paired.
- Footnotes are visible when provided.
- Format differences do not break rendering.
Interactive preview (temporary sandbox):
You can edit this code for testing. Edits are not saved and may not persist after refresh.
JavaScript Playground
Editor
Preview
7) Common Mistakes to Avoid
- Joining translation rows to Arabic by row order instead of ayah key.
- Assuming every translation package has the same structure.
- Rendering footnote-tag HTML directly without sanitization in production apps.
- Ignoring missing footnote entries or missing ayah keys.
8) When to Request Updates or Changes
Open an issue if you find:
- Broken download links or missing format files
- Translation text mapped to the wrong ayah
- Footnote IDs without matching footnote text
- Inconsistent metadata for language/source
Issue tracker: