https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44108

--- Comment #1 from Jonathan Druart <[email protected]> ---
Created attachment 211610
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211610&action=edit
Bug 44108: Add xt test for strings formatted before translation

Prevent new occurrences like bug 44097, bug 44105 and bug 44107.

This test catches calls to a method on a string literal inside a
translation function, e.g.
    _("%s starting with '%s'".format(field, pattern))
instead of
    _("%s starting with '%s'").format(field, pattern)

It checks .tt, .inc, .js, .ts and .vue files (vendored lib/ excluded)
and handles multi-line calls.

Test plan:
prove xt/find-misplaced-translation-format.t
=> Pass
Revert the previous patches (from 44097 44105 44107)
=> The test fails with
    xt/find-misplaced-translation-format.t .. 1/3
    #   Failed test 'No method called on a string literal inside a translation
function (see bug 44097)'
    #   at xt/find-misplaced-translation-format.t line 64.
    #          got: '4'
    #     expected: '0'
    # koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:504: _("%s
starting with '%s'".format(
    # koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:506: _("%s
containing '%s'".format(
    # koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:532:
_("Surname begins with '%s'".format(
    #
koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingListResource.vue:138:
$__(
    #                                   "Add last %s items to a train".format(
    # Looks like you failed 1 test of 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to