From: Hypolite Petovan Date: Mon, 19 Mar 2018 03:27:41 +0000 (-0400) Subject: Move util/run_xgettext.sh to bin/ X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7cd3b5d629a81ad85b4434f2144be7947492f927;p=friendica.git Move util/run_xgettext.sh to bin/ --- diff --git a/CHANGELOG b/CHANGELOG index 9ad9137714..3d5c11f511 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -72,7 +72,7 @@ Version 3.5.3 (2017-10-05) Fixes to buffer, diaspora, libertree, pumpio, gnu social, tumblr, twitter and wppost bridges to redistribute remote_self content [annando] Fixed a bug in securemail settings form [FuzzJunket] external poller addons are deprecated, as this is now a core functionality [annando] - + Friendica Directory: Fix a problem with the Vagrant config [tobiasd] Fix not working node health page [Hypolite] @@ -82,7 +82,7 @@ Version 3.5.3 (2017-10-05) 1257, 2786, 2864, 2872, 2998, 3013, 3018, 3131, 3180, 3234, 3248, 3309, 3313, 3360, 3362, 3391, 3482, 3511, 3512, 3515, 3516, 3529, 3531, 3536, 3545, 3552, 3553, 3560, 3571, 3589, 3592, 3599, 3615, - 3616, 3621, 3624, 3636, 3645, 3661, 3684, 3685, 3691, 3696, 3699, + 3616, 3621, 3624, 3636, 3645, 3661, 3684, 3685, 3691, 3696, 3699, 3700, 3732 Version 3.5.2 (2017-06-06) @@ -199,8 +199,8 @@ Version 3.5.1 (2017-03-12) Twitter-bridge now supports quotes and long posts when importing tweets [annando] Closed Issues - 1019, 1163, 1612, 1613, 2103, 2177, 2252, 2260, 2403, 2991, 2614, - 2751, 2752, 2772, 2791, 2800, 2804, 2813, 2814, 2816, 2817, 2823, + 1019, 1163, 1612, 1613, 2103, 2177, 2252, 2260, 2403, 2991, 2614, + 2751, 2752, 2772, 2791, 2800, 2804, 2813, 2814, 2816, 2817, 2823, 2850, 2858, 2865, 2892, 2894, 2895, 2907, 2908, 2914, 2015, 2926, 2948, 2955, 2958, 2963, 2964, 2968, 2987, 2993, 3020, 3052, 3062, 3066, 3091, 3108, 3113, 3116, 3117, 3118, 3126, 3130, 3135, 3155, @@ -304,7 +304,7 @@ Version 3.4.3 (2015-12-22) Diaspora and OStatus can be enabled only if requirements are satisfied (annando) Support for additional passwords for ejabberd (annando) Use proxy for profile photos (annando) - 'Reload active themes' in theme admin page (fabrixxm) + 'Reload active themes' in theme admin page (fabrixxm) Install routine checks for ImageMagick and GIF support (fabrixxm) Install routine checks for availability of "mcrypt_create_iv()" function, needed for RINO2 (fabrixxm) Only suported themes are shown in admin page (annando) @@ -315,7 +315,7 @@ Version 3.4.3 (2015-12-22) Show an info message if an empty contact group is shown (issue #1871) (annando) User setting to disable network page autoupdate (issue #1921) (annando) Settings to limit or permit access to crawler to search page (annando) - What's new for developers: + What's new for developers: Themes can show Events entry in navbar (annando) Themes can now override colorbox (fabrixxm) Updated Vagrant development VM (silke, hauke) @@ -343,7 +343,7 @@ Version 3.4.3 (2015-12-22) Fix mention completition popup with TinyMCE (issue #1920) (fabrixxm) Fix photo cache and proxy when installed in subfolder (ddorian1) Fix bbcode conversion of the about text for the profile (issue #1607) (annando) - + Version 3.4.2 (2015-09-29) @@ -388,8 +388,8 @@ Version 3.4.2 (2015-09-29) Checks for mcrypt availability before enable or use RINO2 (fabrixm) Fix following email contacts (issue #1896) (annando) Parse BBCode in contact request notification email (annando) - - + + Version 3.4.1 (2015-07-06) Implement server-to-server encryption (RINO) using php-encryption library as "RINO 2", deprecate "RINO 1" (issue #1655) (fabrixxm) @@ -436,7 +436,7 @@ Version 3.4.1 (2015-07-06) Fix spelling in accepted connection notification email (strk) Show image size warning in a human readable format (rabuzarus) Move ACL window in template (rabuzarus) - New option "-s" in util/run_xgettext.sh (fabrixxm) + New option "-s" in bin/run_xgettext.sh (fabrixxm) Support, but ignore at the moment, delete message from Quitter (annando) Remove google maps from core. Functionality moved to addon "googlemap" alongside "openstreetmap" (issue #1705) (annando) Update to German documentation (Frank Dieckmann, tobias) diff --git a/bin/run_xgettext.sh b/bin/run_xgettext.sh new file mode 100644 index 0000000000..78c1bae5f1 --- /dev/null +++ b/bin/run_xgettext.sh @@ -0,0 +1,101 @@ +#!/bin/bash +FULLPATH=$(dirname $(readlink -f "$0")) + +if [ "$1" == "--help" -o "$1" == "-h" ] +then + echo "$(basename $(readlink -f "$0")) [options]" + echo + echo "-a | --addon extract strings from addon 'name'" + echo "-s | --single single addon mode: extract string from current folder" + exit +fi + +MODE='default' +ADDONNAME= +if [ "$1" == "--addon" -o "$1" == "-a" ] +then + MODE='addon' + if [ -z $2 ]; then echo -e "ERROR: missing addon name\n\nrun_xgettext.sh -a "; exit 1; fi + ADDONNAME=$2 + if [ ! -d "$FULLPATH/../addon/$ADDONNAME" ]; then echo "ERROR: addon '$ADDONNAME' not found"; exit 2; fi +fi + +if [ "$1" == "--single" -o "$1" == "-s" ] +then + MODE='single' +fi + + +case "$MODE" in + 'addon') + cd "$FULLPATH/../addon/$ADDONNAME" + mkdir -p "$FULLPATH/../addon/$ADDONNAME/lang/C" + OUTFILE="$FULLPATH/../addon/$ADDONNAME/lang/C/messages.po" + FINDSTARTDIR="." + FINDOPTS= + ;; + 'single') + FULLPATH=$PWD + ADDONNAME=$(basename $FULLPATH) + mkdir -p "$FULLPATH/lang/C" + OUTFILE="$FULLPATH/lang/C/messages.po" + FINDSTARTDIR="." + FINDOPTS= + echo "Extract strings for single addon '$ADDONNAME'" + ;; + 'default') + cd "$FULLPATH/.." + OUTFILE="$FULLPATH/messages.po" + FINDSTARTDIR="." + # skip addon folder + FINDOPTS="( -wholename */addon -or -wholename */addons-extra -or -wholename */smarty3 ) -prune -o" + + F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ./boot.php); + echo "Friendica version $F9KVERSION" + ;; +esac + + +KEYWORDS="-k -kt -ktt:1,2" + +echo "extract strings to $OUTFILE.." +rm "$OUTFILE"; touch "$OUTFILE" +for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f) +do + if [ ! -d "$f" ] + then + xgettext $KEYWORDS -j -o "$OUTFILE" --from-code=UTF-8 "$f" + sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" + fi +done + +echo "setup base info.." +case "$MODE" in + 'addon'|'single') + sed -i "s/SOME DESCRIPTIVE TITLE./ADDON $ADDONNAME/g" "$OUTFILE" + sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER//g" "$OUTFILE" + sed -i "s/FIRST AUTHOR , YEAR.//g" "$OUTFILE" + sed -i "s/PACKAGE VERSION//g" "$OUTFILE" + sed -i "s/PACKAGE/Friendica $ADDONNAME addon/g" "$OUTFILE" + sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" + sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" + ;; + 'default') + sed -i "s/SOME DESCRIPTIVE TITLE./FRIENDICA Distributed Social Network/g" "$OUTFILE" + sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2010, 2011, 2012, 2013 the Friendica Project/g" "$OUTFILE" + sed -i "s/FIRST AUTHOR , YEAR./Mike Macgirvin, 2010/g" "$OUTFILE" + sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE" + sed -i "s/PACKAGE/Friendica/g" "$OUTFILE" + sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" + sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" + ;; +esac + +if [ "" != "$1" -a "$MODE" == "default" ] +then + UPDATEFILE="$(readlink -f ${FULLPATH}/$1)" + echo "merging new strings to $UPDATEFILE.." + msgmerge -U $OUTFILE $UPDATEFILE +fi + +echo "done." diff --git a/util/README b/util/README index 83a49cd223..f4f16fb462 100644 --- a/util/README +++ b/util/README @@ -78,11 +78,11 @@ More info at http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html Xgettext and .po workflow -1. Run util/run_xgettext.sh script (on *unix sistems, with GNU xgettext installed) +1. Run bin/run_xgettext.sh script (on *unix sistems, with GNU xgettext installed) This script runs xgettext on source tree, extracting strings from L10n::t() and L10n::tt() functions, and creates a util/messages.po file. - $ cd util; ./run_xgettext.sh + $ cd bin; ./run_xgettext.sh 2. copy util/messages.po to view/lang//messages.po Replace with the language you are working on - e.g. 'es', 'fr', 'de', etc. @@ -111,7 +111,7 @@ Xgettext and .po workflow to create the strings.php file When strings are added or modified in source, you could run - $ cd util; ./run_xgettext.sh ../view/lang//messages.po + $ cd bin; ./run_xgettext.sh ../view/lang//messages.po to extract strings from source files and join them with the existing .po file: new strings are added, the existing are not overwritten. diff --git a/util/run_xgettext.sh b/util/run_xgettext.sh deleted file mode 100755 index 78c1bae5f1..0000000000 --- a/util/run_xgettext.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -FULLPATH=$(dirname $(readlink -f "$0")) - -if [ "$1" == "--help" -o "$1" == "-h" ] -then - echo "$(basename $(readlink -f "$0")) [options]" - echo - echo "-a | --addon extract strings from addon 'name'" - echo "-s | --single single addon mode: extract string from current folder" - exit -fi - -MODE='default' -ADDONNAME= -if [ "$1" == "--addon" -o "$1" == "-a" ] -then - MODE='addon' - if [ -z $2 ]; then echo -e "ERROR: missing addon name\n\nrun_xgettext.sh -a "; exit 1; fi - ADDONNAME=$2 - if [ ! -d "$FULLPATH/../addon/$ADDONNAME" ]; then echo "ERROR: addon '$ADDONNAME' not found"; exit 2; fi -fi - -if [ "$1" == "--single" -o "$1" == "-s" ] -then - MODE='single' -fi - - -case "$MODE" in - 'addon') - cd "$FULLPATH/../addon/$ADDONNAME" - mkdir -p "$FULLPATH/../addon/$ADDONNAME/lang/C" - OUTFILE="$FULLPATH/../addon/$ADDONNAME/lang/C/messages.po" - FINDSTARTDIR="." - FINDOPTS= - ;; - 'single') - FULLPATH=$PWD - ADDONNAME=$(basename $FULLPATH) - mkdir -p "$FULLPATH/lang/C" - OUTFILE="$FULLPATH/lang/C/messages.po" - FINDSTARTDIR="." - FINDOPTS= - echo "Extract strings for single addon '$ADDONNAME'" - ;; - 'default') - cd "$FULLPATH/.." - OUTFILE="$FULLPATH/messages.po" - FINDSTARTDIR="." - # skip addon folder - FINDOPTS="( -wholename */addon -or -wholename */addons-extra -or -wholename */smarty3 ) -prune -o" - - F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ./boot.php); - echo "Friendica version $F9KVERSION" - ;; -esac - - -KEYWORDS="-k -kt -ktt:1,2" - -echo "extract strings to $OUTFILE.." -rm "$OUTFILE"; touch "$OUTFILE" -for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f) -do - if [ ! -d "$f" ] - then - xgettext $KEYWORDS -j -o "$OUTFILE" --from-code=UTF-8 "$f" - sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" - fi -done - -echo "setup base info.." -case "$MODE" in - 'addon'|'single') - sed -i "s/SOME DESCRIPTIVE TITLE./ADDON $ADDONNAME/g" "$OUTFILE" - sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER//g" "$OUTFILE" - sed -i "s/FIRST AUTHOR , YEAR.//g" "$OUTFILE" - sed -i "s/PACKAGE VERSION//g" "$OUTFILE" - sed -i "s/PACKAGE/Friendica $ADDONNAME addon/g" "$OUTFILE" - sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" - sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" - ;; - 'default') - sed -i "s/SOME DESCRIPTIVE TITLE./FRIENDICA Distributed Social Network/g" "$OUTFILE" - sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2010, 2011, 2012, 2013 the Friendica Project/g" "$OUTFILE" - sed -i "s/FIRST AUTHOR , YEAR./Mike Macgirvin, 2010/g" "$OUTFILE" - sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE" - sed -i "s/PACKAGE/Friendica/g" "$OUTFILE" - sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" - sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" - ;; -esac - -if [ "" != "$1" -a "$MODE" == "default" ] -then - UPDATEFILE="$(readlink -f ${FULLPATH}/$1)" - echo "merging new strings to $UPDATEFILE.." - msgmerge -U $OUTFILE $UPDATEFILE -fi - -echo "done."