Changeset 5738

Show
Ignore:
Timestamp:
11/20/08 18:20:51 (2 months ago)
Author:
faide
Message:

cleanup and docs. Preparing to get some more tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/turbogears/i18n/sogettext/__init__.py

    r5719 r5738  
    5656    return catalog 
    5757 
     58def create_so_catalog_tables(): 
     59    """create the tables if needed 
     60    """ 
     61    TG_Message.dropTable(ifExists=True) 
     62    TG_Domain.dropTable(ifExists=True) 
     63 
     64    TG_Domain.createTable(ifNotExists=True) 
     65    TG_Message.createTable(ifNotExists=True) 
     66 
    5867def create_so_catalog(locales, domain): 
    5968    """ 
     
    6170    GNU message catalog 
    6271    """ 
     72    # first try to create the table if we need to... 
     73    create_so_catalog_tables() 
    6374 
    64     TG_Message.dropTable(ifExists=True) 
    65     TG_Domain.dropTable(ifExists=True) 
    66  
    67     TG_Domain.createTable(ifNotExists=True) 
    68     TG_Message.createTable(ifNotExists=True) 
    6975    localedir = turbogears.config.get("i18n.locale_dir", "locales") 
    7076 
     
    7682 
    7783    for locale in locales: 
    78         translations = translation( 
    79                 domain=domain.name, 
    80                 localedir=localedir, 
     84        translations = translation(domain=domain.name, localedir=localedir, 
    8185                languages=[locale]) 
    8286        catalog = translations._catalog 
     87 
    8388        for k, v in catalog.items(): 
    84  
    8589            TG_Message(domain=domain, locale=locale, name=k, text=v) 
    8690