Add translatedBy to surahs.json

This commit is contained in:
0x1eef 2024-05-19 20:22:14 -03:00
parent 4d5ddcbfe0
commit 9627c60021
353 changed files with 1410 additions and 693 deletions

View file

@ -2,9 +2,11 @@
# Defaults
AllCops:
TargetRubyVersion: 3.2
Exclude:
- submodules/**/*
Include:
- Rakefile.rb
- tasks/*.rake
- rake/tasks/*.rake
- nanoc/rules/*.rules
- nanoc/rules/**/**/*.rules
- nanoc/lib/*.rb

View file

@ -34,13 +34,14 @@ the website from source:
Alhamdulillah.
* Thanks to the following graphic artists:
* Thanks to the graphic artists:
- [RefreshIcon](/src/js/components/Icon.tsx)
by
[Muhammad Haq](https://freeicons.io/profile/823)
* Thanks to the following translators:
* Thanks to the translators:
- English (The Clear Quran) by Dr. Mustafa Khattab
- Farsi by Hussein Taji Kal Dari
## License

View file

@ -13,6 +13,7 @@ rescue LoadError
end
load "rake/tasks/format.rake"
load "rake/tasks/nanoc.rake"
load "rake/tasks/t.rake"
desc "Serve the website on localhost"
task :server, [:protocol] do |_t, args|

View file

@ -19,3 +19,9 @@ The process:
(/src/json/t.json)
(/src/json/surahs.json)
(/src/json/<locale>/<surahId>/{info,surah}.json)
Tip:
'/src/json/<locale>/<surahId>/info.json' can be generated
automatically from the contents of '/src/json/surahs.json'
via: rake t:surahs.json.

View file

@ -19,6 +19,7 @@ type TSurah = {
readonly name: string;
readonly numberOfAyah: number;
readonly roman: { name: string; slug: string };
readonly translatedBy: string | null;
};
type TAyah = {
@ -55,7 +56,8 @@ class Surah {
readonly name: string;
readonly numberOfAyah: number;
readonly roman: {name: string, slug: string};
readonly ayat: TAyat
readonly ayat: TAyat;
readonly translatedBy: string | null;
constructor(self: TSurah) {
this.id = self.id;
@ -63,6 +65,7 @@ class Surah {
this.numberOfAyah = self.numberOfAyah;
this.roman = self.roman;
this.ayat = [];
this.translatedBy = self.translatedBy;
return this;
}
}

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
namespace :nanoc do
require "bundler/setup"
root = File.realpath File.join(__dir__, "..", "..")
@ -24,7 +26,7 @@ namespace :nanoc do
end
desc "Produce the build/ directory on-demand"
task watch: ['nanoc:build'] do
task watch: ["nanoc:build"] do
Dir.chdir(root) do
require "listen"
srcdir = File.join(root, "src")

16
rake/tasks/t.rake Normal file
View file

@ -0,0 +1,16 @@
# frozen_string_literal: true
namespace :t do
desc "Generate /json/<locale>/<surahid>/info.json from surahs.json"
task :"surahs.json" do
require "json"
path = File.join(Dir.getwd, "src", "json", "surahs.json")
surahs = JSON.parse(File.read(path))
surahs.keys.each do |locale|
surahs[locale].each.with_index(1) do |surah, index|
target = File.join(Dir.getwd, "src", "json", locale, index.to_s, "info.json")
File.write(target, JSON.pretty_generate(surah))
end
end
end
end

View file

@ -16,7 +16,10 @@ export function LanguageSelect({ locale }: Props) {
return (
<Select.Option
key={i}
className={classNames("flex h-6 w-20 justify-center no-underline mb-1 rounded", l.direction)}
className={classNames(
"flex h-6 w-20 justify-center no-underline mb-1 rounded",
l.direction,
)}
value={l.name}
href={l.name === locale.name ? undefined : href}
>

View file

@ -1,9 +1,8 @@
import { Surah, TSurah, Quran } from "Quran";
import React from "react";
import ReactDOM from "react-dom/client";
import { Surah, TSurah, TLocale } from "Quran";
import { T } from "~/lib/t";
import { SurahIndex } from "~/components/SurahIndex";
import { Quran } from "Quran";
(function () {
const root: HTMLElement = document.querySelector(".root")!;

View file

@ -1,4 +1,4 @@
import { Quran, Surah, Ayah, TSurah, TLocale } from "Quran";
import { Quran, Surah, Ayah, TSurah } from "Quran";
import React from "react";
import ReactDOM from "react-dom/client";
import { T } from "~/lib/t";

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Fatihah",
"slug": "al-fatihah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Yunus",
"slug": "yunus"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-'Adiyat",
"slug": "al-adiyat"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Qari'ah",
"slug": "al-qariah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "At-Takathur",
"slug": "at-takathur"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-'Asr",
"slug": "al-asr"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Humazah",
"slug": "al-humazah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Fil",
"slug": "al-fil"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Quraysh",
"slug": "quraysh"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Ma'un",
"slug": "al-maun"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Kawthar",
"slug": "al-kawthar"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Kafirun",
"slug": "al-kafirun"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Hud",
"slug": "hud"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Nasr",
"slug": "an-nasr"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Masad",
"slug": "al-masad"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Ikhlas",
"slug": "al-ikhlas"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Falaq",
"slug": "al-falaq"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Nas",
"slug": "an-nas"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Yusuf",
"slug": "yusuf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ar-Ra'd",
"slug": "ar-rad"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ibrahim",
"slug": "ibrahim"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Hijr",
"slug": "al-hijr"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Nahl",
"slug": "an-nahl"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Isra",
"slug": "al-isra"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Kahf",
"slug": "al-kahf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Maryam",
"slug": "maryam"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Baqarah",
"slug": "al-baqarah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Taha",
"slug": "taha"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Anbya",
"slug": "al-anbya"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Hajj",
"slug": "al-hajj"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Mu'minun",
"slug": "al-muminun"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Nur",
"slug": "an-nur"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Furqan",
"slug": "al-furqan"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ash-Shu'ara",
"slug": "ash-shuara"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Naml",
"slug": "an-naml"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Qasas",
"slug": "al-qasas"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-'Ankabut",
"slug": "al-ankabut"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ali 'Imran",
"slug": "ali-imran"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ar-Rum",
"slug": "ar-rum"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Luqman",
"slug": "luqman"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "As-Sajdah",
"slug": "as-sajdah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Ahzab",
"slug": "al-ahzab"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Saba",
"slug": "saba"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Fatir",
"slug": "fatir"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ya-Sin",
"slug": "ya-sin"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "As-Saffat",
"slug": "as-saffat"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Sad",
"slug": "sad"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Az-Zumar",
"slug": "az-zumar"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Nisa",
"slug": "an-nisa"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ghafir",
"slug": "ghafir"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Fussilat",
"slug": "fussilat"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ash-Shuraa",
"slug": "ash-shuraa"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Az-Zukhruf",
"slug": "az-zukhruf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ad-Dukhan",
"slug": "ad-dukhan"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Jathiyah",
"slug": "al-jathiyah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Ahqaf",
"slug": "al-ahqaf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Muhammad",
"slug": "muhammad"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Fath",
"slug": "al-fath"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Hujurat",
"slug": "al-hujurat"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Ma'idah",
"slug": "al-maidah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Qaf",
"slug": "qaf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Adh-Dhariyat",
"slug": "adh-dhariyat"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "At-Tur",
"slug": "at-tur"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "An-Najm",
"slug": "an-najm"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Qamar",
"slug": "al-qamar"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Ar-Rahman",
"slug": "ar-rahman"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Waqi'ah",
"slug": "al-waqiah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Hadid",
"slug": "al-hadid"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Mujadila",
"slug": "al-mujadila"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Hashr",
"slug": "al-hashr"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-An'am",
"slug": "al-anam"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Mumtahanah",
"slug": "al-mumtahanah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "As-Saf",
"slug": "as-saf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Jumu'ah",
"slug": "al-jumuah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Munafiqun",
"slug": "al-munafiqun"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "At-Taghabun",
"slug": "at-taghabun"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "At-Talaq",
"slug": "at-talaq"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "At-Tahrim",
"slug": "at-tahrim"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Mulk",
"slug": "al-mulk"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Qalam",
"slug": "al-qalam"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Haqqah",
"slug": "al-haqqah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-A'raf",
"slug": "al-araf"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Ma'arij",
"slug": "al-maarij"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Nuh",
"slug": "nuh"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Jinn",
"slug": "al-jinn"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Muzzammil",
"slug": "al-muzzammil"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Muddaththir",
"slug": "al-muddaththir"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Qiyamah",
"slug": "al-qiyamah"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Insan",
"slug": "al-insan"
}
},
"translatedBy": null
}

View file

@ -5,5 +5,6 @@
"roman": {
"name": "Al-Mursalat",
"slug": "al-mursalat"
}
},
"translatedBy": null
}

Some files were not shown because too many files have changed in this diff Show more