From dbd9ce25f075143b77011b59e48681bae0e971a7 Mon Sep 17 00:00:00 2001 From: tokul Date: Tue, 30 May 2006 16:30:00 +0000 Subject: [PATCH] translating folder names in selection box. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11172 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 41 +++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index e7da70c2..d8eecb28 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -658,7 +658,11 @@ function sqimap_mailbox_parse ($line) { */ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, $flag = 'noselect', $use_long_format = false ) { - global $username, $data_dir; + global $username, $data_dir, $translate_special_folders, $sent_folder, + $trash_folder, $draft_folder; + + $delimiter = sqimap_get_delimiter($imap_stream); + $mbox_options = ''; if ( $use_long_format ) { $shorten_box_names = 0; @@ -688,10 +692,39 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk switch ($shorten_box_names) { case 2: /* delimited, style = 2 */ - $box2 = str_replace('  ', '. ', htmlspecialchars($boxes_part['formatted'])); + if ($translate_special_folders && $boxes_part['unformatted-dm']==$sent_folder) { + /* + * calculate pad level from number of delimiters. do it inside if control in order + * to reduce number of calculations. Other folders don't need it. + */ + $pad = str_pad('',7 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'. '); + // i18n: Name of Sent folder + $box2 = $pad . _("Sent"); + } elseif ($translate_special_folders && $boxes_part['unformatted-dm']==$trash_folder) { + $pad = str_pad('',7 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'. '); + // i18n: Name of Trash folder + $box2 = $pad . _("Trash"); + } elseif ($translate_special_folders && $boxes_part['unformatted-dm']==$draft_folder) { + $pad = str_pad('',7 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'. '); + // i18n: Name of Drafts folder + $box2 = $pad . _("Drafts"); + } else { + $box2 = str_replace('  ', '. ', htmlspecialchars($boxes_part['formatted'])); + } break; case 1: /* indent, style = 1 */ - $box2 = str_replace('  ', '  ', htmlspecialchars($boxes_part['formatted'])); + if ($translate_special_folders && $boxes_part['unformatted-dm']==$sent_folder) { + $pad = str_pad('',12 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'  '); + $box2 = $pad . _("Sent"); + } elseif ($translate_special_folders && $boxes_part['unformatted-dm']==$trash_folder) { + $pad = str_pad('',12 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'  '); + $box2 = $pad . _("Trash"); + } elseif ($translate_special_folders && $boxes_part['unformatted-dm']==$draft_folder) { + $pad = str_pad('',12 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'  '); + $box2 = $pad . _("Drafts"); + } else { + $box2 = str_replace('  ', '  ', htmlspecialchars($boxes_part['formatted'])); + } break; default: /* default, long names, style = 0 */ $box2 = str_replace(' ', ' ', htmlspecialchars(imap_utf7_decode_local($boxes_part['unformatted-disp']))); @@ -1329,5 +1362,3 @@ function sqimap_mailbox_is_noinferiors($oImapStream,$sImapFolder,&$oBoxes) { } return false; } - -?> -- 2.25.1