WPIntell

Source evidence

WordPress Jalali Multilingual Support

wp-jalali · support · 2016-08-28T10:01:00+00:00

complaintsentiment
mediumseverity
0.75relevance
0replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 31 rows with source links

19.4% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

25 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
esmodev unresolved
Hi Dear Users I had a problem with multilingual support (Which is that Wp-Jalali does not support) and i figured it out and just wanted to let you guys know if you want to use it in other languages. There is a line of code in the file wp-content/plugins/wp-jalali/lib/date.php at line 475 : function gregorian_to_jalali($g_y, $g_m, $g_d) { static $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); static $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $gy = $g_y - 1600; $gm = $g_m - 1; $g_day_no = (365 * $gy + int_div($gy + 3, 4) - int_div($gy + 99, 100) + int_div($gy + 399, 400)); for ($i = 0; $i < $gm; ++$i) { $g_day_no += $g_days_in_month[$i]; } if ($gm > 1 && (($gy % 4 == 0 && $gy % 100 != 0) || ($gy % 400 == 0))) # leap and after Feb $g_day_no ++; $g_day_no += $g_d - 1; $j_day_no = $g_day_no - 79; $j_np = int_div($j_day_no, 12053); # 12053 = (365 * 33 + 32 / 4) $j_day_no = $j_day_no % 12053; $jy = (979 + 33 * $j_np + 4 * int_div($j_day_no, 1461)); # 1461 = (365 * 4 + 4 / 4) $j_day_no %= 1461; if ($j_day_no >= 366) { $jy += int_div($j_day_no - 1, 365); $j_day_no = ($j_day_no - 1) % 365; } for ($i = 0; ($i < 11 && $j_day_no >= $j_days_in_month[$i]); ++$i) { $j_day_no -= $j_days_in_month[$i]; } return array($jy, $i + 1, $j_day_no + 1); } Just change it to : function gregorian_to_jalali($g_y, $g_m, $g_d) { if (get_locale() == 'fa_IR') { static $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); static $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $gy = $g_y - 1600; $gm = $g_m - 1; $g_day_no = (365 * $gy + int_div($gy + 3, 4) - int_div($gy + 99, 100) + int_div($gy + 399, 400)); for ($i = 0; $i < $gm; ++$i) { $g_day_no += $g_days_in_month[$i]; } if ($gm > 1 && (($gy % 4 == 0 && $gy % 100 != 0) || ($gy % 400 == 0))) # leap and after Feb $g_day_no ++; $g_day_no += $g_d - 1; $j_day_no = $g_day_no - 79; $j_np = int_div($j_day_no, 12053); # 12053 = (365 * 33 + 32 / 4) $j_day_no = $j_day_no % 12053; $jy = (979 + 33 * $j_np + 4 * int_div($j_day_no, 1461)); # 1461 = (365 * 4 + 4 / 4) $j_day_no %= 1461; if ($j_day_no >= 366) { $jy += int_div($j_day_no - 1, 365); $j_day_no = ($j_day_no - 1) % 365; } for ($i = 0; ($i < 11 && $j_day_no >= $j_days_in_month[$i]); ++$i) { $j_day_no -= $j_days_in_month[$i]; } return array($jy, $i + 1, $j_day_no + 1); }else{ return array($g_y, $g_m, $g_d); } } Then your problem is solved, Notice that you can use get_locale(); to get the current language of site. I am a professional web developer, Contact me if you need help email : info@porshad.net https://wordpress.org/plugins/wp-jalali/

Comments

0 shown

No comments were stored for this source.