[haiku-bugs] Re: [Haiku] #6113: Locale Kit needs a way to load catalogs from libraries

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Fri, 04 Jun 2010 21:48:37 -0000

#6113: Locale Kit needs a way to load catalogs from libraries
-----------------------------+----------------------------------------------
 Reporter:  zooey            |       Owner:  pulkomandy    
     Type:  bug              |      Status:  assigned      
 Priority:  normal           |   Milestone:  R1            
Component:  Kits/Locale Kit  |     Version:  R1/Development
 Keywords:                   |    Platform:  All           
Blockedby:                   |       Patch:  0             
 Blocking:  5889             |  
-----------------------------+----------------------------------------------

Comment(by bonefish):

 A few suggestions: I would get rid of `be_catalog` and `be_app_catalog`.
 Global variables are evil. Static accessors can be used instead. This also
 allows for lazy initialization. The static accessor method for the catalog
 of the current shared object would not live in liblocale.so, but in a
 static library any shared object that wants to use translations needs to
 link against. It would look like:
 {{{
 static BCatalog sCatalog;
 static vint32 sCatalogInitOnce;


 /*static*/ BCatalog*
 BCatalog::CurrentCatalog()
 {
         return _CurrentCatalog(&sCatalog, &sCatalogInitOnce);
 }
 }}}

 `_CurrentCatalog()` can live in liblocale.so. Using the given address it
 can easily find out for which shared object to load the catalog. For users
 preferring explicit initialization a respective method returning an error
 code could be added as well.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6113#comment:5>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: