Danek Duvall-san wrote (10/24/08 02:17 AM):
> On Wed, Oct 22, 2008 at 11:33:52AM +0100, jmr wrote:
> 
>> http://cr.opensolaris.org/~jmr/um_4126_v1_Oct22/ips_gate.patch
> 
> Makefile:
> 
>   - Why do you cd into po?  I don't see a po directory, either in the
>     current gate or created in your patch.  Should you be moving gui/po to
>     po?

Yes, you need to move it.

> 
> gui/Makefile:
> 
>   - line 171: you can use $(<D) instead of the whole $DIR thing.

OK, I didn't know $(<D).

-+  DIR=`dirname $<`; $(INSTALL) -f $@ -m 0644 $$DIR/legal.xml
++  $(INSTALL) -f $@ -m 0644 $(<D)/legal.xml

> 
> beadmin.py:
> 
>   - line 434: why all the encoding support?  Will date_format ever be
>     non-ASCII?  You don't catch UnicodeError here -- couldn't that be a
>     problem when calling encode()?  Why is all the encoding stuff done here
>     and nowhere else?

The current encoding is supported. Yes, date_format is none-ASCII.
Currently I don't see other visible problems.
Internal encoding is UTF-8 in GNOME applications and input/output encoding is 
the current encoding.
strftime() needs current encoding.

OK, I added LookupError.

@@ -433,20 +434,43 @@ class Beadmin:
                                                      "%a %b %d %H:%M %Y")
                                                  date_tmp2 = \
                                                      
datetime.datetime(*date_tmp[0:5])
+                                                try:
+                                                    date_format = \
+                                                        
unicode(self.parent._("%m/%d/%y %H:%M"), \
+                                                            
"utf-8").encode(locale.getpreferredencoding())
+                                                except (UnicodeError, 
LookupError):
+                                                    print self.parent._("Error 
conversion from UTF-8 to %s.") \
+                                                    % 
locale.getpreferredencoding()
+                                                    date_format = "%F %H:%M"
                                                  date_time = \
-                                                    
date_tmp2.strftime("%m/%d/%y %H:%M")
+                                                    
date_tmp2.strftime(date_format)
                                                  i += 1
                                          except (NameError, ValueError, 
TypeError):
                                                  date_time = None
                                  else:
                                          date_tmp = time.gmtime(be_date)
+                                        try:
+                                                date_format = \
+                                                    
unicode(self.parent._("%m/%d/%y %H:%M"), \
+                                                        
"utf-8").encode(locale.getpreferredencoding())
+                                        except (UnicodeError, LookupError):
+                                            print self.parent._("Error 
conversion from UTF-8 to %s.") \
+                                            % locale.getpreferredencoding()
+                                            date_format = "%F %H:%M"
                                          date_time = \
-                                            time.strftime("%m/%d/%y %H:%M", 
date_tmp)
+                                            time.strftime(date_format, 
date_tmp)
                                  if active:
                                          active_img = self.active_image
                                          self.initial_active = j
                                  if active_boot:
                                          self.initial_default = j
+                                if date_time != None:
+                                        try:
+                                            date_time = unicode(date_time, \
+                                                
locale.getpreferredencoding()).encode("utf-8")
+                                        except (UnicodeError, LookupError):
+                                            print self.parent._("Error 
conversion from %s to UTF-8.") \
+                                            % locale.getpreferredencoding()
                                  self.be_list.insert(j, [j, False, \
                                      name, \
                                      date_time, active_img, \


> 
> image.py:
> 
>   - line 493: remove this comment
> 
>   - line 495: Why is this the only place in all the code you make this
>     change?  There are two other places in this file alone that have the
>     same problem, and I'm sure there are tons of other places in other
>     files.

Because I don't see actual problems in other lines. Currently some translations 
are back and I noticed this line need to change the order.
I don't notice your two places. I mind the problem when the string includes 
more than two %s and gettext().
Yes, potentially you may find other places but I'm thinking the problem from 
the actual translations at the moment.

> 
> misc.py:
> 
>   - line 381: You shouldn't need this -- gettext.install() need only be
>     called once for the process, so once it's in client.py and
>     packagemanager.py, you're done.  In general, your code does a bunch of
>     different things to try to get at the localized text.  In each
>     program's main() or equivalent, you should call gettext.install() with
>     the appropriate arguments, and use _() everywhere else.  But some
>     places you use bindtextdomain() and textdomain() either in addition to
>     or in place of gettext.install(), and you add a "_" member to objects
>     pointing to gettext.gettext() rather than just using the builtin _()
>     function, and in some places you create a N_() method ... it's all over
>     the place.

However the function doesn't have self argument? in bytes_to_str(bytes)
What is your suggestion to get self.parent._() something?

Yes, N_() and _() are needed to get translatable strings with intltool. 
Translatable strings are included in several types, .c, .desktop, .glade, .py, 
.schemas and etc and the simple rule can manage strings easily.
gettext.gettext should be called after gettext is initialized so N_() are used 
for some global values before main() is called.

> 
>   - line 384: Are these symbols really translated?  They're SI standard.

Yes, it needs to be localized in GUI. If it's better to show ASCII in CLI, 
another idea is to move the function from modules/misc.py to 
gui/modules/foo.py

> 
> packagemanager.py:
> 
>   - line 99 et al: you don't need continuation characters inside of parens
>     (or brackets or braces); please remove them in lines you're changing,
>     and clean them up as you encounter them in future fixes.

I may not understand your suggestion. Do you mean the following change?

module.bindtextdomain("pkg", self.application_dir + \
                             "/usr/share/locale")
to

module.bindtextdomain("pkg", "/usr/share/locale")


> 
> updatemanagernotifier.py:
> 
>   - I don't understand this change.  Why is it necessary (other than the
>     /usr/lib to /usr/share change)?  Why is it not consistent across all
>     the programs?
> 

Actually I needed gettext.textdomain().
If it's not called, GUI doesn't show translations as the result.
It seems _current_domain needs to be set with textdomain()

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to