add section about overriding the locales in the docs; make an example of how to override the locales

This commit is contained in:
Artur Barseghyan 2018-02-19 20:55:14 +01:00
parent 4c822d2855
commit fa78cd7f21
7 changed files with 134 additions and 29 deletions

View file

@ -97,7 +97,14 @@ Roadmap
======= =======
Some of the upcoming/in-development features/improvements are: Some of the upcoming/in-development features/improvements are:
- Bootstrap 4 and Foundation 6 support (in version 0.13). - Implement disabling forms based on dates.
- Class based views.
- Cloning of forms.
- JSON schema support.
- Webpack integration.
- Improved Django REST framework OPTIONS.
- Bootstrap 4 support.
- Foundation 6 support.
See the `TODOS See the `TODOS
<https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/TODOS.rst>`_ <https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/TODOS.rst>`_
@ -2173,13 +2180,39 @@ imports should go smoothly. It is though possible to make an import ignoring
missing form element and form handler plugins. You would get an appropriate missing form element and form handler plugins. You would get an appropriate
notice about that, but import will continue leaving the broken plugin data out. notice about that, but import will continue leaving the broken plugin data out.
Translations
============
Available translations Available translations
====================== ----------------------
English is the primary language. English is the primary language. The following translations are
available (core and plugins)
- `Dutch <https://django-fobi.herokuapp.com/nl/>`_ (core and plugins) - `Dutch <https://django-fobi.herokuapp.com/nl/>`_
- `German <https://django-fobi.herokuapp.com/de/>`_ (core and plugins) - `German <https://django-fobi.herokuapp.com/de/>`_
- `Russian <https://django-fobi.herokuapp.com/ru/>`_ (core and plugins) - `Russian <https://django-fobi.herokuapp.com/ru/>`_
- `French <https://django-fobi.herokuapp.com/fr/>`_ (not yet released)
Overriding translations
-----------------------
There might be cases if you wish to override certain translations. This can
be done very easily by introducing of a custom locale path in your project.
See the following as a good example of overriding some English labels.
`custom settings
<https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/examples/simple/settings/alternative_labels.py>`__
`custom locales directory
<https://github.com/barseghyanartur/django-fobi/tree/master/examples/simple/fobi_locale/>`__
Run the example project as follows:
.. code-block:: sh
cd examples/simple/
./manage.py runserver --settings=settings.alternative_labels
In the example given, "Boolean" and "Checkbox select multiple" plugin names
are renamed to "Checkbox" and "Multiple checkboxes" respectively.
Debugging Debugging
========= =========

View file

@ -3,16 +3,25 @@ Roadmap
======= =======
Upcoming releases road-map. Upcoming releases road-map.
unscheduled See the `issues <https://github.com/barseghyanartur/django-fobi/issues>`_.
-----------
yyyy-mm-dd (future).
.. note::
If you need any of the below mentioned features or any features mentioned
in the issues sooner than they appear, consider sponsoring releases of
the desired features. Mail me for the details.
Unscheduled
-----------
The following issues/features are planned to be implemented/solved in the
upcoming releases.
- Implement disabling forms based on dates.
- Class based views.
- Cloning of forms.
- JSON schema support.
- Webpack integration.
- Improved Django REST framework OPTIONS.
- Bootstrap 4 support. - Bootstrap 4 support.
- Foundation 6 support. - Foundation 6 support.
- The "simple" theme would be renamed to "django_admin_style".
unscheduled
-----------
This release contains minor backwards incompatible changes, related to the
change of the name of the "simple" theme into "django_admin_style" theme.
- The "simple" theme has been renamed to "django_admin_style".

View file

@ -97,7 +97,14 @@ Roadmap
======= =======
Some of the upcoming/in-development features/improvements are: Some of the upcoming/in-development features/improvements are:
- Bootstrap 4 and Foundation 6 support (in version 0.13). - Implement disabling forms based on dates.
- Class based views.
- Cloning of forms.
- JSON schema support.
- Webpack integration.
- Improved Django REST framework OPTIONS.
- Bootstrap 4 support.
- Foundation 6 support.
See the `TODOS See the `TODOS
<https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/TODOS.rst>`_ <https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/TODOS.rst>`_
@ -2173,13 +2180,39 @@ imports should go smoothly. It is though possible to make an import ignoring
missing form element and form handler plugins. You would get an appropriate missing form element and form handler plugins. You would get an appropriate
notice about that, but import will continue leaving the broken plugin data out. notice about that, but import will continue leaving the broken plugin data out.
Translations
============
Available translations Available translations
====================== ----------------------
English is the primary language. English is the primary language. The following translations are
available (core and plugins)
- `Dutch <https://django-fobi.herokuapp.com/nl/>`_ (core and plugins) - `Dutch <https://django-fobi.herokuapp.com/nl/>`_
- `German <https://django-fobi.herokuapp.com/de/>`_ (core and plugins) - `German <https://django-fobi.herokuapp.com/de/>`_
- `Russian <https://django-fobi.herokuapp.com/ru/>`_ (core and plugins) - `Russian <https://django-fobi.herokuapp.com/ru/>`_
- `French <https://django-fobi.herokuapp.com/fr/>`_ (not yet released)
Overriding translations
-----------------------
There might be cases if you wish to override certain translations. This can
be done very easily by introducing of a custom locale path in your project.
See the following as a good example of overriding some English labels.
`custom settings
<https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/examples/simple/settings/alternative_labels.py>`__
`custom locales directory
<https://github.com/barseghyanartur/django-fobi/tree/master/examples/simple/fobi_locale/>`__
Run the example project as follows:
.. code-block:: sh
cd examples/simple/
./manage.py runserver --settings=settings.alternative_labels
In the example given, "Boolean" and "Checkbox select multiple" plugin names
are renamed to "Checkbox" and "Multiple checkboxes" respectively.
Debugging Debugging
========= =========

Binary file not shown.

View file

@ -0,0 +1,29 @@
# `django-fobi` example locale overrides.
# Copyright (C) 2014-2018 Artur Barseghyan
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <artur.barseghyan@gmail.com>, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-19 13:21-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Artur Barseghyan <artur.barseghyan@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: English \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: contrib/apps/drf_integration/form_elements/fields/boolean/base.py:27
#: contrib/plugins/form_elements/fields/boolean/base.py:20
#: contrib/apps/drf_integration/form_elements/fields/boolean/base.py:27
#: contrib/plugins/form_elements/fields/boolean/base.py:20
msgid "Boolean"
msgstr "Checkbox"
#: contrib/apps/drf_integration/form_elements/fields/checkbox_select_multiple/base.py:30
#: contrib/plugins/form_elements/fields/checkbox_select_multiple/base.py:27
msgid "Checkbox select multiple"
msgstr "Multiple checkboxes"

View file

@ -0,0 +1,8 @@
import os
from .base import *
LOCALE_PATHS = [
os.path.abspath(os.path.join(BASE_DIR, 'fobi_locale')),
# os.path.abspath(os.path.join(BASE_DIR, 'locale')),
]
# import ipdb; ipdb.set_trace()

View file

@ -22,13 +22,6 @@ __license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('FobiCoreTest',) __all__ = ('FobiCoreTest',)
__title__ = 'fobi.tests.test_core'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2016 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('FobiCoreTest',)
class FobiCoreTest(TestCase): class FobiCoreTest(TestCase):
"""Tests of django-fobi core functionality.""" """Tests of django-fobi core functionality."""