Ticket #3190: 0001-Translate-period-string-properly-SL-3190.patch

File 0001-Translate-period-string-properly-SL-3190.patch, 2.1 KB (added by humitos, 12 years ago)

new version - v2

  • finance.py

    From 9567f18a440089c272a31308130c708486ccbc99 Mon Sep 17 00:00:00 2001
    Message-Id: <9567f18a440089c272a31308130c708486ccbc99.1337607059.git.humitos@gmail.com>
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Mon, 21 May 2012 10:28:37 -0300
    Subject: [PATCH Finance v2 1/2] Translate period string properly SL #3190
    
    Removed concatenation of period strings to allow translators to
    translate the string in the correct way.
    
    Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
    ---
     finance.py |   22 +++++++++++++++++++---
     1 file changed, 19 insertions(+), 3 deletions(-)
    
    diff --git a/finance.py b/finance.py
    index 02c2bf5..7531acd 100644
    a b class Finance(sugar.activity.activity.Activity): 
    451451        self.thisperiodbtn.set_sensitive(next_prev)
    452452        self.nextperiodbtn.set_sensitive(next_prev)
    453453
     454        # This is a HACK to translate the string properly
     455        # http://bugs.sugarlabs.org/ticket/3190
     456        period = self.period.lower()
     457        if period == _('Month').lower():
     458            text_previous_period = _('Previous Month')
     459            text_this_period = _('This Month')
     460            text_next_period = _('Next Month')
     461        elif period == _('Day').lower():
     462            text_previous_period = _('Previous Day')
     463            text_this_period = _('This Day')
     464            text_next_period = _('Next Day')
     465        elif period == _('Year').lower():
     466            text_previous_period = _('Previous Year')
     467            text_this_period = _('This Year')
     468            text_next_period = _('Next Year')
     469
    454470        # Update the label self.period to reflect the period.
    455         self.prevperiodbtn.set_tooltip(_('Previous') + ' ' + self.period)
    456         self.thisperiodbtn.set_tooltip(_('This') + ' ' + self.period)
    457         self.nextperiodbtn.set_tooltip(_('Next') + ' ' + self.period)
     471        self.prevperiodbtn.set_tooltip(text_previous_period)
     472        self.thisperiodbtn.set_tooltip(text_this_period)
     473        self.nextperiodbtn.set_tooltip(text_next_period)
    458474
    459475        # Only add and delete transactions on register screen.
    460476        add_del = self.screens[-1] == self.register