Adding Cismaaniya support to your website

Daily chitchat.

Moderators: Moderators, Junior Moderators

Forum rules
This General Forum is for general discussions from daily chitchat to more serious discussions among Somalinet Forums members. Please do not use it as your Personal Message center (PM). If you want to contact a particular person or a group of people, please use the PM feature. If you want to contact the moderators, pls PM them. If you insist leaving a public message for the mods or other members, it will be deleted.
James Dahl
SomaliNet Super
SomaliNet Super
Posts: 5212
Joined: Mon Dec 04, 2006 11:05 pm
Location: Vancouver, British Columbia, Canada
Contact:

Adding Cismaaniya support to your website

Post by James Dahl »

I have done a lot of work to make Cismaaniya fonts work for my website, so I will make things easier for everyone else :lol:

First off, here is a script I wrote in PHP to transliterate the Somali latin alphabet into vocalized classical Arabic, Cismaaniya (or Borama/Gadabursi script if that font is made/used), or accented English alphabet characters.

Code: Select all

function LanguageConvert($text, $languageSetting) {
	$newtext = $text;
	if($languageSetting == 2) {
		$somali = array("Aa", "aa",
						"Ee", "ee", 
						"Ii", "ii", 
						"Oo", "oo", 
						"Uu", "uu", 
						"A", "a",
						"E", "e", 
						"I", "i", 
						"O", "o", 
						"U", "u", 
						"B", "b",
						"Th", "th",
						"T", "t",
						"J", "j",
						"X", "x",
						"Kh", "kh",
						"Dh", "dh",
						"D", "d",
						"R", "r",
						"Sh", "sh",
						"Sc", "sc",
						"Dc", "dc",
						"Tc", "tc",
						"Zc", "zc",
						"Z", "z",
						"C", "c",
						"S", "s",
						"G", "g",
						"F", "f",
						"Q", "q",
						"K", "k",
						"L", "l",
						"M", "m",
						"N", "n",
						"H", "h",
						"Y", "y",
						"W", "w",
						"'");
		$arabic = array("ع", "َا",	//Aa
						"ى", "َى",	//Ee
						"إ", "ِي",	//Ii
						"و", "ُو",	//Oo
						"و", "ُو",	//Uu
						"ا", "َ",	//A
						"ى", "َ",	//E
						"إ", "ِ",	//I
						"و", "ُ",	//O
						"و", "ُ",	//U
						"ب", "ب",	//Ba
						"ث", "ث",	//Tha
						"ت", "ت",	//Ta
						"ج", "ج",	//Jim
						"ح", "ح",	//Xa
						"خ", "خ",	//Kha
						"ذ", "ذ",	//Dhal
						"د", "د",	//Dal
						"ر", "ر",	//Reh
						"ش", "ش",	//Shin
						"ص", "ص",	//Sad
						"ض", "ض",	//Dad
						"ط", "ط",	//Ta
						"ط", "ط",	//Za
						"ز", "ز",	//Zayn
						"ع", "ع",	//Ayn
						"س", "س",	//Sin
						"غ", "غ",	//Ghayn
						"ف", "ف",	//Fa
						"ق", "ق",	//Qaf
						"ك", "ك",	//Kaf
						"ل", "ل",	//Lam
						"م", "م",	//Mim
						"ن", "ن",	//Nun
						"ه", "ه",	//Ha
						"ي", "ي",	//Ya
						"و", "و",	//Waw
						"ء");  //Hamza
		$newtext = str_replace($somali, $arabic, $text);
	}
	
	if($languageSetting == 3) {
		$somali = array("Aa", "aa",
						"Ee", "ee", 
						"Ii", "ii", 
						"Oo", "oo", 
						"Uu", "uu", 
						"A", "a",
						"E", "e", 
						"I", "i", 
						"O", "o", 
						"U", "u", 
						"B", "b",
						"T", "t",
						"J", "j",
						"X", "x",
						"Kh", "kh",
						"Dh", "dh",
						"D", "d",
						"R", "r",
						"Sh", "sh",
						"S", "s",
						"Z", "z",
						"C", "c",
						"G", "g",
						"F", "f",
						"Q", "q",
						"K", "k",
						"L", "l",
						"M", "m",
						"N", "n",
						"W", "w",
						"H", "h",
						"Y", "y");
		$cismaniya = array("𐒀", "𐒀",	//Aa
						"𐒜", "𐒜",		//Ee
						"𐒝", "𐒝",		//Oo
						"𐒓", "𐒓",		//Uu
						"𐒕", "𐒕",		//Ii
						"𐒀", "𐒀", //Alef
						"𐒗", "𐒗", //E
						"𐒘", "𐒘", //I
						"𐒙", "𐒙", //O
						"𐒚", "𐒚", //U
						"𐒁", "𐒁", //Ba
						"𐒂", "𐒂", //Ta
						"𐒃", "𐒃", //Ja
						"𐒄", "𐒄", //Xa
						"𐒅", "𐒅", //Kha
						"𐒊", "𐒊", //Dha
						"𐒆", "𐒆", //Deel
						"𐒇", "𐒇", //Ra
						"𐒉", "𐒉", //Shiin
						"𐒈", "𐒈", //Sa
						"𐒈", "𐒈", //Sa for Z
						"𐒋", "𐒋", //Cayn
						"𐒌", "𐒌", //Ga
						"𐒍", "𐒍", //Fa
						"𐒎", "𐒎", //Qaaf
						"𐒏", "𐒏", //Kaaf
						"𐒐", "𐒐", //Laan
						"𐒑", "𐒑", //Miin
						"𐒒", "𐒒", //Nuun
						"𐒓", "𐒓", //Waw
						"𐒔", "𐒔", //Ha
						"𐒕", "𐒕"); //Ya
		$newtext = '<span class="osmanya">'.str_replace($somali, $cismaniya, $text).'</span>';
	}
	
	if($languageSetting == 1) {
		$somali = array("Caa", "Caa",
						"Cee", "cee",
						"Cii", "cii",
						"Coo", "coo",
						"Cuu", "cuu",
						"Ca", "ca",
						"Ce", "ce",
						"Ci", "ci",
						"Co", "co",
						"Cu", "cu",
						"Aa", "aa",
						"Ee", "ee", 
						"Ii", "ii", 
						"Oo", "oo", 
						"Uu", "uu", 
						"X", "x",
						"c");
		$english = array("&#703;&#256;", "&#703;&#257;", //Caa
						 "&#703;Ay", "&#703;ay", //Cee
						 "&#703;&#298;", "&#703;&#299;", //Cii
						 "&#703;&#332;", "&#703;&#333;", //Coo
						 "&#703;&#362;", "&#703;&#363;", //Cuu
						 "&#703;A", "&#703;a", //Ca
						 "&#703;E", "&#703;e", //Ce
						 "&#703;I", "&#703;i", //Ci
						 "&#703;O", "&#703;o", //Co
						 "&#703;U", "&#703;u", //Cu
						 "&#256;", "&#257;", //Aa
						 "Ay", "ay", //Ee
						 "&#298;", "&#299;", //Ii
						 "&#332;", "&#333;", //Oo
						 "&#362;", "&#363;", //Uu
						 "&#7716;", "&#7717;", //X
						 "&#703;");  //c
		$newtext = str_replace($somali, $english, $text);
	}
	return $newtext;
}
The way it works is you run the function with the text you want transliterated as the first variable in the function, and the second is what you want it transliterated into. It assumes the word being transliterated is written in the Soomaali Latin Alphabet, and transliterates into 1: English alphabet, 2: Arabic alphabet, 3: Cismaaniya alphabet. Like this:

