Index: branches/stable/l10n-kde4/scripts/createdesktopcontext.pl =================================================================== --- branches/stable/l10n-kde4/scripts/createdesktopcontext.pl (revision 1542106) +++ branches/stable/l10n-kde4/scripts/createdesktopcontext.pl (revision 1542107) @@ -1,121 +1,121 @@ #! /usr/bin/env perl # Version for KDE4 use strict; use warnings; use v5.8.0; # We really want decent Unicode support use Getopt::Long; sub printdate { printf ( "%04i", ( $_[5] + 1900 ) ); print "-"; printf ( "%02i", $_[4] + 1); print "-"; printf ( "%02i", $_[3] ); print " "; printf ( "%02i", $_[2] ); print ":"; printf ( "%02i", $_[1] ); print "+0000"; } sub prepare { binmode( STDOUT, ":utf8" ); my @now = gmtime(); print "#, fuzzy\n"; print "msgid \"\"\n"; print "msgstr \"\"\n"; print "\"Project-Id-Version: desktop files\\n\"\n"; - print "\"Report-Msgid-Bugs-To: http://bugs.kde.org\\n\"\n"; + print "\"Report-Msgid-Bugs-To: https://bugs.kde.org\\n\"\n"; print "\"POT-Creation-Date: "; printdate( @now ); print "\\n\"\n"; print "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"; print "\"Last-Translator: FULL NAME \\n\"\n"; print "\"Language-Team: LANGUAGE \\n\"\n"; print "\"MIME-Version: 1.0\\n\"\n"; print "\"Content-Type: text/plain; charset=UTF-8\\n\"\n"; print "\"Content-Transfer-Encoding: 8bit\\n\"\n"; print "\n\n"; } sub processfiles { my ( $files, $basedir) = ( @_ ); for my $filename ( @$files ) { chomp( $filename ); next if -d $filename; open( FH, "<:utf8", $filename ) or warn "Cannot open file $filename"; # print STDERR "Processing $filename...\n"; ### DEBUG my $regexp = qr{^(Name|Comment|Language|Keywords|X-KDE-Keywords|About|Description|GenericName|Query|ExtraNames|X-KDE-Submenu)=(.+)}; # Context is given by preceeding the entry with # ctxt:... comment. # For example, this: # # ctxt: Blah blah # Name=... # ends up as "Name|Blah blah" context in the PO file. my $regexp_ctxt = qr{^\s*#\s*ctxt\s*:\s*(.*?)\s*$}; my $context_free = ""; while( ) { if ( m/$regexp/o ) { my $context = $1; my $msgid = $2; if ($context_free) { $context = "$context|$context_free"; $context =~ s/\\/\\\\/g; $context =~ s/\"/\\\"/g; } chomp( $msgid ); $msgid =~ s/$regexp//; $msgid =~ s/\\/\\\\/g; $msgid =~ s/\"/\\\"/g; if ($msgid =~ m/ +$/) { $msgid =~ s/ +$//; # remove trailing spaces print STDERR "ERROR: white space at the end of $msgid in $filename\n"; } if ($msgid =~ m/\r$/) { $msgid =~ s/[ \r]+$//; # remove trailing space or CR characters print STDERR "ERROR: CR at the end of $msgid in $filename\n"; } $filename =~ s,^$basedir/,,; print "#: $filename:$.\n"; print "msgctxt \"$context\"\n"; print "msgid \"$msgid\"\n"; print "msgstr \"\"\n"; print "\n"; } # Free context refers only to the immediate next line. # Thus, if next line is not extracted, current context is gone. if ( m/$regexp_ctxt/o ) { $context_free = $1; } else { $context_free = ""; } } close( FH ); } } my $onefilelist; my $basedir; GetOptions ( "file-list=s" => \$onefilelist, "base-dir=s" => \$basedir ); prepare; open( FILELIST, $onefilelist ) or warn ( "Cannot open file list: $onefilelist" ); my @thislist = ; processfiles( \@thislist, $basedir ); close( FILELIST ); Index: branches/stable/l10n-kde4/scripts/extract-messages.sh =================================================================== --- branches/stable/l10n-kde4/scripts/extract-messages.sh (revision 1542106) +++ branches/stable/l10n-kde4/scripts/extract-messages.sh (revision 1542107) @@ -1,59 +1,59 @@ #! /bin/bash podir=${podir:-$PWD/po} files=`find . -name Messages.sh` dirs=`for i in $files; do echo \`dirname $i\`; done | sort -u` tmpname="$PWD/messages.log" l10nscripts=`dirname $0` EXTRACTRC=${EXTRACTRC:-extractrc} EXTRACTATTR=${EXTRACTATTR:-extractattr} EXTRACT_GRANTLEE_TEMPLATE_STRINGS=${EXTRACT_GRANTLEE_TEMPLATE_STRINGS:-grantlee_strings_extractor.py} EXTRACT_TR_STRINGS=${EXTRACT_TR_STRINGS:-$(readlink -f $l10nscripts/extract-tr-strings)} MSGCAT=${MSGCAT:-msgcat} PREPARETIPS=${PREPARETIPS:-preparetips} REPACKPOT=${REPACKPOT:-$(readlink -f $l10nscripts/repack-pot.pl)} export EXTRACTRC EXTRACTATTR MSGCAT PREPARETIPS REPACKPOT EXTRACT_GRANTLEE_TEMPLATE_STRINGS EXTRACT_TR_STRINGS if [ "x$IGNORE" = "x" ]; then IGNORE="/tests/" else IGNORE="$IGNORE /tests/" fi for subdir in $dirs; do # skip Messages.sh files of KDevelop's app templates grep '{APPNAMELC}[^ ]*.pot' $subdir/Messages.sh 1>/dev/null && continue test -z "$VERBOSE" || echo "Making messages in $subdir" (cd $subdir if find . -name \*.c\* -o -name \*.h\* | fgrep -v "$IGNORE" | xargs fgrep -s -q KAboutData ; then echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> rc.cpp echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> rc.cpp fi XGETTEXT_FLAGS_QT="--from-code=UTF-8 -C --qt -ktr:1,1t -ktr:1,2c,2t -kQT_TRANSLATE_NOOP:1c,2,2t -kQT_TR_NOOP:1,1t -ktranslate:1c,2,2t -ktranslate:2,3c,3t" - XGETTEXT_FLAGS="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -C --kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 --msgid-bugs-address=http://bugs.kde.org" - XGETTEXT_FLAGS_WWW="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -L PHP -ki18n -ki18n_var -ki18n_noop --msgid-bugs-address=http://bugs.kde.org" + XGETTEXT_FLAGS="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -C --kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 --msgid-bugs-address=https://bugs.kde.org" + XGETTEXT_FLAGS_WWW="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -L PHP -ki18n -ki18n_var -ki18n_noop --msgid-bugs-address=https://bugs.kde.org" export XGETTEXT_FLAGS export XGETTEXT_FLAGS_QT export XGETTEXT_FLAGS_WWW if test -f Messages.sh; then # Note: Messages.sh is supposed to get the translators' placeholder by rc.cpp podir=$podir srcdir=. XGETTEXT_PROGRAM="${XGETTEXT:-xgettext}" XGETTEXT_QT="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS_QT" XGETTEXT_WWW="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS_WWW" XGETTEXT="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS" bash Messages.sh fi exit_code=$? if test "$exit_code" -ne 0; then echo "Bash exit code: $exit_code" fi if [ "x$KEEPRCCPP" = "x" ]; then rm -f rc.cpp fi ) >& $tmpname test -s $tmpname && { echo $subdir ; cat "$tmpname"; } done # Repack extracted templates. find -L $podir -iname '*.pot' | xargs -r -n1 $REPACKPOT rm -f $tmpname Index: branches/stable/l10n-kde4/scripts/extract-xml.sh =================================================================== --- branches/stable/l10n-kde4/scripts/extract-xml.sh (revision 1542106) +++ branches/stable/l10n-kde4/scripts/extract-xml.sh (revision 1542107) @@ -1,57 +1,57 @@ #! /bin/bash podir=${podir:-$PWD/po} files=`find . -name XmlMessages.sh` dirs=`for i in $files; do echo \`dirname $i\`; done | sort -u` tmpname="$PWD/messages.log" INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT:-intltool-extract} INTLTOOL_FLAGS=-q test -z "$VERBOSE" || INTLTOOL_FLAGS= XGETTEXT=${XGETTEXT:-xgettext} # using xgettext 0.15 or later ### TODO what --flags param should be used? -XGETTEXT_FLAGS="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -C --kde --msgid-bugs-address=http://bugs.kde.org" +XGETTEXT_FLAGS="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -C --kde --msgid-bugs-address=https://bugs.kde.org" export INTLTOOL_EXTRACT XGETTEXT XGETTEXT_FLAGS for subdir in $dirs; do test -z "$VERBOSE" || echo "Making XML messages in $subdir" (cd $subdir if test -f XmlMessages.sh; then xml_po_list=`bash -c ". XmlMessages.sh ; get_files"` for xml_file_relpath in $xml_po_list; do xml_file_po=`bash -c ". XmlMessages.sh ; po_for_file $xml_file_relpath"` tags_for_file=`bash -c ". XmlMessages.sh ; tags_for_file $xml_file_relpath"` if [ "x$tags_for_file" != "xcomment" ]; then echo "At the moment we only support extraction of the comment tag, not of $tags_for_file" fi xml_podir=${xml_file_relpath}.podir xml_in_file=$xml_podir/`basename $xml_file_relpath`.in if [ ! -e $xml_podir ]; then mkdir $xml_podir cat $xml_file_relpath | sed -e 's/.*lang=.*//g' | sed -r -e 's/(\<\/?)comment(\>)/\1_comment\2/g' > $xml_in_file if test -s $xml_in_file ; then $INTLTOOL_EXTRACT $INTLTOOL_FLAGS --type='gettext/xml' $xml_in_file $XGETTEXT $XGETTEXT_FLAGS --keyword=N_ -o $podir/${xml_file_po}t ${xml_in_file}.h else echo "Empty preprocessed XML file: $xml_in_file !" fi rm -rf $xml_podir $FILLXMLFROMPO $xml_file_relpath $L10NDIR $SUBMODULE $xml_file_po xmllint $xml_file_relpath --noout else echo "$xml_podir exists!" fi done fi exit_code=$? if test "$exit_code" -ne 0; then echo "Bash exit code: $exit_code" else rm -f rc.cpp fi ) >& $tmpname test -s $tmpname && { echo $subdir ; cat "$tmpname"; } done rm -f $tmpname Index: branches/stable/l10n-kde4/scripts/process-static-messages.sh =================================================================== --- branches/stable/l10n-kde4/scripts/process-static-messages.sh (revision 1542106) +++ branches/stable/l10n-kde4/scripts/process-static-messages.sh (revision 1542107) @@ -1,110 +1,110 @@ #! /bin/bash podir=${podir:-$PWD/po} files=`find . -name StaticMessages.sh` dirs=`for i in $files; do echo \`dirname $i\`; done | sort -u` tmpname="$PWD/messages.log" EXTRACTRC=${EXTRACTRC:-extractrc} EXTRACTATTR=${EXTRACTATTR:-extractattr} EXTRACT_GRANTLEE_TEMPLATE_STRINGS=${EXTRACT_GRANTLEE_TEMPLATE_STRINGS:-grantlee_strings_extractor.py} MSGCAT=${MSGCAT:-msgcat} PREPARETIPS=${PREPARETIPS:-preparetips} REPACKPOT=${REPACKPOT:-repack-pot.pl} export EXTRACTRC EXTRACTATTR MSGCAT PREPARETIPS REPACKPOT EXTRACT_GRANTLEE_TEMPLATE_STRINGS if [ "x$IGNORE" = "x" ]; then IGNORE="/tests/" else IGNORE="$IGNORE /tests/" fi for subdir in $dirs; do test -z "$VERBOSE" || echo "Making static messages export in $subdir" (cd $subdir if test -f StaticMessages.sh; then if find . -name \*.c\* -o -name \*.h\* | fgrep -v "$IGNORE" | xargs fgrep -s -q KAboutData ; then echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> rc.cpp echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> rc.cpp fi XGETTEXT_FLAGS_QT="--from-code=UTF-8 -C --qt -ktr:1,1t -ktr:1,2c,2t -kQT_TRANSLATE_NOOP:1c,2,2t -kQT_TR_NOOP:1,1t -ktranslate:1c,2,2t -ktranslate:2,3c,3t" - XGETTEXT_FLAGS="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -C --kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 --msgid-bugs-address=http://bugs.kde.org" - XGETTEXT_FLAGS_WWW="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -L PHP -ki18n -ki18n_var -ki18n_noop --msgid-bugs-address=http://bugs.kde.org" + XGETTEXT_FLAGS="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -C --kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 --msgid-bugs-address=https://bugs.kde.org" + XGETTEXT_FLAGS_WWW="--copyright-holder=This_file_is_part_of_KDE --from-code=UTF-8 -L PHP -ki18n -ki18n_var -ki18n_noop --msgid-bugs-address=https://bugs.kde.org" export XGETTEXT_FLAGS export XGETTEXT_FLAGS_QT export XGETTEXT_FLAGS_WWW # FILENAME and export_pot_file come from StaticMessages.sh source StaticMessages.sh if test -n "$FILENAME"; then export_pot_file $podir/$FILENAME.pot else echo "StaticMessages.sh in $subdir doesn't define FILENAME" fi FILENAME="" else echo "StaticMessages.sh in $subdir existed seconds ago. This is weird" fi exit_code=$? if test "$exit_code" -ne 0; then echo "Bash exit code: $exit_code" fi ) >& $tmpname test -s $tmpname && { echo $subdir ; cat "$tmpname"; } test -z "$VERBOSE" || echo "Making static messages import in $subdir" (cd $subdir if test -n "$BASEDIR"; then if test -n "$transmod"; then if test -n "$templatename"; then if test -f StaticMessages.sh; then # FILENAME and import_po_files come from StaticMessages.sh source StaticMessages.sh if test -n "$FILENAME"; then # Import the po files temppodir=`mktemp -d` for language in `ls $BASEDIR/$transmod`; do file=$BASEDIR/$transmod/$language/messages/$templatename/$FILENAME.po if [ ! -e $file ]; then continue fi cp $file $temppodir/$language.po done rm -f $temppodir/x-test.po import_po_files $temppodir else echo "StaticMessages.sh in $subdir doesn't define FILENAME" fi FILENAME="" rm -rf $temppodir else echo "StaticMessages.sh in $subdir existed seconds ago. This is weird" fi else echo "templatename not defined, can't run the import step" fi else echo "transmod not defined, can't run the import step" fi else echo "BASEDIR not defined, can't run the import step" fi exit_code=$? if test "$exit_code" -ne 0; then echo "Bash exit code: $exit_code" fi ) >& $tmpname test -s $tmpname && { echo $subdir ; cat "$tmpname"; } done # Repack extracted templates. find -L $podir -iname '*.pot' | xargs -r -n1 $REPACKPOT rm -f $tmpname