UpdateTranslation.sh

From Apache OpenOffice Wiki
Revision as of 18:20, 28 August 2022 by Mechtilde (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  1. !/bin/bash
  2. Update translation
  3. License: Apache-2.0
  4. Licensed to the Apache Software Foundation (ASF) under one
  5. or more contributor license agreements.
  6. The ASF licenses this file to you under the Apache License,
  7. Version 2.0 (the "License"); you may not use this file except
  8. in compliance with the License. You may obtain a copy of the
  9. License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  1. Authors: Michael Stehmann <mikeadvo@apache.org>
  2. Mechtilde Stehmann <mechtilde@apache.org>
  1. Logging error messages

LOG_PATH=/home/mechtilde/log LOG_FILE=${LOG_PATH}/UpdateTranslation.log exec 2>> ${LOG_FILE} echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE} echo "Messages from "$0 >> ${LOG_FILE}

  1. Newer pootle versions run inside a virtual environment

VIRTUAL_ENV=/x1/www/pootle/env POOTLE_SETTINGS=${VIRTUAL_ENV}/pootle.conf POOTLE_TRANSLATION_DIRECTORY=/x1/www/po PYTHONPATH=${VIRTUAL_ENV}/lib/python2.7/site-packages PATH="$VIRTUAL_ENV/bin:$PATH"

export VIRTUAL_ENV export PATH export POOTLE_SETTINGS export PYTHONPATH

PROJECT_PATH=${POOTLE_TRANSLATION_DIRECTORY} TEMPLATES_DIR=/x1/www/po/aoo40/templates

  1. Directory of the pootle command

POOTLE_DIR=${VIRTUAL_ENV}/bin

  1. Work directory

WORK_DIR=/home/mechtilde/aoo/workdir

  1. Include the Language data

. /home/mechtilde/local/bin/langs.sh echo ${LANGS}

  1. If the (non-empty) file en-US.sdf is in ~/aoo/workdir:

if [ -s ${WORK_DIR}/en-US.sdf ] then # To be carefull

  1. rm -r ${WORK_DIR}/POT-UI/
  2. rm -r ${WORK_DIR}/POT-HELP/helpcontent2
  1. mkdir -p ${WORK_DIR}/POT-UI
  2. mkdir -p ${WORK_DIR}/POT-HELP

# Convert en-US.sdf to templates

  1. ${POOTLE_DIR}/python ${POOTLE_DIR}/oo2po --progress=verbose --pot ${WORK_DIR}/en-US.sdf ${WORK_DIR}/POT-UI/

# Move helpcontent2 to POT-HELP to separate HELP from UI

  1. mv ${WORK_DIR}/POT-UI/helpcontent2 ${WORK_DIR}/POT-HELP/

# Copy PotFiles-* to project directory

  1. cp -rv ${WORK_DIR}/POT-UI/* ${PROJECT_PATH}/aoo40/templates/
  2. cp -rv ${WORK_DIR}/POT-HELP/* ${PROJECT_PATH}/aoo40help/templates/

# Update the translation templates into the Pootle database

  1. ${POOTLE_DIR}/python ${POOTLE_DIR}/pootle \
  2. --config ${VIRTUAL_ENV}/pootle.conf \
  3. update_stores --project=aoo40 --language=templates
  4. ${POOTLE_DIR}/python ${POOTLE_DIR}/pootle \
  5. --config ${VIRTUAL_ENV}/pootle.conf \
  6. update_stores --project=aoo40help --language=templates

# Reconcile languages with templates for Language in ${LANGS} do

  1. echo "Sync_stores UI "${Language} >> ${LOG_FILE}
  2. echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}
  1. ${POOTLE_DIR}/python ${POTLE_DIR}/pootle \
  2. --config ${VIRTUAL_ENV}/pootle.conf \
  3. sync_stores --project=aoo40 --language=${Language}
  1. echo "Pomerge UI "${Language} >> ${LOG_FILE}
  2. echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}
  1. ${POOTLE_DIR}/python ${POOTLE_DIR}/pomerge \
  2. --template=${PROJECT_PATH}/aoo40/templates/ \
  3. --input ${WORK_DIR}/aoo40/${Language}/ \
  4. --output ${PROJECT_PATH}/aoo40/${Language}/
  1. echo "Update_stores UI "${Language} >> ${LOG_FILE}
  2. echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}
  1. ${POOTLE_DIR}/python ${POOTLE_DIR}/pootle \
  2. --config ${VIRTUAL_ENV}/pootle.conf \
  3. update_stores --project=aoo40 --language=${Language}
  1. cp -r ${PROJECT_PATH}/aoo40/${Language} ${WORK_DIR}/aoo40/
               echo "Sync_stores HELP "${Language} >> ${LOG_FILE}
               echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}

${POOTLE_DIR}/python ${POOTLE_DIR}/pootle \ --config ${VIRTUAL_ENV}/pootle.conf \

       	sync_stores --project=aoo40help --language=${Language}
               echo "Pomerge HELP "${Language} >> ${LOG_FILE}
               echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}

${POOTLE_DIR}/python ${POOTLE_DIR}/pomerge \ --template=${PROJECT_PATH}/aoo40help/templates/ \

       	--input ${WORK_DIR}/aoo40help/${Language}/ \
       	--output ${PROJECT_PATH}/aoo40help/${Language}/
               echo "Update_stores HELP "${Language} >> ${LOG_FILE}
               echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}

${POOTLE_DIR}/python ${POOTLE_DIR}/pootle \ --config ${VIRTUAL_ENV}/pootle.conf \

       	update_stores --project=aoo40help --language=${Language}

cp -r ${PROJECT_PATH}/aoo40help/${Language}/helpcontent2 \ ${WORK_DIR}/aoo40help/${Language}/

# Commands for updating git repository cd ${WORK_DIR} git add . git commit -am "update $(date) ${Language} - Corrected Helpdir"

               echo "Finished "${Language} >> ${LOG_FILE}
               echo $(date +%Y-%m-%d-%H%M%S) >> ${LOG_FILE}

done fi

Personal tools