Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #140 from dregad/hardcoded-strings

Fix hardcoded strings
  • Loading branch information...
commit e3ed007f3d0212b79a9302f3ef7a5b75c11bd7e1 2 parents 927706b + cfb212e
@dregad dregad authored
View
6 bug_file_upload_inc.php
@@ -69,9 +69,9 @@
</tr>
<tr class="row-1">
<td class="category" width="15%">
- <?php echo lang_get( $t_file_upload_max_num == 1 ? 'select_file' : 'select_files' ) ?><br />
- <?php //FIXME: hard coded "k" in here. ?>
- <span class="small"><?php echo lang_get( 'max_file_size_label' ) . lang_get( 'word_separator' ) . number_format( $t_max_file_size/1000 ) ?>k</span>
+ <?php echo lang_get( $t_file_upload_max_num == 1 ? 'select_file' : 'select_files' ) ?>
+ <br />
+ <?php echo print_max_filesize( $t_max_file_size ); ?>
</td>
<td width="85%">
<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
View
5 bug_report_page.php
@@ -597,8 +597,9 @@
?>
<tr>
<th class="category">
- <label for="file"><?php echo lang_get( $t_file_upload_max_num == 1 ? 'upload_file' : 'upload_files' ) ?></label><br />
- <span class="small"><?php echo lang_get( 'max_file_size_label' ) . lang_get( 'word_separator' ) . number_format( $t_max_file_size/1000 ) ?>k</span>
+ <label for="file"><?php echo lang_get( $t_file_upload_max_num == 1 ? 'upload_file' : 'upload_files' ) ?></label>
+ <br />
+ <?php echo print_max_filesize( $t_max_file_size ); ?>
</th>
<td>
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
View
4 core/columns_api.php
@@ -1514,8 +1514,8 @@ function print_column_overdue( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_P
!date_is_null( $p_bug->due_date ) &&
bug_is_overdue( $p_bug->id ) ) {
$t_overdue_text = lang_get( 'overdue' );
- $t_overdue_text_hover = $t_overdue_text . '. Due date was: ' . string_display_line( date( config_get( 'short_date_format' ), $p_bug->due_date ) );
- echo '<img src="' . $t_icon_path . 'overdue.png" alt="' . $t_overdue_text . '" title="' . $t_overdue_text_hover . '" />';
+ $t_overdue_text_hover = sprintf( lang_get( 'overdue_since' ), date( config_get( 'short_date_format' ), $p_bug->due_date ) );
+ echo '<img src="' . $t_icon_path . 'overdue.png" alt="' . $t_overdue_text . '" title="' . string_display_line( $t_overdue_text_hover ) . '" />';
} else {
echo '&#160;';
}
View
24 core/print_api.php
@@ -1866,3 +1866,27 @@ function print_timezone_option_list( $p_timezone ) {
echo "\t</optgroup>\n";
}
}
+
+/**
+ * Return file size information
+ * @param int $p_size
+ * @param string $p_unit
+ * @return string
+ */
+function get_filesize_info( $p_size, $p_unit ) {
+ return sprintf( lang_get( 'file_size_info' ), number_format( $p_size ), $p_unit );
+}
+
+/**
+ * Print maximum file size information
+ * @param int $p_size in bytes
+ * @param int $p_divider optional divider, defaults to 1000
+ * @param string $p_unit optional language string of unit, defaults to KB
+ */
+function print_max_filesize( $p_size, $p_divider = 1000, $p_unit = 'kb' ) {
+ echo '<span class="small" title="' . get_filesize_info( $p_size, lang_get( 'bytes' ) ) . '">';
+ echo lang_get( 'max_file_size_label' )
+ . lang_get( 'word_separator' )
+ . get_filesize_info( $p_size / $p_divider, lang_get( $p_unit ) );
+ echo '</span>';
+}
View
4 lang/strings_english.txt
@@ -489,8 +489,8 @@ $s_select_file = 'Select File';
$s_select_files = 'Select Files';
$s_upload_file_button = 'Upload File';
$s_upload_files_button = 'Upload Files';
-$s_max_file_size = 'Maximum size';
$s_max_file_size_label = 'Maximum size:';
+$s_file_size_info = '%1$s %2$s'; # $1 = size, $2 = unit (e.g. kb, bytes)
# bug_reopen.php
$s_bug_reopened_msg = 'Issue has been reopened...';
@@ -1303,6 +1303,7 @@ $s_monitored_by = 'Monitored By';
$s_monitored_by_label = 'Monitored By:';
$s_attachments = 'attachment(s)';
$s_bytes = 'bytes';
+$s_kb = 'KB';
$s_attachment_missing = 'Attachment missing';
$s_attachment_count = 'Attachment count';
$s_view_attachments_for_issue = 'View %1$d attachment(s) for issue #%2$d';
@@ -1525,6 +1526,7 @@ $s_copy_columns_to = 'Copy Columns To';
# due date
$s_due_date = 'Due Date';
$s_overdue = 'Overdue';
+$s_overdue_since = 'Overdue since %1$s';
#account_view_page.php
$s_view_account_title = 'User Information';
View
1  lang/strings_qqq.txt
@@ -71,6 +71,7 @@ $s_add_new_relationship_button = '{{Identical|Add}}';
$s_on = 'Switch confition (for filter, for example)';
$s_off = 'Switch condition (for filter, for example)';
$s_show_all_tags = '{{Identical|All}}';
+$s_file_size_info = 'Displays file size information, where $1 is the size and $2 is the unit';
$MANTIS_ERROR[ERROR_PLUGIN_GENERIC] = 'If we need to specify the number of expected parameter in string, we just need to write something like "Lalal %2$s bububu %1$d", where 1 and 2 - the index number in argument list (actually, expected in original message)';
View
6 proj_doc_add_page.php
@@ -86,9 +86,9 @@
</tr>
<tr class="row-1">
<td class="category">
- <span class="required">*</span><?php echo lang_get( 'select_file' ); ?><br />
- <?php // FIXME: hard coded "k" in here. ?>
- <span class="small"><?php echo lang_get( 'max_file_size_label' ) . lang_get( 'word_separator' ) . number_format( $t_max_file_size/1000 ) ?>k</span>
+ <span class="required">*</span><?php echo lang_get( 'select_file' ); ?>
+ <br />
+ <?php echo print_max_filesize( $t_max_file_size ); ?>
</td>
<td>
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
View
6 proj_doc_edit_page.php
@@ -124,9 +124,9 @@
</tr>
<tr class="row-2">
<td class="category">
- <?php echo lang_get( 'select_file' ); ?><br />
- <?php // FIXME: hard coded "k" in here. ?>
- <span class="small"><?php echo lang_get( 'max_file_size_label' ) . lang_get( 'word_separator' ) . number_format( $t_max_file_size/1000 ) ?>k</span>
+ <?php echo lang_get( 'select_file' ); ?>
+ <br />
+ <?php echo print_max_filesize( $t_max_file_size ); ?>
</td>
<td>
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
Please sign in to comment.
Something went wrong with that request. Please try again.