?>
var web_root = "<?php echo $cfg['web_root']; ?>";
-function translate (expr)
-{
- var lang_array = <?php echo json_lang_generator() ?>;
- if (lang_array.hasOwnProperty(expr))
- return lang_array[expr];
- return expr;
+var lang_array = <?php echo json_lang_generator(null); ?>;
+var lang_array_fallback = <?php echo json_lang_generator("en"); ?>;
+
+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) {
// Email link
var filename = document.getElementById('file_select').files[0].name;
- var b = encodeURIComponent("Download file \"" + filename + "\":") + "%0D";
+ var b = encodeURIComponent("<?php echo t("DL"); ?> \"" + filename + "\":") + "%0D";
b += encodeURIComponent(web_root + download_link_href) + "%0D";
if (false == isEmpty(date))
{
- b += "%0D" + encodeURIComponent("This file will be available until " + date.format('YYYY-MM-DD hh:mm (GMT O)')) + "%0D";
+ b += "%0D" + encodeURIComponent("<?php echo t("VALID_UNTIL"); ?>: " + date.format('YYYY-MM-DD hh:mm (GMT O)')) + "%0D";
document.getElementById('upload_link_email').href = "mailto:?body=" + b + "&subject=" + encodeURIComponent(filename);
}
function milliseconds_to_time_string (milliseconds)
{
function numberEnding (number) {
- var currentLanguage = '<?php echo $cfg['lang']; ?>';
-
- if(currentLanguage == 'de') {
- return (number > 1) ? 'n' : '';
- }
- else {
- return (number > 1) ? 's' : '';
- }
+ return (number > 1) ? translate ('PLURAL_ENDING') : '';
}
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()