We're going to build multilingual web application and we considering to use Yarp's Timeago jQuery plugin.
But we want to support Arabic Language in our application. And as you may know the Arabic language has different way to deal with Singular, Plural and "Dual"
e.g.
So is there a way to support this for Arabic Language without affecting the English one ?
I end up with sort of updated version of the library here is the new js code:
strings: {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "ago",
suffixFromNow: "from now",
seconds: "less than a minute",
minute: "about a minute",
twominute: "%d minutes",
lessthanorequaltwominutes: "%d minutes",
lessthanorequaltenminutes: "%d minutes",
minutes: "%d minutes",
hour: "about an hour",
twohour: "about %d hours",
lessthanorequaltwohours: "about %d hours",
lessthanorequaltenhours: "about %d hours",
hours: "about %d hours",
day: "a day",
twoday: "%d days",
lessthanorequaltwodays: "%d days",
lessthanorequaltendays: "%d days",
days: "%d days",
month: "about a month",
twomonth: "%d months",
lessthanorequaltwomonths: "%d months",
lessthanorequaltenmonths: "%d months",
months: "%d months",
year: "about a year",
twoyear: "%d years",
lessthanorequaltwoyears: "%d years",
lessthanorequaltenyears: "%d years",
years: "%d years",
wordSeparator: " ",
numbers: []
}
and there is another place need to be updated to:
var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
seconds < 90 && substitute($l.minute, 1) ||
seconds > 90 && seconds < 120 && substitute($l.lessthanorequaltwominutes, 1) ||
minutes >= 2 && minutes < 3 && substitute($l.twominute, 2) ||
minutes < 11 && substitute($l.lessthanorequaltenminutes, Math.round(minutes)) ||
minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
minutes < 90 && substitute($l.hour, 1) ||
minutes < 121 && minutes > 90 && substitute($l.lessthanorequaltwohours, 2) ||
hours >= 2 && hours < 3 && substitute($l.twohour, 2) ||
hours < 11 && substitute($l.lessthanorequaltenhours, Math.round(hours)) ||
hours < 24 && substitute($l.hours, Math.round(hours)) ||
hours < 42 && substitute($l.day, 1) ||
hours < 48 && hours > 42 && substitute($l.lessthanorequaltwodays, 2) ||
days >= 2 && days < 3 && substitute($l.twoday, 2) ||
days < 11 && substitute($l.lessthanorequaltendays, Math.round(days)) ||
days < 30 && substitute($l.days, Math.round(days)) ||
days < 45 && substitute($l.month, 1) ||
days > 59 && days < 63 && substitute($l.twomonth, 2) ||
days < 75 && days > 45 && substitute($l.lessthanorequaltwomonths, 2) ||
days < 310 && substitute($l.lessthanorequaltenmonths, Math.round(days / 30)) ||
days < 365 && substitute($l.months, Math.round(days / 30)) ||
days > 365 && days < 485 && substitute($l.year, 1) ||
days > 485 && years < 2 && substitute($l.lessthanorequaltwoyears, 2) ||
years >= 2 && years < 3 && substitute($l.twoyear, 2) ||
years < 11 && substitute($l.lessthanorequaltenyears, Math.round(years)) ||
years < 1.5 && substitute($l.year, 1) ||
substitute($l.years, Math.round(years));