X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/b2186ae902b055a52ba879e232c799581a1c657c..9d5ead29bc211bda78730ea5f2bfa71075c6f932:/lib/functions.js.php diff --git a/lib/functions.js.php b/lib/functions.js.php index 79d7c95..5455d78 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -28,12 +28,21 @@ require(JIRAFEAU_ROOT . 'lib/lang.php'); ?> var web_root = ""; -function translate (expr) -{ - var lang_array = ; - if (lang_array.hasOwnProperty(expr)) - return lang_array[expr]; - return expr; +var lang_array = ; +var lang_array_fallback = ; + +function translate (expr) { + if (lang_array.hasOwnProperty(expr)) { + var e = lang_array[expr]; + if (!isEmpty(e)) + return e; + } + if (lang_array_fallback.hasOwnProperty(expr)) { + var e = lang_array_fallback[expr]; + if (!isEmpty(e)) + return e; + } + return "FIXME: " + expr; } function isEmpty(str) { @@ -645,25 +654,25 @@ function milliseconds_to_time_string (milliseconds) var temp = Math.floor(milliseconds / 1000); var years = Math.floor(temp / 31536000); if (years) { - return years + ' ' + translate ('year') + numberEnding(years); + return years + ' ' + translate ('YEAR') + numberEnding(years); } var days = Math.floor((temp %= 31536000) / 86400); if (days) { - return days + ' ' + translate ('day') + numberEnding(days); + return days + ' ' + translate ('DAY') + numberEnding(days); } var hours = Math.floor((temp %= 86400) / 3600); if (hours) { - return hours + ' ' + translate ('hour') + numberEnding(hours); + return hours + ' ' + translate ('HOUR') + numberEnding(hours); } var minutes = Math.floor((temp %= 3600) / 60); if (minutes) { - return minutes + ' ' + translate ('minute') + numberEnding(minutes); + return minutes + ' ' + translate ('MINUTE') + numberEnding(minutes); } var seconds = temp % 60; if (seconds) { - return seconds + ' ' + translate ('second') + numberEnding(seconds); + return seconds + ' ' + translate ('SECOND') + numberEnding(seconds); } - return translate ('less than a second'); + return translate ('LESS_1_SEC'); } function upload_time_estimation_time()