Hello Massimo, I would like to update the languages files at startup or once in a wild...
Where should I put those lines : # ----------------------------------------------------------------------------- import os import gluon.portalocker import cPickle from gluon.languages import read_dict, read_dict_aux, utf8_repr, write_dict from gluon.cfs import getcfs # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- language = 'fr-ca' application_path = request.application path = os.path.join('applications', application_path, 'languages/') # Enlever 'applications' lorsque transféré dans application.... filename = os.path.join(path, '%s.py' % language) language_fr_ca = read_dict(filename) # read_dict() est une fonction de langugages.py et nécessite getcfs dict_database_ui_en_fr = db(db.dict_database.table_name_en_ui != None)\ .select(db.dict_database.table_name_en_ui.name, db.dict_database.table_name_fr_ui.name, distinct=True) #dict_new = {} #for row in dict_database_ui_en_fr: # dict_new[row['table_name_en_ui']] = row['table_name_fr_ui'] #dict((row['table_name_en_ui'],row['table_name_fr_ui']) for row in dict_database_ui_en_fr) # Replace the above 3 lines of code language_fr_ca.update(dict((row['table_name_en_ui'],row['table_name_fr_ui']) for row in dict_database_ui_en_fr)) # Replace the above 4 lines of code # ----------------------------------------------------------------------------- write_dict(filename, language_fr_ca) # ----------------------------------------------------------------------------- In model, controller with a action button to trigger it? I do believe that fr-ca.py language file is locked during the read and write operation since I use the imported read_dict and write_dict function from gluon.languages... Can you confirmed this? Thanks I appreciate. Richard