Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar committed Feb 7, 2015
1 parent 2f4622f commit 0514617
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 94 deletions.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/i18n.doctree
Binary file not shown.
58 changes: 27 additions & 31 deletions docs/_build/html/_sources/i18n.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,45 @@ F.A.B. has support for seven languages (planning for some more):
- Russian
- German

This means that all messages, views and menus generated from the framework can be translated to these languages.
This means that all messages, builtin on the framework are translated to these languages.

You can add your own translations for your application, using Flask-BabelPkg, this is a fork from Flask-Babel, created because it was not possible to separate package translations from the application translations.
You can add your own translations for your application, using Flask-BabelPkg, this is a fork from Flask-Babel,
created because it was not possible to separate package translations from the application translations.

You can add your own translations, and your own language support. Take a look at `Flask-Babel <http://pythonhosted.org/Flask-Babel>`_ for setup an babel initial configuration.
You can add your own translations, and your own language support.
Take a look at `Flask-Babel <http://pythonhosted.org/Flask-Babel>`_ for setup an babel initial configuration.

Babel Quick How to Config
-------------------------
Initial Configuration
---------------------

On you projects root create a directory named babel, then create and edit a file named babel.cfg with the following content::
On you projects root create a directory named babel,
then create and edit a file named babel.cfg with the following content (this configuration is already made on the
base skeleton application)::

