Skip to content

Commit

Permalink
Improve pop-up description for file icons
Browse files Browse the repository at this point in the history
Previously, we used an hardcoded 'file icon' string, replaced with
$s_file_icon_description.

Also, added new $s_unknown_file_extension string to have a descriptive
text when the file extension is not referenced in $g_file_type_icons
instead of just displaying '?'.

Fixes #27827
  • Loading branch information
dregad committed Jan 8, 2021
1 parent 0e6bfa0 commit f25e116
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core/file_api.php
Expand Up @@ -341,8 +341,10 @@ function file_get_icon_url( $p_display_filename ) {
$t_ext = '?';
}

$t_name = $t_file_type_icons[$t_ext];
return array( 'url' => $t_name, 'alt' => $t_ext );
return array(
'url' => $t_file_type_icons[$t_ext],
'alt' => $t_ext == '?' ? lang_get( 'unknown_file_extension' ) : $t_ext
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/print_api.php
Expand Up @@ -1785,7 +1785,7 @@ function print_file_icon( $p_filename ) {
print_icon(
string_attribute( $t_icon['url'] ),
'',
string_attribute( $t_icon['alt'] ) . ' file icon'
sprintf( lang_get( 'file_icon_description' ), string_attribute( $t_icon['alt'] ) )
);
}

Expand Down
2 changes: 2 additions & 0 deletions lang/strings_english.txt
Expand Up @@ -602,6 +602,8 @@ $s_last_edited = 'Last edited:';
# file_api.php
$s_hide_content = 'Hide Content';
$s_show_content = 'Show Content';
$s_file_icon_description = '%1$s file icon';
$s_unknown_file_extension = 'unknown';

# html_api.php
$s_webmaster_contact_information = 'Contact <a href="mailto:%1$s" title="Contact the webmaster via e-mail.">administrator</a> for assistance';
Expand Down

0 comments on commit f25e116

Please sign in to comment.