npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

the-amazing-quran-translations

v1.0.0

Published

This repository contains translations of the holly Quran in json format, and a small node module to handle them

Downloads

5

Readme

The Amazing Quran | Translations

بسم الله الرحمن الرحيم

This node module allows you to easily retrieve surah or ayah from quran in several languages

No database is required, you just need to have node installed !

How to use ?

Installation

$> npm install the-amazing-quran-translations

Get Available Languages

getAvailableLanguages()

This function return an array of string containing the available languages

Get Surah

This function allows you to retrieve a surah from the Quran

getSurah(surahNumber, translations)

// translations is optional
// translation can be a String, an Object, or an Array of Object
// Object need to have this structure
// {
// 	 languageName: String
//	 authorName: String 	[optional]
// }
Return value

This function return a surah object if the surah number is correct. If not, it return false. By default, it return the arabic version.

// surah object
{
  surahNumber: String,
  surahName: String,
  translatedSurahNames: Object,
  ayahs: Array[{ ayahNumber: String, ayahContent: String, translationName: string }]
}
Examples
var quranManager = require('the-amazing-quran-translations')();

// Get surah al fatiha in arabic
quranManager.getSurah(1);

// Get surah al fatiha in english
quranManager.getSurah(1, 'english');

// Get surah al fatiha in english french and german
quranManager.getSurah(1, 'english,french,german');

// Get surah al fatiha in english translated by Yusuf Ali
var foo = quranManager.getSurah(112, [{ languageName: 'french'}, {languageName: 'english', authorName: 'Yusuf_Ali'}, {languageName: 'chinese'}]);

console.log(foo);
// Will display :
{
	surahNumber: '112',
  	surahName: 'الإخلاص',
  	translatedSurahNames:
   	{
		french: 'Le monothéisme pur (Al-Ihlas)',
		english: 'The Unity',
		chinese: '忠 誠'
   	},
  	ayahs:
	   [ { ayahNumber: '1',
	       ayahContent: 'قُلْ هُوَ اللَّهُ أَحَدٌ',
	       french: 'Dis : "Il est Allah, Unique.',
	       english: 'Say: He is Allah, the One and Only;',
	       chinese: '你說:他是真主,是獨一的主;' },
	     { ayahNumber: '2',
	       ayahContent: 'اللَّهُ الصَّمَدُ',
	       french: 'Allah, Le Seul à être imploré pour ce que nous désirons.',
	       english: 'Allah, the Eternal, Absolute;',
	       chinese: '真主是萬物所仰賴的;' },
	     { ayahNumber: '3',
	       ayahContent: 'لَمْ يَلِدْ وَلَمْ يُولَدْ',
	       french: 'Il n´a jamais engendré, n´a pas été engendré non plus.',
	       english: 'He begetteth not, nor is He begotten;',
	       chinese: '他沒有生產,也沒有被生產;' },
	     { ayahNumber: '4',
	       ayahContent: 'وَلَمْ يَكُنْ لَهُ كُفُوًا أَحَدٌ',
	       french: 'Et nul n´est égal à Lui".',
	       english: 'And there is none like unto Him.',
	       chinese: '沒有任何物可以做他的匹敵。' }
	   ]
}

Get Ayah

This function allows you to retrieve an ayah from the Quran

getAyah(surahNumber, ayahNumber, translations)

// translations is optional
// translation can be a String, an Object, or an Array of Object
// Object need to have this structure
// {
// 	 languageName: String
//	 authorName: String 	[optional]
// }
Return value

This function return an ayah object if the surah and ayah number are correct. If not, it return false. By default, it return the arabic version.

// ayah object
{
  ayahNumber: String,
  ayahContent: String,
  translationName: String,
  surah: Object { surahNumber: String, surahName: String, translatedSurahNames: Object }
}
Examples
var quranManager = require('the-amazing-quran-translations')();

// Get ayah number 2 from surah al fatiha in german
quranManager.getAyah(1, 2);

// Get ayah number 43 from surah 7 in arabic
var bar = quranManager.getAyah(7, 43, 'french');

console.log(bar);
// Will display
{ ayahNumber: '43',
  ayahContent: 'وَنَزَعْنَا مَا فِي صُدُورِهِمْ مِنْ غِلٍّ تَجْرِي مِنْ تَحْتِهِمُ الْأَنْهَارُ ۖ وَقَالُوا الْحَمْدُ لِلَّهِ الَّذِي هَدَانَا لِهَٰذَا وَمَا كُنَّا لِنَهْتَدِيَ لَوْلَا أَنْ هَدَانَا اللَّهُ ۖ لَقَدْ جَاءَتْ رُسُلُ رَبِّنَا بِالْحَقِّ ۖ وَنُودُوا أَنْ تِلْكُمُ الْجَنَّةُ أُورِثْتُمُوهَا بِمَا كُنْتُمْ تَعْمَلُونَ',
  french: 'Et Nous enlèverons toute la rancune de leurs poitrines, sous eux couleront les ruisseaux, et ils diront : "Louange à Allah qui nous a guidés à ceci. Nous n´aurions pas été guidés, si Allah ne nous avait pas guidés. Les messagers de notre Seigneur sont venus avec la vérité." Et on leur proclamera : "Voilà le Paradis qui vous a été donné en héritage pour ce que vous faisiez".',
  surah:
   {
   	 surahNumber: '7',
     surahName: 'الأعراف',
     translatedSurahNames: { french: 'Al-Araf'
   }
}

Source code

The source code is in the src directory.

Since the module is develop in ES6, a simple gulp task using Babel.js convert it in ES5.

Translations

All translations are in the translations directory.

The different translations of the Quran are sotred in JSON files. All JSON translations are based on the XML files download from http://qurandatabase.org

Next features

Here is a none exhaustive list of features that can be implemented

  • add test cases
  • get surah by name
  • multiple translation of same language in one surah/ayah
  • add the mekkah/medina surah information
  • search function
  • get the surah length

Permissions

This module is open source. You can use, share, copy, modify and distribute this app as you want as long as you don't have a bad purpose

Issues

If you find any issues on this project, please report on the issue section of github or send a mail to [email protected]