Skip to content

Commit

Permalink
chore: code-block added
Browse files Browse the repository at this point in the history
This will add  a copy button + syntax highlighting in GitHub.
  • Loading branch information
CodeWithEmad committed Aug 1, 2024
1 parent 502bd4b commit 99d14e0
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions cookiecutter-xblock/{{cookiecutter.repo_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
Testing with Docker
*******************

This XBlock comes with a Docker test environment ready to build, based on the xblock-sdk workbench. To build and run it::
This XBlock comes with a Docker test environment ready to build, based on the xblock-sdk workbench.
To build and run it:

$ make dev.run
.. code-block:: bash
make dev.run
The XBlock SDK Workbench, including this XBlock, will be available on the list of XBlocks at http://localhost:8000

Expand Down Expand Up @@ -35,8 +38,9 @@ The general steps to provide multilingual messages for a Python program (or an X
1. Mark translatable strings
============================

Mark translatable strings in python::
Mark translatable strings in python:

.. code-block:: python
from django.utils.translation import ugettext as _
Expand All @@ -46,8 +50,9 @@ Mark translatable strings in python::
See `edx-developer-guide <https://edx.readthedocs.io/projects/edx-developer-guide/en/latest/internationalization/i18n.html#python-source-code>`__
for more information.

You can also use ``gettext`` to mark strings in javascript::
You can also use ``gettext`` to mark strings in javascript:

.. code-block:: javascript
// Translators: This comment will appear in the `.po` file.
var message = gettext("Custom message.");
Expand All @@ -64,10 +69,11 @@ use `edx-i18n-tools <https://github.com/openedx/i18n-tools>`_.
After marking strings as translatable we have to create the raw message catalogs.
These catalogs are created in ``.po`` files. For more information see
`GNU PO file documentation <https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html>`_.
These catalogs can be created by running::
These catalogs can be created by running:

.. code-block:: bash
$ make extract_translations
make extract_translations
The previous command will create the necessary ``.po`` files under
``{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/conf/locale/en/LC_MESSAGES/text.po``.
Expand Down Expand Up @@ -110,9 +116,11 @@ django with transiflex.
------------------------

Once translations are in place, use the following Make target to compile the translation catalogs ``.po`` into
``.mo`` message files::
``.mo`` message files:

.. code-block:: bash
$ make compile_translations
make compile_translations
The previous command will compile ``.po`` files using
``django-admin compilemessages`` (`compilemessages documentation <https://docs.djangoproject.com/en/3.2/topics/i18n/translation/#compiling-message-files>`_).
Expand All @@ -121,7 +129,9 @@ After compiling the ``.po`` file(s), ``django-statici18n`` is used to create lan

To upload translations to transiflex use the follow Make target::

$ make push_translations
.. code-block:: bash
make push_translations
See `config instructions <https://github.com/openedx/i18n-tools#transifex-commands>`_ for information on how to set up your
transifex credentials.
Expand All @@ -131,9 +141,11 @@ django with transiflex.

**Note:** The ``dev.run`` make target will automatically compile any translations.

**Note:** To check if the source translation files (``.po``) are up-to-date run::
**Note:** To check if the source translation files (``.po``) are up-to-date run:

.. code-block:: bash
$ make detect_changed_source_translations
make detect_changed_source_translations
4. Use ``gettext`` to translate strings
=======================================
Expand Down

0 comments on commit 99d14e0

Please sign in to comment.