105 """generate a pot file with schema specific i18n messages |
105 """generate a pot file with schema specific i18n messages |
106 |
106 |
107 notice that relation definitions description and static vocabulary |
107 notice that relation definitions description and static vocabulary |
108 should be marked using '_' and extracted using xgettext |
108 should be marked using '_' and extracted using xgettext |
109 """ |
109 """ |
110 from cubicweb.cwvreg import CubicWebVRegistry |
110 from cubicweb.cwvreg import CWRegistryStore |
111 if cubedir: |
111 if cubedir: |
112 cube = osp.split(cubedir)[-1] |
112 cube = osp.split(cubedir)[-1] |
113 config = DevConfiguration(cube) |
113 config = DevConfiguration(cube) |
114 depcubes = list(config._cubes) |
114 depcubes = list(config._cubes) |
115 depcubes.remove(cube) |
115 depcubes.remove(cube) |
117 else: |
117 else: |
118 config = DevConfiguration() |
118 config = DevConfiguration() |
119 cube = libconfig = None |
119 cube = libconfig = None |
120 cleanup_sys_modules(config) |
120 cleanup_sys_modules(config) |
121 schema = config.load_schema(remove_unused_rtypes=False) |
121 schema = config.load_schema(remove_unused_rtypes=False) |
122 vreg = CubicWebVRegistry(config) |
122 vreg = CWRegistryStore(config) |
123 # set_schema triggers objects registrations |
123 # set_schema triggers objects registrations |
124 vreg.set_schema(schema) |
124 vreg.set_schema(schema) |
125 w(DEFAULT_POT_HEAD) |
125 w(DEFAULT_POT_HEAD) |
126 _generate_schema_pot(w, vreg, schema, libconfig=libconfig) |
126 _generate_schema_pot(w, vreg, schema, libconfig=libconfig) |
127 |
127 |
136 w('# \n') |
136 w('# \n') |
137 w('# singular and plural forms for each entity type\n') |
137 w('# singular and plural forms for each entity type\n') |
138 w('\n') |
138 w('\n') |
139 vregdone = set() |
139 vregdone = set() |
140 if libconfig is not None: |
140 if libconfig is not None: |
141 from cubicweb.cwvreg import CubicWebVRegistry, clear_rtag_objects |
141 from cubicweb.cwvreg import CWRegistryStore, clear_rtag_objects |
142 libschema = libconfig.load_schema(remove_unused_rtypes=False) |
142 libschema = libconfig.load_schema(remove_unused_rtypes=False) |
143 afs = deepcopy(uicfg.autoform_section) |
143 afs = deepcopy(uicfg.autoform_section) |
144 appearsin_addmenu = deepcopy(uicfg.actionbox_appearsin_addmenu) |
144 appearsin_addmenu = deepcopy(uicfg.actionbox_appearsin_addmenu) |
145 clear_rtag_objects() |
145 clear_rtag_objects() |
146 cleanup_sys_modules(libconfig) |
146 cleanup_sys_modules(libconfig) |
147 libvreg = CubicWebVRegistry(libconfig) |
147 libvreg = CWRegistryStore(libconfig) |
148 libvreg.set_schema(libschema) # trigger objects registration |
148 libvreg.set_schema(libschema) # trigger objects registration |
149 libafs = uicfg.autoform_section |
149 libafs = uicfg.autoform_section |
150 libappearsin_addmenu = uicfg.actionbox_appearsin_addmenu |
150 libappearsin_addmenu = uicfg.actionbox_appearsin_addmenu |
151 # prefill vregdone set |
151 # prefill vregdone set |
152 list(_iter_vreg_objids(libvreg, vregdone)) |
152 list(_iter_vreg_objids(libvreg, vregdone)) |