mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #397: i18n for sort indicator
Fixed translations of sort indicator. Now it separate string for better translate. Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
9bec191b25
commit
0fdb3488e5
@ -43,6 +43,7 @@ typedef struct panel_format_struct {
|
|||||||
int min_size;
|
int min_size;
|
||||||
int expands;
|
int expands;
|
||||||
align_crt_t default_just;
|
align_crt_t default_just;
|
||||||
|
const char *hotkey;
|
||||||
const char *title;
|
const char *title;
|
||||||
const char *title_hotkey;
|
const char *title_hotkey;
|
||||||
gboolean use_in_user_format;
|
gboolean use_in_user_format;
|
||||||
|
54
src/screen.c
54
src/screen.c
@ -434,24 +434,32 @@ string_dot (file_entry *fe, int len)
|
|||||||
panel_field_t panel_fields [] = {
|
panel_field_t panel_fields [] = {
|
||||||
{
|
{
|
||||||
"unsorted", 12, 1, J_LEFT_FIT,
|
"unsorted", 12, 1, J_LEFT_FIT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'unsorted' sort mode */
|
||||||
|
N_("u"),
|
||||||
N_("Unsorted"), N_("&Unsorted"), FALSE,
|
N_("Unsorted"), N_("&Unsorted"), FALSE,
|
||||||
string_file_name,
|
string_file_name,
|
||||||
(sortfn *) unsorted
|
(sortfn *) unsorted
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name", 12, 1, J_LEFT_FIT,
|
"name", 12, 1, J_LEFT_FIT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'name' sort mode */
|
||||||
|
N_("n"),
|
||||||
N_("Name"), N_("&Name"), TRUE,
|
N_("Name"), N_("&Name"), TRUE,
|
||||||
string_file_name,
|
string_file_name,
|
||||||
(sortfn *) sort_name
|
(sortfn *) sort_name
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extension", 12, 1, J_LEFT_FIT,
|
"extension", 12, 1, J_LEFT_FIT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'extension' sort mode */
|
||||||
|
N_("e"),
|
||||||
N_("Extension"), N_("&Extension"), FALSE,
|
N_("Extension"), N_("&Extension"), FALSE,
|
||||||
string_file_name, /* TODO: string_file_ext*/
|
string_file_name, /* TODO: string_file_ext*/
|
||||||
(sortfn *) sort_ext
|
(sortfn *) sort_ext
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size", 7, 0, J_RIGHT,
|
"size", 7, 0, J_RIGHT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'size' sort mode */
|
||||||
|
N_("s"),
|
||||||
N_("Size"), N_("&Size"), TRUE,
|
N_("Size"), N_("&Size"), TRUE,
|
||||||
string_file_size,
|
string_file_size,
|
||||||
(sortfn *) sort_size
|
(sortfn *) sort_size
|
||||||
@ -464,101 +472,121 @@ panel_field_t panel_fields [] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type", GT, 0, J_LEFT,
|
"type", GT, 0, J_LEFT,
|
||||||
|
"",
|
||||||
"", NULL, TRUE,
|
"", NULL, TRUE,
|
||||||
string_file_type,
|
string_file_type,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mtime", 12, 0, J_RIGHT,
|
"mtime", 12, 0, J_RIGHT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'Modify time' sort mode */
|
||||||
|
N_("m"),
|
||||||
N_("MTime"), N_("&Modify time"), TRUE,
|
N_("MTime"), N_("&Modify time"), TRUE,
|
||||||
string_file_mtime,
|
string_file_mtime,
|
||||||
(sortfn *) sort_time
|
(sortfn *) sort_time
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"atime", 12, 0, J_RIGHT,
|
"atime", 12, 0, J_RIGHT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'Access time' sort mode */
|
||||||
|
N_("a"),
|
||||||
N_("ATime"), N_("&Access time"), TRUE,
|
N_("ATime"), N_("&Access time"), TRUE,
|
||||||
string_file_atime,
|
string_file_atime,
|
||||||
(sortfn *) sort_atime
|
(sortfn *) sort_atime
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ctime", 12, 0, J_RIGHT,
|
"ctime", 12, 0, J_RIGHT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'Change time' sort mode */
|
||||||
|
N_("h"),
|
||||||
N_("CTime"), N_("C&Hange time"), TRUE,
|
N_("CTime"), N_("C&Hange time"), TRUE,
|
||||||
string_file_ctime,
|
string_file_ctime,
|
||||||
(sortfn *) sort_ctime
|
(sortfn *) sort_ctime
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"perm", 10, 0, J_LEFT,
|
"perm", 10, 0, J_LEFT,
|
||||||
|
"",
|
||||||
N_("Permission"), NULL, TRUE,
|
N_("Permission"), NULL, TRUE,
|
||||||
string_file_permission,
|
string_file_permission,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mode", 6, 0, J_RIGHT,
|
"mode", 6, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
N_("Perm"), NULL, TRUE,
|
N_("Perm"), NULL, TRUE,
|
||||||
string_file_perm_octal,
|
string_file_perm_octal,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nlink", 2, 0, J_RIGHT,
|
"nlink", 2, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
N_("Nl"), NULL, TRUE,
|
N_("Nl"), NULL, TRUE,
|
||||||
string_file_nlinks, NULL
|
string_file_nlinks, NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inode", 5, 0, J_RIGHT,
|
"inode", 5, 0, J_RIGHT,
|
||||||
|
/* TRANSLATORS: one single character to represent 'inode' sort mode */
|
||||||
|
N_("i"),
|
||||||
N_("Inode"), N_("&Inode"), TRUE,
|
N_("Inode"), N_("&Inode"), TRUE,
|
||||||
string_inode,
|
string_inode,
|
||||||
(sortfn *) sort_inode
|
(sortfn *) sort_inode
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nuid", 5, 0, J_RIGHT,
|
"nuid", 5, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
N_("UID"), NULL, FALSE,
|
N_("UID"), NULL, FALSE,
|
||||||
string_file_nuid,
|
string_file_nuid,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ngid", 5, 0, J_RIGHT,
|
"ngid", 5, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
N_("GID"), NULL, FALSE,
|
N_("GID"), NULL, FALSE,
|
||||||
string_file_ngid,
|
string_file_ngid,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"owner", 8, 0, J_LEFT_FIT,
|
"owner", 8, 0, J_LEFT_FIT,
|
||||||
|
"",
|
||||||
N_("Owner"), NULL, TRUE,
|
N_("Owner"), NULL, TRUE,
|
||||||
string_file_owner,
|
string_file_owner,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group", 8,0, J_LEFT_FIT,
|
"group", 8,0, J_LEFT_FIT,
|
||||||
|
"",
|
||||||
N_("Group"), NULL, TRUE,
|
N_("Group"), NULL, TRUE,
|
||||||
string_file_group,
|
string_file_group,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mark", 1, 0, J_RIGHT,
|
"mark", 1, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
" ", NULL, TRUE,
|
" ", NULL, TRUE,
|
||||||
string_marked,
|
string_marked,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"|", 1, 0, J_RIGHT,
|
"|", 1, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
" ", NULL, TRUE,
|
" ", NULL, TRUE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"space", 1, 0, J_RIGHT,
|
"space", 1, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
" ", NULL, TRUE,
|
" ", NULL, TRUE,
|
||||||
string_space,
|
string_space,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dot", 1, 0, J_RIGHT,
|
"dot", 1, 0, J_RIGHT,
|
||||||
|
"",
|
||||||
" ", NULL, FALSE,
|
" ", NULL, FALSE,
|
||||||
string_dot,
|
string_dot,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NULL, 0, 0, J_RIGHT, NULL, NULL, FALSE, NULL, NULL
|
NULL, 0, 0, J_RIGHT, NULL, NULL, NULL, FALSE, NULL, NULL
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1314,32 +1342,16 @@ panel_reload (WPanel *panel)
|
|||||||
static void
|
static void
|
||||||
panel_paint_sort_info(WPanel *panel)
|
panel_paint_sort_info(WPanel *panel)
|
||||||
{
|
{
|
||||||
struct hotkey_t hk;
|
|
||||||
const char *sort_sign = (panel->reverse) ? panel_sort_down_sign : panel_sort_up_sign;
|
const char *sort_sign = (panel->reverse) ? panel_sort_down_sign : panel_sort_up_sign;
|
||||||
char *str, *hotkey;
|
char *str;
|
||||||
gsize len=6;
|
|
||||||
|
|
||||||
/* get hotkey from field description */
|
if (*panel->current_sort_field->hotkey == '\0')
|
||||||
hk = parse_hotkey (_(panel->current_sort_field->title_hotkey));
|
return;
|
||||||
if (hk.hotkey) {
|
|
||||||
hotkey = g_strdup(hk.hotkey);
|
|
||||||
} else {
|
|
||||||
/* if field don't have hotkey - use first char of field name */
|
|
||||||
hotkey = g_strdup(panel->current_sort_field->id);
|
|
||||||
hotkey[1] = '\0';
|
|
||||||
}
|
|
||||||
release_hotkey (hk);
|
|
||||||
|
|
||||||
/* transform to lower case */
|
str = g_strdup_printf("%s%s",sort_sign, _(panel->current_sort_field->hotkey));
|
||||||
str = hotkey;
|
|
||||||
str_tolower (hotkey, &str, &len);
|
|
||||||
|
|
||||||
str = g_strdup_printf("%s%s",sort_sign, hotkey);
|
|
||||||
g_free(hotkey);
|
|
||||||
|
|
||||||
widget_move (&panel->widget, 1, 1);
|
widget_move (&panel->widget, 1, 1);
|
||||||
tty_print_string (str);
|
tty_print_string (str);
|
||||||
|
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user