Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

[Enhancement] Arabic translation #101

Open
Mohammad-Ha opened this issue Jul 29, 2019 · 1 comment
Open

[Enhancement] Arabic translation #101

Mohammad-Ha opened this issue Jul 29, 2019 · 1 comment

Comments

@Mohammad-Ha
Copy link

The current translation is simple and enough, but an improvement doesn't stop it from being perfect. Arabic has suffix/prefix which changes depending on the number.

English: 3 hours ago
Arabic: منذ 3 ساعات مضت

The prefix after the number depends on the number if it's 1, 2, or bigger than 10 or small than 10. The following, let's say, simple code is a way that you can improve the Arabic translation.

// The following applies only if the time is countable, which means that it's not a date, but time offset (3 hours ago, 24 minutes ago, etc)

We will call this countable time as $time. If the time is just now, you can use the current translation which is "منذ بضعة دقائق" which means a few minutes ago or "منذ قليل" which means "before/just now/a few moments ago"

We will call the type of time $type, this type will hold the info that the time is hours or minutes or seconds.

if($time === 1){
     if($type === "seconds"){
         $text = "منذ ثانية"
     } else if($type === "minutes"){
         $text = "منذ دقيقة"
     } else if($type === "hours"){
         $text = "منذ ساعة"
     } else if($type === "days"){
         $text = "منذ يوم"
     }
} else if($time === 2){
     if($type === "seconds"){
         $text = "منذ ثانيتين"
     } else if($type === "minutes"){
         $text = "منذ دقيقتين"
     } else if($type === "hours"){
         $text = "منذ ساعتين"
     } else if($type === "days"){
         $text = "منذ يومين"
     }
} else if($time > 10){
     if($type === "seconds"){
         $text = "منذ $time ثانية"
     } else if($type === "minutes"){
         $text = "منذ $time دقيقة"
     } else if($type === "hours"){
         $text = "منذ $time ساعة"
     } else if($type === "days"){
         $text = "منذ $time يوم"
     }
} else if($time <= 10 && $time > 2){
     if($type === "seconds"){
         $text = "منذ $time ثواني"
     } else if($type === "minutes"){
         $text = "منذ $time دقائق"
     } else if($type === "hours"){
         $text = "منذ $time ساعات"
     } else if($type === "days"){
         $text = "منذ $time أيام"
     }
}

Feel free to apply this small improvement. The current translation has only a grammatical issue, other than that, it's usable.

@xinbenlv
Copy link

xinbenlv commented Jul 7, 2020

This is great, but I think this shall go to dns-fns instead of vue-timeago, right? @Mohammad-Ha

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants