Incorrect javascript-format on plasma-pa messages

Harald Sitter sitter at kde.org
Thu Sep 17 09:55:49 BST 2026


Thanks!

I've managed to reproduce it with a bit more time (I was looking at
the wrong code -.-). I've filed a bug with gettext
https://savannah.gnu.org/bugs/?68701 and reverted the change for now.

HS


On Thu, Sep 17, 2026 at 3:11 AM Kisaragi Hiu <mail at kisaragi-hiu.com> wrote:
>
> I can reproduce this with Gettext 1.0.
>
> 1. Take the file with the "Volume at %1%" message https://invent.kde.org/plasma/plasma-pa/-/blob/master/applet/main.qml
> 2. Copy it to eg. /tmp/main.qml
> 3. Call the plasma-pa applet Messages.sh[1] in exactly the way Scripty calls it[2]:
>
>     # I've removed other flags irrelevant to this case for brevity
>     function kde_xgettext {
>         xgettext \
>             --from-code=UTF-8 \
>             -C --kde \
>             "$@"
>     }
>     # Based on the command from applet/Messages.sh but with the variable substituted for brevity & with paths replaced
>     kde_xgettext --language=JavaScript /tmp/main.qml -o /tmp/extracted.po
>
> 4. In this extracted file, "Volume at %1%" is indeed marked as javascript-format
> 5. Set its msgstr to have a space before the second %, like "Volume at %1 %"
> 6. Checking the format does show the reported error
>
>     extracted.po:45: 'msgstr' is not a valid JavaScript format string, unlike 'msgid'. Reason: In the directive number 1, the character ' ' is not a valid conversion specifier.
>
> [1]: plasma-pa applet/Messages.sh https://invent.kde.org/plasma/plasma-pa/-/blob/10f9d903/applet/Messages.sh
> [2]: Scripty's update_translations sets XGETTEXT to the full path of xgettext then calls extract-messages.sh[3] which defines a kde_xgettext function. It then calls each Messages.sh with $XGETTEXT set to kde_xgettext, $XGETTEXT_PROGRAM set to xgettext, among other variables.
>      I wish this interface was documented in eg. Scripty's README and/or other places so developers who need to write Messages.sh would not have to just rely on copying magic around.
> [3]: https://invent.kde.org/sysadmin/l10n-scripty/-/blob/master/extract-messages.sh
>
>
> 2026/09/17 7:45 Harald Sitter <sitter at kde.org>:
>
> Hey!
>
> I've only had time for a quick glance but it looks to me like this may
> be a bug in gettext. Do we know which version of gettext is in use? Do
> we know the exact command it runs?
>
> on gettext 1.0 I utterly fail to reproduce the problem and also don't
> see how we would end up in the code that produces that error :/
>
>
> On Wed, Sep 16, 2026 at 6:40 PM Yoann Laissus <yoann.laissus at gmail.com> wrote:
> >
> > Hello,
> >
> > This morning, our daily scatter script failed due to SVN pre-commit hook:
> >>
> >> <stdin>:109: 'msgstr' is not a valid JavaScript format string, unlike 'msgid'. Reason: The character that terminates the directive number 1
> >> is not a valid conversion specifier
> >
> >
> > It's related to "javascript-format" added to some messages of plasma-pa.
> > The failed message (maybe others) is in plasma_applet_org.kde.plasma.volume.po :
> >>
> >> #: main.qml:96
> >> #, fuzzy, javascript-format
> >> #| msgid "Volume at %1%"
> >> msgid "Volume at %1%"
> >> msgstr "Volume à %1 %"
> >
> >
> > In French (and some other languages), we need to add a non-breaking space before %. It fails because msgfmt considers this invalid with "javascript-format".
> >
> > Last night, scripty changed a lot of format metadata in plasma-pa templates after a change to the gettext command (--language=JavaScript added to Messages.sh) :
> > https://invent.kde.org/plasma/plasma-pa/-/commit/10f9d90348eb59e1914d14da629dc1a21ad9cc2e
> > Template diff : https://invent.kde.org/localization/l10n-templates/-/commit/9fd452f8ecbe8df3e66a89657490005849746820?file_path=trunk6%2Fmessages%2Fplasma-pa%2Fplasma_applet_org.kde.plasma.volume.pot#line_a210c819d_115
> >
> > After some testing with gettext, "javascript-format" is added because of the trailing % in the message. There are multiple occurrences in the qml files of plasma-pa.
> >
> > I'm not really sure of the best way to fix it.
> > We could add some format override to gettext in Messages.sh or before the problematic i18n* calls but the problem can also appear on other projects using --language=JavaScript.
> >
> > What do you think ?
> >
> > Cheers,
> > --
> > Yoann Laissus
>
>


More information about the kde-i18n-doc mailing list