Skip to content

Commit

Permalink
profiles/translation: Convert from fish to bash
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed May 31, 2024
1 parent 206c93d commit c6b7a93
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions docs/profiles/translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Translation

The standard's page for :doc:`../../../standard/translation/index`

The instructions below are similar to others in `ocds-extensions-translations <https://github.com/open-contracting/ocds-extensions-translations#populate-initial-translations>`__ (using the fish shell on macOS). They will, at minimum, pre-translate the text from the unextended schema and codelists.
The instructions below are similar to others in `ocds-extensions-translations <https://github.com/open-contracting/ocds-extensions-translations#populate-initial-translations>`__. They will, at minimum, pre-translate the text from the unextended schema and codelists.

Pre-translate a profile
-----------------------
Expand All @@ -15,19 +15,19 @@ One-time setup

#. Install ``translate-toolkit``:

.. code-block:: fish
.. code-block:: bash
brew install translate-toolkit
#. Install ``python-Levenshtein``:

.. code-block:: fish
.. code-block:: bash
eval (brew --prefix translate-toolkit)/libexec/bin/pip install python-Levenshtein
eval $(brew --prefix translate-toolkit)/libexec/bin/python -m pip install python-Levenshtein
#. Clone the `standard <https://github.com/open-contracting/standard>`__ and `ocds-extensions-translations <https://github.com/open-contracting/ocds-extensions-translations>`__ repositories into the same parent directory:

.. code-block:: fish
.. code-block:: bash
git clone [email protected]:open-contracting/standard.git
git clone [email protected]:open-contracting/ocds-extensions-translations.git
Expand All @@ -37,17 +37,17 @@ Each-time setup

#. Set the ``lang`` environment variable, for example:

.. code-block:: fish
.. code-block:: bash
set lang es
set wip path/to/profile/from/standard
lang=es
wip=path/to/profile/from/standard
Prepare the compendia
~~~~~~~~~~~~~~~~~~~~~

#. Change to the ``standard`` directory, then prepare a compendium:

.. code-block:: fish
.. code-block:: bash
git checkout 1.1
git pull --rebase
Expand All @@ -56,67 +56,67 @@ Prepare the compendia
#. Change to the ``ocds-extensions-translations`` directory, then prepare a compendium. For example, for OCDS for PPPs 1.0.0-beta3:

.. code-block:: fish
.. code-block:: bash
git checkout main
git pull --rebase
for extension_version in bids/v1.1.5 charges/master documentation_details/master finance/master location/v1.1.5 metrics/1.1 milestone_documents/v1.1.5 performance_failures/master project/master risk_allocation/master shareholders/master signatories/master tariffs/1.1 ppp/master
msgcat --use-first locale/$lang/LC_MESSAGES/$extension_version/**.po > $lang-(echo $extension_version | tr '/' '-').po
end
msgcat --use-first (ls $lang-*.po) > $wip/$lang-extensions.po
for extension_version in bids/v1.1.5 charges/master documentation_details/master finance/master location/v1.1.5 metrics/1.1 milestone_documents/v1.1.5 performance_failures/master project/master risk_allocation/master shareholders/master signatories/master tariffs/1.1 ppp/master; do
msgcat --use-first locale/$lang/LC_MESSAGES/$extension_version/**.po > $lang-$(echo $extension_version | tr '/' '-').po
done
msgcat --use-first $(ls $lang-*.po) > $wip/$lang-extensions.po
rm -f $lang-*.po
#. Change to the profile's directory, then prepare a compendium:

.. code-block:: fish
.. code-block:: bash
if [ -d docs/locale/$lang/LC_MESSAGES ]
if [ -d docs/locale/$lang/LC_MESSAGES ]; then
msgcat --use-first $lang-standard.po $lang-extensions.po docs/locale/$lang/**.po > $lang.po
else
msgcat --use-first $lang-standard.po $lang-extensions.po > $lang.po
end
fi
Pre-translate the profile
~~~~~~~~~~~~~~~~~~~~~~~~~

#. Count untranslated messages:

.. code-block:: fish
.. code-block:: bash
pocount --incomplete docs/locale/$lang/LC_MESSAGES | tail -n 10
#. Create the POT files:

.. code-block:: fish
.. code-block:: bash
make extract
#. Re-create the PO files:

.. code-block:: fish
.. code-block:: bash
rm -rf docs/locale/$lang/LC_MESSAGES
sphinx-intl update -p build/locale -d docs/locale -l $lang
#. Pre-populate the PO files:

.. code-block:: none
.. code-block:: bash
cd docs/locale/$lang/LC_MESSAGES
for f in **.po
for f in **.po; do
pretranslate --nofuzzymatching -t ../../../../$lang.po ../../../../build/locale/{$f}t $f
end
done
cd ../../../..
#. Count untranslated messages:

.. code-block:: fish
.. code-block:: bash
pocount --incomplete docs/locale/$lang/LC_MESSAGES | tail -n 10
#. Clean up:

.. code-block:: fish
.. code-block:: bash
rm -f $lang-standard.po $lang-extensions.po $lang.po
Expand Down

0 comments on commit c6b7a93

Please sign in to comment.