Hi Diez,

I'm not sure what your problem is...

Diez B. Roggisch schrieb:
> so far, I 
> refered to JS for my widgets like this:
> 
> js_dir = pkg_resources.resource_filename("i18ntest",
>                                           "static/javascript")
> w.register_static_directory("i18ntest", js_dir)
> 
> test_js = w.JSLink("i18ntest", "test.js")

Yes, that is the canonical way.

> 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.

> 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.

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? Wouldn't that go against the encapsulation principle of
widgets? Shouldn't every widget have it's own message translations?

Chris

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to