Hello Massimo,

I have one more question about the process of pickle the translation
file...
Do you lock file with "flock"? Or just open the file and close it after the
pickling and applying transformation to the dict is enough to lock the file
during the process?

Is this code correct to not having concurent access problem?? :

f = open("file.dat","wb")
pickle.dump(x,f)
f.close()

f = open("file.dat","rb")
y = pickle.load(f)
f.close()


Thank you

Richard

On Tue, Dec 7, 2010 at 12:17 PM, mdipierro <[email protected]> wrote:
>
> The language files are just python pickles of
> {'original':'translation',...} where original and translation are UTF8
> strings.
> You can open, lock, unpickle, do whatever you need to do, re-pickle,
> unlock, close.
>
> On Dec 7, 11:03 am, Richard Vézina <[email protected]>
> wrote:
> > Hello,
> >
> > I would like to update the different language file for certain entry
with
> > translation contained in database...
> >
> > So I would do something like that :
> >
> > fr-ca.py dict.update(translate_ui_tables_names)
> > or
> > fr-fr.py dict.update(translate_ui_tables_names)
> >
> > But I don't know the name of the the variable name of the different dict
> > that are contained in language files...
> >
> > And since those file are automatically generated I can't just do :
> >
> > fr-ca.py file dict : {key:vaule}.update(translate_ui_tables_names)
> >
> > Where could I add my update to the regular process of web2py?
> >
> > Or trigger a function...
> >
> > Richard
> >
> > On Mon, Dec 6, 2010 at 12:30 PM, Richard Vézina <
[email protected]
> >
> > > wrote:
> > > Hello,
> >
> > > I come with that solution... I would have comment...
> >
> > > I get my translations like this :
> >
> > >
translate_ui_tables_names=dict((r.table_name_en_ui,r.table_name_fr_ui)\
> > >     for r in db().select(db.dict_database.ALL))
> >
> > > Then I just have to :
> >
> > > language translation dict*.append(translate_ui_tables_names)
> >
> > > * Still searching for the name of the dict of the differents language
file
> > > (ex.: fr-ca.py or fr-fr.py)
> >
> > > ;-)
> >
> > > Richard
> >
> >

Reply via email to