Code: Select all

LanguageConvert('Soomaali', 3);
That will return the word Soomaali in Cismaaniya characters.

Next I have created an open source SVG font of the Cismaaniya alphabet. Here (normal) and here (bold).

To use them, save both fonts into the same folder your style sheet is in, and add this to your stylesheet:

Code: Select all

@font-face { font-family: Cismaaniya; font-weight: normal; src: local("Cismaaniya Normal"),  url('CismaaniyaNormal.svg') format('svg'); }
@font-face { font-family: Cismaaniya; font-weight: bold; src: local("Cismaaniya Bold"),  url('CismaaniyaBold.svg') format('svg'); }
.cismaaniya { font-family: Cismaaniya; }
This will set whatever text you process with the PHP function to also use the Cismaaniya font, as it automatically wraps any text 'Cismaaniyaized' in that class.
Last edited by James Dahl on Fri Jan 20, 2012 12:38 pm, edited 1 time in total.
User avatar
MrSinister
SomaliNet Heavyweight
SomaliNet Heavyweight
Posts: 2797
Joined: Sun Sep 18, 2011 5:35 pm

Re: Adding Cismaaniya support to your website

Post by MrSinister »

You need a new hobby saxiib.
Alphanumeric
SomaliNet Super
SomaliNet Super
Posts: 14683
Joined: Tue Jun 14, 2011 1:00 am

Re: Adding Cismaaniya support to your website

Post by Alphanumeric »

I've been waiting for something like this.
User avatar
afisoone
SomaliNet Super
SomaliNet Super
Posts: 5509
Joined: Wed Jul 22, 2009 9:46 pm
Location: We all want to become president even though Amisom controls Mogadishu

Re: Adding Cismaaniya support to your website

Post by afisoone »

There is nothing 100% translation....sxb. I have done this sir....
get my e=book inshallah...soon..
Image
User avatar
Coeus
SomaliNet Super
SomaliNet Super
Posts: 11709
Joined: Fri Nov 19, 2010 6:59 pm
Location: Assisting the Mujahideen in Galgala to free their region

Re: Adding Cismaaniya support to your website

Post by Coeus »

Niice :up:

I have a Necklase with my name on it with Osmaniya letters, i like the writing very much :up:
User avatar
waryaa
SomaliNet Super
SomaliNet Super
Posts: 5889
Joined: Mon Apr 30, 2001 7:00 pm

Re: Adding Cismaaniya support to your website

Post by waryaa »

tnx james!

If you have time can you add "read it in osmaniya" page on your site where visitors can paste some somali text or supply external URL. Instead of reinventing the wheel other somali sites could simply add one button "read it in osmaniya" with a link to something like james-site.com/osmaniya/?page=www.mysitte.com/about_us on their sites.
Locked
  • Similar Topics
    Replies
    Views
    Last post

Return to “General - General Discussions”