mirror of
https://github.com/odoo/documentation.git
synced 2026-01-04 02:36:32 +07:00
[IMP] developer: add information on bus (js)
and move the section on environment to the framework main documentation
page.
closes odoo/documentation#1237
X-original-commit: 05ab4a7b0a
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit is contained in:
@@ -101,39 +101,6 @@ the ``owl`` attribute set to 1.
|
||||
|
||||
Template names should follow the convention `addon_name.ComponentName`.
|
||||
|
||||
Environment
|
||||
===========
|
||||
|
||||
The Odoo web client is an Owl application, with its own environment (components
|
||||
can access it using ``this.env``). Here is a description of what Odoo adds to
|
||||
the shared ``env`` object:
|
||||
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
| Key | Value |
|
||||
+==============+===============================================================================+
|
||||
| ``qweb`` | required by Owl (contains all templates) |
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
| ``bus`` | main bus, used to coordinate some generic events |
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
| ``services`` | all deployed services (should usually be accessed with the `useService` hook) |
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
| ``debug`` | boolean. If true, the web client is in ``debug`` mode |
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
| ``_t`` | translation function |
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
| ``isSmall`` | boolean. If true, the web client is currently in mobile mode |
|
||||
+--------------+-------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
So, for example, to translate a string in a component (note: templates are
|
||||
automatically translated, so no specific action is required in that case), one
|
||||
can do this:
|
||||
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
const someString = this.env._t('some text');
|
||||
|
||||
|
||||
.. seealso::
|
||||
- `Owl Repository <https://github.com/odoo/owl>`_
|
||||
|
||||
Reference in New Issue
Block a user