From c6b7a9326f4f0c5bce854e06242c5653c98df515 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Fri, 31 May 2024 01:04:12 -0400 Subject: [PATCH] profiles/translation: Convert from fish to bash --- docs/profiles/translation.rst | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/profiles/translation.rst b/docs/profiles/translation.rst index c1477e48..193cc61a 100644 --- a/docs/profiles/translation.rst +++ b/docs/profiles/translation.rst @@ -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 `__ (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 `__. They will, at minimum, pre-translate the text from the unextended schema and codelists. Pre-translate a profile ----------------------- @@ -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 `__ and `ocds-extensions-translations `__ repositories into the same parent directory: - .. code-block:: fish + .. code-block:: bash git clone git@github.com:open-contracting/standard.git git clone git@github.com:open-contracting/ocds-extensions-translations.git @@ -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 @@ -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