Bug 404805

Summary: Add support for major version related pot files
Product: [Translations] i18n Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: Albert Astals Cid <aacid>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: luigi.toscano
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ralf Habacker 2019-02-25 14:58:57 UTC
The current implementation of extract-messages.sh does not support extracting of pot files dedicated for a specific major version.

A related support could be easily added by specifing two additional get text wrapper, which could be used in Messages.sh.

See the following example:

Say we have a major version A and B there should be in version A extract-messages.sh  the following code fragment:

    if test -f Messages.sh; then
        # Note: Messages.sh is supposed to get the translators' placeholder by rc.cpp
       enpodir=$enpodir \
       podir=$podir \
       srcdir=. \
       XGETTEXT_PROGRAM="${XGETTEXT:-xgettext}" \
       XGETTEXT_WWW="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS_WWW" \
       XGETTEXT="kde_xgettext" \
       XGETTEXT_A="kde_xgettext" \
       XGETTEXT_B="true" \
       PACKAGE=$PACKAGE \
       bash Messages.sh
   fi

and in version B 

    if test -f Messages.sh; then
        # Note: Messages.sh is supposed to get the translators' placeholder by rc.cpp
       enpodir=$enpodir \
       podir=$podir \
       srcdir=. \
       XGETTEXT_PROGRAM="${XGETTEXT:-xgettext}" \
       XGETTEXT_WWW="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS_WWW" \
       XGETTEXT="kde_xgettext" \
       XGETTEXT_B="kde_xgettext" \
       XGETTEXT_A="true" \
       PACKAGE=$PACKAGE \
       bash Messages.sh
   fi

In a Message.sh file intended for version A there should be used 

#!/bin/sh
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
$XGETTEXT_A `find . -name \*.cc -o -name \*.cpp -o -name \*.h -name \*.qml` -o $podir/my_version_a.pot
rm rc.cpp

in a Messages.sh file indented for version B 

#!/bin/sh
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
$XGETTEXT_B `find . -name \*.cc -o -name \*.cpp -o -name \*.h -name \*.qml` -o $podir/my_version_b.pot
rm rc.cpp

and in a Messages.sh file indented for version A and B 

#!/bin/sh
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
$XGETTEXT `find . -name \*.cc -o -name \*.cpp -o -name \*.h -name \*.qml` -o $podir/my_version_a_and_b.pot
rm rc.cpp

In the case where a Messages.sh is called for an unsupported major version the gettext related command line is expanded to 

true `find . -name \*.cc -o -name \*.cpp -o -name \*.h -name \*.qml` -o $podir/my_version_b.pot

and is ignored.
Comment 1 Ralf Habacker 2019-02-25 15:03:27 UTC
https://phabricator.kde.org/D19302
Comment 2 Ralf Habacker 2019-02-25 15:05:03 UTC
https://phabricator.kde.org/D19303
Comment 3 Luigi Toscano 2019-02-26 22:28:35 UTC
The branch specific code is handled inside each branch (branches/stable/l10n-kf5, trunk/l10n-kf5, branches/stable/l10n-kde4). Right now alkimia translations (which would be the only user of this) are extracted only into the kf5 branches. Even if  alkimia can be compiled against both Qt4 and Qt5, the translations can be extracted only inside kf5 branch and shipped together in the tarball.