From d80f2a716bab0e727fde2c477d1e580047423445 Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Tue, 18 Nov 2014 13:53:20 +0100 Subject: [IMP] doc: try to clarify what $as is in qweb doc --- doc/reference/qweb.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/reference') diff --git a/doc/reference/qweb.rst b/doc/reference/qweb.rst index 47a4d0a2774..08170da0d23 100644 --- a/doc/reference/qweb.rst +++ b/doc/reference/qweb.rst @@ -129,7 +129,9 @@ value), a mapping (the current item will be the current key) or an integer integer exclusive). In addition to the name passed via ``t-as``, ``foreach`` provides a few other -variables for various data points (``$as`` is the name passed to ``t-as``): +variables for various data points: + +.. warning:: ``$as`` will be replaced by the name passed to ``t-as`` :samp:`{$as}_all` the object being iterated over -- cgit v1.2.3 From 53bfc709e774aae76d1e8d6ab26c0761a1d5f3ae Mon Sep 17 00:00:00 2001 From: Henri-Maxime Ducoulombier Date: Wed, 19 Nov 2014 16:24:28 +0100 Subject: [IMP] doc: incorrect value documented closes #3761 --- doc/reference/views.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/reference') diff --git a/doc/reference/views.rst b/doc/reference/views.rst index 9eaab61b324..3f5b2ea2043 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -85,8 +85,8 @@ There are three types of inheritance specs: * any other element, the first element with the same name and identical attributes (ignoring ``position``) is matched -The inheritance spec can an optional ``position`` attribute specifhing how -the matched node should be altered: +The inheritance spec may have an optional ``position`` attribute specifying +how the matched node should be altered: ``inside`` (default) the content of the inheritance spec is appended to the matched node @@ -98,7 +98,7 @@ the matched node should be altered: ``before`` the content of the inheritance spec is added to the matched node's parent, before the matched node -``attribute`` +``attributes`` the content of the inheritance spec should be ``attribute`` elements with a ``name`` attribute and an optional body: -- cgit v1.2.3 From ec7736a0515c81f96154d7cabcefb69c19e6a57d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Nov 2014 08:52:38 +0100 Subject: [ADD] ws doc: introspection, reports and workflows * use static imports in java examples to make them terser * inline ``domain`` in java and php example to make examples more self-contained * try to extend/improve Model.write's docstring * add convenience kwarg to fields_get, mostly for user-driven introspection Closes #3689 --- doc/reference/security.rst | 2 ++ doc/reference/workflows.rst | 2 ++ 2 files changed, 4 insertions(+) (limited to 'doc/reference') diff --git a/doc/reference/security.rst b/doc/reference/security.rst index 72742f0639c..05ca9079fb7 100644 --- a/doc/reference/security.rst +++ b/doc/reference/security.rst @@ -71,6 +71,8 @@ This means the first *group rule* restricts access, but any further although access rules do +.. _reference/security/fields: + Field Access ============ diff --git a/doc/reference/workflows.rst b/doc/reference/workflows.rst index 210213e5f55..a6890f05ab6 100644 --- a/doc/reference/workflows.rst +++ b/doc/reference/workflows.rst @@ -284,6 +284,8 @@ defined (in addition to the Odoo ``safe_eval`` environment): - all the model column names, and - all the browse record's attributes. +.. _reference/workflows/signals: + Signals ''''''' -- cgit v1.2.3 From cb9ff8c6308d8e18a9329371107a375028b4f8e4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 28 Nov 2014 12:14:22 +0100 Subject: [ADD] doc: debug flag --- doc/reference/cmdline.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/reference') diff --git a/doc/reference/cmdline.rst b/doc/reference/cmdline.rst index 1ec7d96ae9d..e0713410981 100644 --- a/doc/reference/cmdline.rst +++ b/doc/reference/cmdline.rst @@ -54,6 +54,12 @@ Running the server runs tests after installing modules +.. option:: --debug + + when an unexpected error is raised (not a warning or an access error), + automatically starts :mod:`python:pdb` before logging and returning the + error + .. _reference/cmdline/scaffold: Scaffolding -- cgit v1.2.3 From 4d6fb49b8f9a18d01b6d17defa21ea1c97940a23 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Thu, 27 Nov 2014 10:35:07 +0100 Subject: [IMP] doc: move translations to reference documentation --- doc/reference/translations.rst | 96 +++++++++++++++++++++++++++++++ doc/reference/translations/po-export.png | Bin 0 -> 6069 bytes 2 files changed, 96 insertions(+) create mode 100644 doc/reference/translations.rst create mode 100644 doc/reference/translations/po-export.png (limited to 'doc/reference') diff --git a/doc/reference/translations.rst b/doc/reference/translations.rst new file mode 100644 index 00000000000..45616189c0d --- /dev/null +++ b/doc/reference/translations.rst @@ -0,0 +1,96 @@ +.. _reference/translations: + +=================== +Translating Modules +=================== + +Exporting translatable term +=========================== + +A number of terms in your modules are "implicitly translatable" as a result, +even if you haven't done any specific work towards translation you can export +your module's translatable terms and may find content to work with. + +.. todo:: needs technical features + +Translations export is done via the administration interface by logging into +the backend interface and opening :menuselection:`Settings --> Translations +--> Import / Export --> Export Translations` + +* leave the language to the default (new language/empty template) +* select the `PO File`_ format +* select your module +* click :guilabel:`Export` and download the file + +.. image:: translations/po-export.* + :align: center + :width: 75% + +This gives you a file called :file:`{yourmodule}.pot` which should be moved to +the :file:`{yourmodule}/i18n/` directory. The file is a *PO Template* which +simply lists translatable strings and from which actual translations (PO files) +can be created. PO files can be created using msginit_, with a dedicated +translation tool like POEdit_ or by simply copying the template to a new file +called :file:`{language}.po`. Translation files should be put in +:file:`{yourmodule}/i18n/`, next to :file:`{yourmodule}.pot`, and will be +automatically loaded by Odoo when the corresponding language is installed (via +:menuselection:`Settings --> Translations --> Load a Translation`) + +.. note:: translations for all loaded languages are also installed or updated + when installing or updating a module + +Implicit exports +================ + +Odoo automatically exports translatable strings from "data"-type content: + +* in non-QWeb views, all text nodes are exported as well as the content of + the ``string``, ``help``, ``sum``, ``confirm`` and ``placeholder`` + attributes +* QWeb templates (both server-side and client-side), all text nodes are + exported except inside ``t-translation="off"`` blocks, the content of the + ``title``, ``alt``, ``label`` and ``placeholder`` attributes are also + exported +* for :class:`~openerp.fields.Field`, unless their model is marked with + ``_translate = False``: + + * their ``string`` and ``help`` attributes are exported + * if ``selection`` is present and a list (or tuple), it's exported + * if their ``translate`` attribute is set to ``True``, all of their existing + values (across all records) are exported +* help/error messages of :attr:`~openerp.models.Model._constraints` and + :attr:`~openerp.models.Model._sql_constraints` are exported + +Explicit exports +================ + +When it comes to more "imperative" situations in Python code or Javascript +code, Odoo is not able to automatically export translatable terms and they +must be marked explicitly for export. This is done by wrapping a literal +string in a function call. + +In Python, the wrapping function is :func:`openerp._`:: + + title = _("Bank Accounts") + +In JavaScript, the wrapping function is generally :js:func:`openerp.web._t`: + +.. code-block:: javascript + + title = _t("Bank Accounts") + +.. warning:: + + Only literal strings can be marked for exports, not expressions and not + variables. For situations where strings are formatted, this means the + format string must be marked, not the formatted string:: + + # bad, the extract may work but it will not correctly translate the text + _("Scheduled meeting with %s" % invitee.name) + + # good + _("Scheduled meeting with %s") % invitee.name + +.. _PO File: http://en.wikipedia.org/wiki/Gettext#Translating +.. _msginit: http://www.gnu.org/software/gettext/manual/gettext.html#Creating +.. _POEdit: http://poedit.net/ diff --git a/doc/reference/translations/po-export.png b/doc/reference/translations/po-export.png new file mode 100644 index 00000000000..82f8d5ad011 Binary files /dev/null and b/doc/reference/translations/po-export.png differ -- cgit v1.2.3