farsi
How to support Arabic text in Android?
Android 2.1 does not have Arabic font. Android 2.2 has Arabic font but does not show your word correctly. Android 3.x supports Arabic completely. For Android 2.1 you must set the typeface Farsi.GetFarsiFont(this) and then use Farsi.Convert(“سلام”) For Android 2.2 you do not need setting font but must use Farsi.Convert(“سلام”) And for Android 3.x forget … Read more
Is there any library or algorithm for Persian (Shamsi or Jalali) calendar in Android? [closed]
I’m using this algorithm for years and it is very accurate between 1901 and 2099. Use it and Enjoy! 🙂 public class Utilities { private class SolarCalendar { public String strWeekDay = “”; public String strMonth = “”; int date; int month; int year; public SolarCalendar() { Date MiladiDate = new Date(); calcSolarCalendar(MiladiDate); } public … Read more
How to change Gregorian date to Persian date in JavaScript?
You can use toLocaleDateString(); let today = new Date().toLocaleDateString(‘fa-IR’); console.log(today); fa-IR is for Farsi-Iran, other dates is as follow: en-US: For English hi-IN: For Hindi … also you can set options as second argument, for example: let options = { year: ‘numeric’, month: ‘long’, day: ‘numeric’ }; let today = new Date().toLocaleDateString(‘fa-IR’, options); console.log(today); and … Read more
How to convert Persian and Arabic digits of a string to English using JavaScript?
Oneliner of all 6 possible translations between English, Arabic, and persian Digits. const e2p = s => s.replace(/\d/g, d => ‘۰۱۲۳۴۵۶۷۸۹'[d]) const e2a = s => s.replace(/\d/g, d => ‘٠١٢٣٤٥٦٧٨٩'[d]) const p2e = s => s.replace(/[۰-۹]/g, d => ‘۰۱۲۳۴۵۶۷۸۹’.indexOf(d)) const a2e = s => s.replace(/[٠-٩]/g, d => ‘٠١٢٣٤٥٦٧٨٩’.indexOf(d)) const p2a = s => s.replace(/[۰-۹]/g, d … Read more