Package turbogears :: Package widgets :: Module i18n :: Class LocalizableJSLink

Class LocalizableJSLink

source code

 object --+                
          |                
base.Widget --+            
              |            
  base.Resource --+        
                  |        
          base.Link --+    
                      |    
            base.JSLink --+
                          |
                         LocalizableJSLink
Known Subclasses:

Provides a simple way to include language-specific data in your JS code.

Language file to use is determined from the user's locale or from the 'language' parameter. If there is no language file for the language (determined via 'supported_languages' parameter) than 'default_language' is used.

Nested Classes

Inherited from base.Widget: __metaclass__

Instance Methods
 
update_params(self, d)
Update the template parameters.
source code

Inherited from base.JSLink: __init__, retrieve_javascript

Inherited from base.Link: __eq__, __hash__

Inherited from base.Widget: __call__, __repr__, __setattr__, adjust_value, display, render, retrieve_css

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Variables
  default_language = 'en'
  supported_languages = ['en']
  params = ['default_language', 'language', 'supported_languages...
  params_doc = {'charset': 'The character encoding of the linked...
  language = <turbogears.widgets.meta.ParamDescriptor object at ...
  template_c = <MarkupTemplate "None">

Inherited from base.JSLink: charset, defer, engine_name, location, template

Inherited from base.Resource: order

Inherited from base.Widget: css, default, javascript, name

Properties

Inherited from base.Widget: is_named

Inherited from object: __class__

Method Details

update_params(self, d)

source code 

Update the template parameters.

This method will have the last chance to update the variables sent to the template for the specific request. All parameters listed at class attribute 'params' will be available at the 'params' dict this method receives.

*Must* call super(MyWidget, self).update_params(params) cooperatively, unless, of course, your know what you're doing. Preferably this should be done before any actual work is done in the method.

Overrides: base.Widget.update_params
(inherited documentation)

Class Variable Details

params

Value:
['default_language',
 'language',
 'supported_languages',
 'charset',
 'defer',
 'order']

params_doc

Value:
{'charset': 'The character encoding of the linked script',
 'default_language': 'language code to use if specified language is no\
t supported',
 'defer': 'If true, browser may defer execution of the script',
 'language': 'language code to use  (overrides user locale setting whi\
ch is the default)',
 'order': 'JS and CSS are sorted in this \'order\' at render time',
 'supported_languages': 'list of supported language codes (which means\
...

language

Value:
<turbogears.widgets.meta.ParamDescriptor object at 0x7f0d121d28d0>