>> But as I want to include the i18n-js-code from a standard TG-widget (the >> same way mochikit can be included), I wondered if there is a way for a >> TG-widget to get a referennce to the running projects static directories >> so that I can just add >> >> tg.include_widgets = ['turbogears.js_i18n'] >> >> to app.cfg and then use >> >> /static/javascript/messages-en.js >> >> for the catalog files. > > Where do you want to use that? In the widgets template? In the page > template? Do you want a reference the path of the static directory or > the URL? You can find the path by examining the config object, but this > will fall apart, when your app is installed as a zipped egg.
I want a JS-file with translations included on every page. The same way MochiKit.js is included (or can be) using tg.include_widgets. But because the JS-file is application-specific, I need a way to figure out where to find the applications JS files. But from within TG itself (that is, the widget is _one_ instance in turgogears.*, not one created in the app module) The ZIP-Egg-thingy is not my concern. Because if there is a way to serve static files from zipped eggs, I'm ok. If not - well, no JS could then be served, not just my tranlation files. >> If there is no way, then I'd be interested in any other way to >> default-include a certain widget in every page. > > You could set tg.include_widgets in your code dynamically by modifying > the config object, but I don't know if that's what you're after. Doesn't buy me anything, I need the code _in_ that particular widget to figure out what the current running app is. But I'll try and play around with tg.include_widgets a bit more. > If I understand you correctly, you want a single widget on every page > that loads a JavaScripts file with all translations for all widgets on > the page? Yes. > Wouldn't that go against the encapsulation principle of > widgets? Shouldn't every widget have it's own message translations? What has the one to do with the other? Are you providing message translations for each template/widget instead of one catalog that contains all possible translations? Diez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