[python: **.py]
[jinja2: **/templates/**.html]
encoding = utf-8

Next extract your strings to be translated, execute on you projects root::

$ fabmanager extract

If you want to, or if your using a version prior to 1.3.0 you can use::

pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .

Finaly create your translations, for example to portuguese, spanish and german, execute on you projects root::

pybabel init -i ./babel/messages.pot -d app/translations -l de
Finally create your translations, for example to portuguese, spanish and german, execute on you projects root::

pybabel init -i ./babel/messages.pot -d app/translations -l pt
pybabel init -i ./babel/messages.pot -d app/translations -l es
pybabel init -i ./babel/messages.pot -d app/translations -l de

If your using Flask-AppBuilder-Skeleton use the provided script::

./babel_init.sh pt
./babel_init.sh es
./babel_init.sh de

Quick How to
------------

Let's work with the contacts application example, so you want to add translations for the menus "List Groups" and "List Contacts".
Let's work with the contacts application example,
so you want to add translations for the menus "List Groups" and "List Contacts".

::

Expand All @@ -64,13 +68,13 @@ Let's work with the contacts application example, so you want to add translation
genapp.add_view(ContactModelView(), "List Contacts",icon = "earphone", label=_('List Contacts'),
category = "Contacts")

1 - Run the folowing extraction script::
1 - Run the extraction, from the root directory of your project::

$ fabmanager extract

If you want to, or if your using a version prior to 1.3.0 you can use::

pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .

- If your using Flask-AppBuilder-Skeleton use the provided script::

./babel_extract.sh

2 - Make your translations

Expand Down Expand Up @@ -102,19 +106,11 @@ Let's work with the contacts application example, so you want to add translation
msgid "List Contacts"
msgstr "Lista de Contactos"

3 - Run the babel extraction again::

pybabel update -i ./babel/messages.pot -d app/translations

- If your using Flask-AppBuilder-Skeleton use the provided script::

./babel_extract.sh

4 - Run the compilation:
3 - Compile your translations, from the root directory of your project::

pybabel compile -d app/translations
$ fabmanager compile

5 - Add your language support to the framework
4 - Add your language support to the framework

- On config tell the framework the languages you support.
With this you will render a menu with the corresponding country flags.
Expand Down
58 changes: 27 additions & 31 deletions docs/_build/html/i18n.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">i18n Translations</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#babel-quick-how-to-config">Babel Quick How to Config</a></li>
<li><a class="reference internal" href="#initial-configuration">Initial Configuration</a></li>
<li><a class="reference internal" href="#quick-how-to">Quick How to</a></li>
</ul>
</li>
Expand Down Expand Up @@ -197,38 +197,41 @@ <h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to t
</ul>
</dd>
</dl>
<p>This means that all messages, views and menus generated from the framework can be translated to these languages.</p>
<p>You can add your own translations for your application, using Flask-BabelPkg, this is a fork from Flask-Babel, created because it was not possible to separate package translations from the application translations.</p>
<p>You can add your own translations, and your own language support. Take a look at <a class="reference external" href="http://pythonhosted.org/Flask-Babel">Flask-Babel</a> for setup an babel initial configuration.</p>
<p>This means that all messages, builtin on the framework are translated to these languages.</p>
<p>You can add your own translations for your application, using Flask-BabelPkg, this is a fork from Flask-Babel,
created because it was not possible to separate package translations from the application translations.</p>
<p>You can add your own translations, and your own language support.
Take a look at <a class="reference external" href="http://pythonhosted.org/Flask-Babel">Flask-Babel</a> for setup an babel initial configuration.</p>
</div>
<div class="section" id="babel-quick-how-to-config">
<h2>Babel Quick How to Config<a class="headerlink" href="#babel-quick-how-to-config" title="Permalink to this headline"></a></h2>
<p>On you projects root create a directory named babel, then create and edit a file named babel.cfg with the following content:</p>
<div class="section" id="initial-configuration">
<h2>Initial Configuration<a class="headerlink" href="#initial-configuration" title="Permalink to this headline"></a></h2>
<p>On you projects root create a directory named babel,
then create and edit a file named babel.cfg with the following content (this configuration is already made on the
base skeleton application):</p>
<div class="highlight-python"><div class="highlight"><pre>[python: **.py]
[jinja2: **/templates/**.html]
encoding = utf-8
</pre></div>
</div>
<p>Next extract your strings to be translated, execute on you projects root:</p>
<div class="highlight-python"><div class="highlight"><pre>$ fabmanager extract
</pre></div>
</div>
<p>If you want to, or if your using a version prior to 1.3.0 you can use:</p>
<div class="highlight-python"><div class="highlight"><pre>pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .
</pre></div>
</div>
<p>Finaly create your translations, for example to portuguese, spanish and german, execute on you projects root:</p>
<div class="highlight-python"><div class="highlight"><pre>pybabel init -i ./babel/messages.pot -d app/translations -l de
<p>Finally create your translations, for example to portuguese, spanish and german, execute on you projects root:</p>
<div class="highlight-python"><div class="highlight"><pre>pybabel init -i ./babel/messages.pot -d app/translations -l pt
pybabel init -i ./babel/messages.pot -d app/translations -l es
pybabel init -i ./babel/messages.pot -d app/translations -l de
</pre></div>
</div>
<p>If your using Flask-AppBuilder-Skeleton use the provided script:</p>
<div class="highlight-python"><div class="highlight"><pre>./babel_init.sh pt
./babel_init.sh es
./babel_init.sh de
</pre></div>
</div>
</div>
<div class="section" id="quick-how-to">
<h2>Quick How to<a class="headerlink" href="#quick-how-to" title="Permalink to this headline"></a></h2>
<p>Let&#8217;s work with the contacts application example, so you want to add translations for the menus &#8220;List Groups&#8221; and &#8220;List Contacts&#8221;.</p>
<p>Let&#8217;s work with the contacts application example,
so you want to add translations for the menus &#8220;List Groups&#8221; and &#8220;List Contacts&#8221;.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask.ext.babelpkg</span> <span class="kn">import</span> <span class="n">lazy_gettext</span> <span class="k">as</span> <span class="n">_</span>

<span class="k">class</span> <span class="nc">GroupModelView</span><span class="p">(</span><span class="n">ModelView</span><span class="p">):</span>
Expand All @@ -243,12 +246,12 @@ <h2>Quick How to<a class="headerlink" href="#quick-how-to" title="Permalink to t
<span class="n">category</span> <span class="o">=</span> <span class="s">&quot;Contacts&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>1 - Run the folowing extraction script:</p>
<p>1 - Run the extraction, from the root directory of your project:</p>
<div class="highlight-python"><div class="highlight"><pre>$ fabmanager extract
</pre></div>
</div>
<p>If you want to, or if your using a version prior to 1.3.0 you can use:</p>
<div class="highlight-python"><div class="highlight"><pre>pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .

- If your using Flask-AppBuilder-Skeleton use the provided script::

./babel_extract.sh
</pre></div>
</div>
<p>2 - Make your translations</p>
Expand Down Expand Up @@ -286,18 +289,11 @@ <h2>Quick How to<a class="headerlink" href="#quick-how-to" title="Permalink to t
</li>
</ul>
</div></blockquote>
<p>3 - Run the babel extraction again:</p>
<div class="highlight-python"><div class="highlight"><pre>pybabel update -i ./babel/messages.pot -d app/translations

- If your using Flask-AppBuilder-Skeleton use the provided script::

./babel_extract.sh
<p>3 - Compile your translations, from the root directory of your project:</p>
<div class="highlight-python"><div class="highlight"><pre>$ fabmanager compile
</pre></div>
</div>
<p>4 - Run the compilation:</p>
<blockquote>
<div>pybabel compile -d app/translations</div></blockquote>
<p>5 - Add your language support to the framework</p>
<p>4 - Add your language support to the framework</p>
<blockquote>
<div><ul>
<li><p class="first">On config tell the framework the languages you support.
Expand Down
Binary file modified docs/_build/html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/searchindex.js

Large diffs are not rendered by default.

58 changes: 27 additions & 31 deletions docs/i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,45 @@ F.A.B. has support for seven languages (planning for some more):
- Russian
- German

This means that all messages, views and menus generated from the framework can be translated to these languages.
This means that all messages, builtin on the framework are translated to these languages.

You can add your own translations for your application, using Flask-BabelPkg, this is a fork from Flask-Babel, created because it was not possible to separate package translations from the application translations.
You can add your own translations for your application, using Flask-BabelPkg, this is a fork from Flask-Babel,
created because it was not possible to separate package translations from the application translations.

You can add your own translations, and your own language support. Take a look at `Flask-Babel <http://pythonhosted.org/Flask-Babel>`_ for setup an babel initial configuration.
You can add your own translations, and your own language support.
Take a look at `Flask-Babel <http://pythonhosted.org/Flask-Babel>`_ for setup an babel initial configuration.

Babel Quick How to Config
-------------------------
Initial Configuration
---------------------

On you projects root create a directory named babel, then create and edit a file named babel.cfg with the following content::
On you projects root create a directory named babel,
then create and edit a file named babel.cfg with the following content (this configuration is already made on the
base skeleton application)::

[python: **.py]
[jinja2: **/templates/**.html]
encoding = utf-8
Next extract your strings to be translated, execute on you projects root::

$ fabmanager extract

If you want to, or if your using a version prior to 1.3.0 you can use::

pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .
Finaly create your translations, for example to portuguese, spanish and german, execute on you projects root::

pybabel init -i ./babel/messages.pot -d app/translations -l de
Finally create your translations, for example to portuguese, spanish and german, execute on you projects root::

pybabel init -i ./babel/messages.pot -d app/translations -l pt
pybabel init -i ./babel/messages.pot -d app/translations -l es
pybabel init -i ./babel/messages.pot -d app/translations -l de

If your using Flask-AppBuilder-Skeleton use the provided script::

./babel_init.sh pt
./babel_init.sh es
./babel_init.sh de

Quick How to
------------

Let's work with the contacts application example, so you want to add translations for the menus "List Groups" and "List Contacts".
Let's work with the contacts application example,
so you want to add translations for the menus "List Groups" and "List Contacts".

::

Expand All @@ -64,13 +68,13 @@ Let's work with the contacts application example, so you want to add translation
genapp.add_view(ContactModelView(), "List Contacts",icon = "earphone", label=_('List Contacts'),
category = "Contacts")

1 - Run the folowing extraction script::
1 - Run the extraction, from the root directory of your project::

$ fabmanager extract

If you want to, or if your using a version prior to 1.3.0 you can use::

pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .
- If your using Flask-AppBuilder-Skeleton use the provided script::
./babel_extract.sh

2 - Make your translations

Expand Down Expand Up @@ -102,19 +106,11 @@ Let's work with the contacts application example, so you want to add translation
msgid "List Contacts"
msgstr "Lista de Contactos"

3 - Run the babel extraction again::

pybabel update -i ./babel/messages.pot -d app/translations
- If your using Flask-AppBuilder-Skeleton use the provided script::
./babel_extract.sh

4 - Run the compilation:
3 - Compile your translations, from the root directory of your project::

pybabel compile -d app/translations
$ fabmanager compile

5 - Add your language support to the framework
4 - Add your language support to the framework

- On config tell the framework the languages you support.
With this you will render a menu with the corresponding country flags.
Expand Down

0 comments on commit 0514617

Please sign in to comment.