DEV Community🇧🇩
Formatting Taka Amounts for Bangladeshi Users in JavaScript (Intl.NumberFormat, Bangla Digits Included)
Bangladeshi users read prices two ways. With Latin digits, like 1,250.50. And with Bangla digits, like ১,২৫০.৫০. Grouping also follows the South Asian lakh pattern for large numbers. The good news is that JavaScript handles all of it natively. Latin digits, Taka currency const bdtEn = new Intl . NumberFormat ( 'en-BD' , { style : 'currency' , currency : 'BDT' , } ) ; console . log ( bdtEn . format ( 1250.5 ) ) ; console . log ( bdtEn . format ( 1234567 ) ) ; ~~~ { % endraw % } Depending on the runtime you 'll see BDT or the ৳ sign in the output. Large numbers get lakh grouping, so 1234567 becomes 12,34,567. ## Bangla digits{% raw %} ~~~js const bdtBn = new Intl.NumberFormat(' bn - BD ', { style: ' currency ', currency: ' BDT ', }); console.log(bdtBn.format(1250.5)); // Bangla digits with the Taka sign ~~~ ## Let the user choose Don' t guess from the browser language alone . Many Bangladeshi users keep their phone in English but prefer Bangla prices , or the other way around . A small toggle saved in localStorage solves it . { % raw % } ~~~ js function formatTaka ( amount ) { let pref = 'en' ; try { pref = localStorage . getItem ( 'digits' ) || 'en' ; } catch ( e ) { } return ( pref === 'bn' ? bdtBn : bdtEn ) . format ( amount ) ; } ~~~ { % endraw % } ## Per - 1000 pricing SMM panels quote rates per 1000 .