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

--- Comment #39 from Victor Grousset/tuxayo <[email protected]> ---
Comment on attachment 172924
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=172924
Bug 36271: Add circulation rules for booking

Review of attachment 172924:
 --> 
(https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=36271&attachment=172924)
-----------------------------------------------------------------

::: koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js
@@ +1084,5 @@
>          });
>  
>          posting.fail(function (data) {
> +            var error = data.responseJSON.error;
> +            var errorMessage = error ? error : "Failure";

"Failure" will not be extracted to be added to .po. It has to be enclosed in
the right i18n function.

@@ +1089,3 @@
>              $("#booking_result").replaceWith(
>                  '<div id="booking_result" class="alert alert-danger">' +
> +                    _(errorMessage) +

If my notes about the i18n process are correct, _("") wouldn't work in a .js
file. And __("") should be kept.

https://wiki.koha-community.org/wiki/User:Victor_Grousset_-_tuxayo/Translation#Info_about_the_translation_toolchain

Was the change made after witnessing _("") failing and __("") working? Or is
that just a typo?

If the above occurrence of "Failure" is enclosed in the right i18n function.
Then that function can't be used again on the same string. It might work
because passing a translated string won't match a source (english) string in
the .po. And it won't change the string which is already translated. Even if it
works,it's not how the i18n functions should be used.

The root issue is data.responseJSON.error coming from the server. And mixing it
with "Failure". But before handling having a default message. As it stands,
_(errorMessage) will not cause the various detailed error messages sent by the
server to be extracted to -messages-js.po. Having separate .po files means we
can't do a trick by counting on the server side code to make then available
anyway.

You can look for the 3 other occurrences of data.responseJSON.error and they
implement i18n. I don't know if there is still a better way but at least it
should work.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to