Hey Bert, have you created an action for your CMP? I'm not sure exactly how you're doing it if you've made it available on every manager page, but normally you would assign a lexicon topic when creating your action (System > Actions > Language Topics).
The lexicon strings would then be available within your JS code like this _('mycmp.lexicon')
-
☆ A M B ☆
- 279 Posts
I've done this by a plugin which is loaded on event OnManagerPageInit
I dont have an action created because there are not specific manager pages for my component
In that case I don't have any further ideas, although it would be nicer to use the native lexicon support rather than the json array.
If I were you I would be looking into the manager files and see how the default lexicons are initialised there, then try and use the same method within your plugin.
-
☆ A M B ☆
- 279 Posts
Thanks Lucas!
I did debug the core files, but there looks like there isn't a way to hook in on that
if anyone else have any idea that would be welcome!
-
☆ A M B ☆
- 279 Posts
Yeah! That's what I do now too!
The $modx->controller->addLexiconTopic('componentname:default'); is indeed working.