Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Rings:0-Bootstrap
translation-update-upstream
translation-update-upstream.in
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File translation-update-upstream.in of Package translation-update-upstream
#! /bin/bash set -o errexit shopt -s nullglob if test "$1" = "--help" ; then echo "Upstream translation update tool works in top directory of unpacked source code." echo "Usage: $0 [translation_directory] [translation_domain] [command to create pot file]" fi # Update all known mechanisms to add language: function linguas_update { if test -f LINGUAS -o -f ../po/LINGUAS ; then if test -f LINGUAS ; then if sed '/^#/d' <LINGUAS | grep -q '[a-zA-Z0-9] [a-z]' ; then echo "Adding $LNG to LINGUAS in to a list in single-line list mode." sed -i "s/^[^#].* [a-z].*\$/& $LNG/" LINGUAS else echo "Adding $LNG to LINGUAS." echo $LNG >>LINGUAS fi else echo "Not adding $LNG to LINGUAS - secondary domain, global LINGUAS." fi else if test -f $OLDPWD/configure.ac ; then if grep -q 'ALL_LINGUAS=' $OLDPWD/configure.ac ; then echo "Adding $LNG to configure.ac." sed -i 's/ALL_LINGUAS="/&'$LNG' /;s/\(ALL_LINGUAS=\)\([^"]\|$\)/\1"'$LNG' "\2/' $OLDPWD/configure.ac fi fi if test -f $OLDPWD/configure.in ; then if grep -q 'ALL_LINGUAS=' $OLDPWD/configure.in ; then echo "Adding $LNG to configure.in." sed -i 's/ALL_LINGUAS="/&'$LNG' /;s/\(ALL_LINGUAS=\)\([^"]\|$\)/\1"'$LNG' "\2/' $OLDPWD/configure.in fi fi if test -f $OLDPWD/configure ; then if grep -q 'ALL_LINGUAS=' $OLDPWD/configure ; then echo "Adding $LNG to configure." sed -i 's/ALL_LINGUAS="/&'$LNG' /;s/\(ALL_LINGUAS=\)\([^"]\|$\)/\1"'$LNG' "\2/' $OLDPWD/configure fi fi fi } DIR=${1:-po} DOMAIN=$2 cd $DIR if test -z "$3" ; then if test -z "$DOMAIN" ; then intltool-update --pot else intltool-update --gettext-package=$DOMAIN --pot fi else eval $3 fi POT_NOT_UNIQUE=false NO_POT=true for POT in *.pot ; do MISSING=true if $POT_NOT_UNIQUE ; then echo "ERROR: Directory $DIR contains more than one .pot file." exit 1 fi POT_NOT_UNIQUE=true DOMAIN=${POT%.pot} # STRING_COLLECT_MODE is a special mode used during string # collection. STRING_COLLECT_DIR must be set as well. if test "$STRING_COLLECT_MODE" = 1 ; then mkdir $STRING_COLLECT_DIR/$DOMAIN cp -a $POT $STRING_COLLECT_DIR/$DOMAIN cp -a *.po $STRING_COLLECT_DIR/$DOMAIN else if test -d @DATADIR@/translation-update-upstream ; then if test -d @DATADIR@/translation-update-upstream/po/$DOMAIN ; then for PO_PATH in @DATADIR@/translation-update-upstream/po/$DOMAIN/*.po ; do PO=${PO_PATH##*/} LNG=${PO%.po} if test -f $PO ; then if test "$SKIP_TUU" = true ; then echo "SKIP_TUU is set. Skipping update of $PO." continue fi echo "Updating $PO using translation-update-upstream." echo "(You can skip update by setting environment variable SKIP_TUU=true.)" # PO_PATH is first: Update any string, even if it was already translated. # Swap $PO_PATH and $PO to disable this behavior. msgcat --use-first $PO_PATH $PO -o $PO.new # Return .po file notes that are not present in the update file. msgmerge --no-fuzzy-matching --compendium=$PO_PATH -o $PO.new2 $PO.new $POT # And finally, synthesize header that not change every time. if @LIBEXECDIR@/translation-update-upstream/msgheadermerge $PO $PO.new2 $PO.header --mergemode ; then msgcat --use-first $PO.header $PO.new2 -o $PO rm $PO.new $PO.new2 $PO.header else rm $PO.new $PO.new2 echo "WARNING: Update of $PO for $DOMAIN is older than data in package. Skipping." fi else echo "Adding $PO from translation-update-upstream." cp -a $PO_PATH $PO linguas_update fi done MISSING=false fi if test -d @DATADIR@/translation-update-upstream/po-mandatory/$DOMAIN ; then for PO_PATH in @DATADIR@/translation-update-upstream/po-mandatory/$DOMAIN/*.po ; do PO=${PO_PATH##*/} LNG=${PO%.po} if test -f $PO ; then if test "$SKIP_TUU" = true ; then echo "SKIP_TUU is set. Skipping update of $PO." continue fi echo "Updating $PO using translation-update-upstream mandatory source." echo "(You can skip update by setting environment variable SKIP_TUU=true.)" # PO_PATH is first: Update any string, even if it was already translated. # Swap $PO_PATH and $PO to disable this behavior. msgcat --use-first $PO_PATH $PO -o $PO.new # Return .po file notes that are not present in the update file. msgmerge --no-fuzzy-matching --compendium=$PO_PATH -o $PO.new2 $PO.new $POT # And finally, synthesize header that not change every time. if ! @LIBEXECDIR@/translation-update-upstream/msgheadermerge $PO $PO.new2 $PO.header --mergemode --continue ; then echo "WARNING: Mandatory update of $PO for $DOMAIN is older than data in package or upstream snapshot. Using anyway!" fi msgcat --use-first $PO.header $PO.new2 -o $PO rm $PO.new $PO.new2 $PO.header else echo "Adding $PO from translation-update-upstream mandatory source." cp -a $PO_PATH $PO linguas_update fi done MISSING=false fi if $MISSING ; then echo "WARNING: Missing $DOMAIN in translation-update-upstream configuration! No updates available." fi else echo "ERROR: Package translation-update-upstream is not installed. Please update your BuildRequires!" exit 1 fi fi NO_POT=false done if $NO_POT ; then echo "ERROR: Pot file was not created. Please fix or set command line arguments properly!" exit 1 fi
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor