Hello,
I have a module that uses cbi18n, and the box.json file is in the dependencies part like this
`
…
“dependencies”:{
“cbi18n”:“1.0.2”,
“cbstorages”:“1.0.0”,
“cbmessagebox”:“1.0.0”,
“cbcommons”:“1.1.0”
},
“devDependencies”:{
“cbdebugger”:“1.1.0”
},
“installPaths”:{
“cbi18n”:“modules/cb-bundle/cbi18n”,
“cbdebugger”:“modules/cb-bundle/cbdebugger”,
“cbstorages”:“modules/cb-bundle/cbstorages”,
“cbmessagebox”:“modules/cb-bundle/cbmessagebox”,
“cbcommons”:“modules/cb-bundle/cbcommons”
}, …
`
Then in commandbox if I type install all those modules get installed in the specified cb-bundle directory and everything works fine, the i18n structure in the moduleConfig.cfc looks like this
`
i18n = {
// The base path of the default resource bundle to load
defaultResourceBundle = “#modulePath#/includes/i18n/canvas”,
// The default locale of the application valid es_MX|en_US
defaultLocale = “en_US”,//es_MX
// The storage to use for user’s locale: session, client, cookie, request
localeStorage = “cookie”,
// The value to show when a translation is not found
unknownTranslation = “NOT FOUND”,
}
`
Now, I have a second module that dependes on cbORM to perform some initial setup insertions in the db, and it has a chain of dependencies cbORM → cbValidation → cbi18n
When in commandbox you type install, those 3 modules get installed, then if I run the application I get this error
The LocaleStorage setting cannot be found. Please make sure you create the i18n elements.
and I can see the path to the cfc that is throwing the exception is this
modules/cborm/modules/cbvalidation/modules/cbi18n/models/i18n.cfc:102):102
Both modules have their i18n structure and in the config.cfc there is one too, why is not loading the settings?.
If I exclude the second module from loading in the app, the first one works fine, I think the reason is that the i18n module is duplicated because it was already installed with the first module, and the second module installed it automatically according to the dependencies.
If I delete the i18n folder inside cborm.cbvalidation I get this error.
The module has not been registered, register the module first and then activate it.
- In the first module I had to write these lines in the onLoad method to avoid errors like the last one.
`
controller.getModuleService().registerAndActivateModule(‘cbmessagebox’,’#this.cfmapping#.modules.cb-bundle’);
controller.getModuleService().registerAndActivateModule(‘cbi18n’,’#this.cfmapping#.modules.cb-bundle’);
controller.getModuleService().registerAndActivateModule(‘cbdebugger’,’#this.cfmapping#.modules.cb-bundle’);
`
What would be the best way to avoid this duplicity, to check if the module cbi18n (or any other module) is already installed and avoid reinstallation in a subfolder.?
Thanks,
Angel Chrystian Torres