Last active
March 7, 2022 16:30
-
-
Save amiriun/009aba4f6bfb5727d9e4 to your computer and use it in GitHub Desktop.
Translate Carbon Diff For Human Characters to Persian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function diffForHumans($time) | |
{ | |
$get_en = \Carbon::createFromTimeStamp( $time )->diffForHumans(); | |
$set_fa = str_replace('years','سال',$get_en); | |
$set_fa = str_replace('months','ماه',$set_fa); | |
$set_fa = str_replace('weeks','هفته',$set_fa); | |
$set_fa = str_replace('days','روز',$set_fa); | |
$set_fa = str_replace('hours','ساعت',$set_fa); | |
$set_fa = str_replace('minutes','دقیقه',$set_fa); | |
$set_fa = str_replace('seconds','ثانیه',$set_fa); | |
$set_fa = str_replace('year','سال',$set_fa); | |
$set_fa = str_replace('month','ماه',$set_fa); | |
$set_fa = str_replace('day','روز',$set_fa); | |
$set_fa = str_replace('week','هفته',$set_fa); | |
$set_fa = str_replace('hour','ساعت',$set_fa); | |
$set_fa = str_replace('minute','دقیقه',$set_fa); | |
$set_fa = str_replace('second','ثانیه',$set_fa); | |
$set_fa = str_replace('ago','پیش',$set_fa); | |
$set_fa = str_replace('after','بعد',$set_fa); | |
$set_fa = str_replace('before','قبل',$set_fa); | |
$set_fa = str_replace('from now','بعد',$set_fa); | |
return $set_fa; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment