static char*
getShortTransferString( const tr_stat * torStat,
                        char *          buf,
                        size_t          buflen )
{
    char      downStr[32], upStr[32];
    const int haveDown = torStat->peersSendingToUs > 0;
    const int haveUp = torStat->peersGettingFromUs > 0;

    if( haveDown )
        tr_strlspeed( downStr, torStat->pieceDownloadSpeed, sizeof( downStr ) );
    if( haveUp )
        tr_strlspeed( upStr, torStat->pieceUploadSpeed, sizeof( upStr ) );

    if( haveDown && haveUp )
        /* Translators: do not translate the "speed|" disambiguation prefix.
           %1$s is the download speed
           %2$s is the upload speed */
        g_snprintf( buf, buflen, Q_(
                        "speed|Down: %1$s, Up: %2$s" ), downStr, upStr );
    else if( haveDown )
        /* download speed */
        g_snprintf( buf, buflen, _( "Down: %s" ), downStr );
    else if( haveUp )
        /* upload speed */
        g_snprintf( buf, buflen, _( "Up: %s" ), upStr );
    else
        /* the torrent isn't uploading or downloading */
        g_strlcpy( buf, _( "Idle" ), buflen );

    return buf;
}
static char*
getShortTransferString( const tr_torrent  * tor,
                        const tr_stat     * torStat,
                        double              uploadSpeed,
                        double              downloadSpeed,
                        char              * buf,
                        size_t              buflen )
{
    char downStr[32], upStr[32];
    const int haveMeta = tr_torrentHasMetadata( tor );
    const int haveDown = haveMeta && torStat->peersSendingToUs > 0;
    const int haveUp = haveMeta && torStat->peersGettingFromUs > 0;

    if( haveDown )
        tr_strlspeed( downStr, downloadSpeed, sizeof( downStr ) );
    if( haveUp )
        tr_strlspeed( upStr, uploadSpeed, sizeof( upStr ) );

    if( haveDown && haveUp )
        /* 1==down speed, 2==down arrow, 3==up speed, 4==down arrow */
        g_snprintf( buf, buflen, _( "%1$s %2$s, %3$s %4$s" ),
                    gtr_get_unicode_string( GTR_UNICODE_DOWN ), downStr,
                    gtr_get_unicode_string( GTR_UNICODE_UP ), upStr );
    else if( haveDown )
        /* bandwidth speed + unicode arrow */
        g_snprintf( buf, buflen, _( "%1$s %2$s" ),
                    gtr_get_unicode_string( GTR_UNICODE_DOWN ), downStr );
    else if( haveUp )
        /* bandwidth speed + unicode arrow */
        g_snprintf( buf, buflen, _( "%1$s %2$s" ),
                    gtr_get_unicode_string( GTR_UNICODE_UP ), upStr );
    else if( tr_torrentHasMetadata( tor ) )
        /* the torrent isn't uploading or downloading */
        g_strlcpy( buf, _( "Idle" ), buflen );
    else
        *buf = '\0';

    return buf;
}