Bugzilla – Attachment 133813 Details for
Bug 22490
Some strings in JavaScript files are untranslatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22490: Some strings in JavaScript files are untranslatable
Bug-22490-Some-strings-in-JavaScript-files-are-unt.patch (text/plain), 5.12 KB, created by
Jérémy Breuillard
on 2022-04-25 14:51:00 UTC
(
hide
)
Description:
Bug 22490: Some strings in JavaScript files are untranslatable
Filename:
MIME Type:
Creator:
Jérémy Breuillard
Created:
2022-04-25 14:51:00 UTC
Size:
5.12 KB
patch
obsolete
>From f04c2718efb772f2c004bb1dd641064742db9d75 Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Mon, 25 Apr 2022 15:03:32 +0200 >Subject: [PATCH] Bug 22490: Some strings in JavaScript files are > untranslatable > >This patch updates the translation functions of the strings in Javascript files > >Test Plan: >1) Find a string in a popup or from a Javascript file who is still not translated >or >1) Home > Administration > Authority types >2) Make sure to have at least one Authority type saved >3) Click on Action > Import >4) Import button without adding any file to trigger the popup >5) The string inside the popup appears without translation >6) Apply patch and repeat from 3) to 5) : now the string is translated >--- > cataloguing/value_builder/dateaccessioned.pl | 2 +- > cataloguing/value_builder/unimarc_leader.pl | 2 +- > koha-tmpl/intranet-tmpl/js/Gettext.js | 8 ++++---- > koha-tmpl/intranet-tmpl/prog/js/authtype.js | 4 ++-- > 4 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl >index 9d7da193c7..b2b0d4aff8 100755 >--- a/cataloguing/value_builder/dateaccessioned.pl >+++ b/cataloguing/value_builder/dateaccessioned.pl >@@ -50,7 +50,7 @@ function Click$function_name(event) { > > function set_to_today( id, force ) { > /* The force parameter is used in Click but not in Focus ! */ >- if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; } >+ if (! id) { alert(__("Bad id ") + id + __(" sent to set_to_today()")); return 0; } > if (\$("#" + id).val() == '' || force ) { > \$("#" + id).val("$date"); > } >diff --git a/cataloguing/value_builder/unimarc_leader.pl b/cataloguing/value_builder/unimarc_leader.pl >index 838f5a88f0..2232e33667 100755 >--- a/cataloguing/value_builder/unimarc_leader.pl >+++ b/cataloguing/value_builder/unimarc_leader.pl >@@ -36,7 +36,7 @@ sub plugin_javascript { > function Blur$function_name(subfield_managed) { > var leader_length = document.getElementById(\"$field_number\").value.length; > if (leader_length != 24 && leader_length !=0) { >- alert(_('leader has an incorrect size: ' + leader_length + ' instead of 24 chars')); >+ alert(__('leader has an incorrect size: ' + leader_length + ' instead of 24 chars')); > } > return 1; > } >diff --git a/koha-tmpl/intranet-tmpl/js/Gettext.js b/koha-tmpl/intranet-tmpl/js/Gettext.js >index ce6bf96877..9f63bc7e31 100644 >--- a/koha-tmpl/intranet-tmpl/js/Gettext.js >+++ b/koha-tmpl/intranet-tmpl/js/Gettext.js >@@ -35,7 +35,7 @@ Javascript Gettext - Javascript implemenation of GNU Gettext API. > var gt = new Gettext(params); > // create a shortcut if you'd like > function _ (msgid) { return gt.gettext(msgid); } >- alert(_("some string")); >+ alert(__("some string")); > // or use fully named method > alert(gt.gettext("some string")); > // change to use a different "domain" >@@ -71,7 +71,7 @@ Javascript Gettext - Javascript implemenation of GNU Gettext API. > return this.gt.gettext(msgid); > }; > MyNamespace.MyClass.prototype.something = function () { >- var myString = this._("this will get translated"); >+ var myString = this.__("this will get translated"); > }; > > // ////////////////////////////////////////////////////////// >@@ -81,7 +81,7 @@ Javascript Gettext - Javascript implemenation of GNU Gettext API. > function _ (msgid) { > return myGettext.gettext(msgid); > } >- alert( _("text") ); >+ alert( __("text") ); > > // ////////////////////////////////////////////////////////// > // Data structure of the json data >@@ -1210,7 +1210,7 @@ It's still recommended to use the statically defined <script ...> method, which > > =item domain support > >-domain support while using shortcut methods like C<_('string')> or C<i18n('string')>. >+domain support while using shortcut methods like C<__('string')> or C<i18n('string')>. > > Under normal apps, the domain is usually set globally to the app, and a single language file is used. Under javascript, you may have multiple libraries or applications needing translation support, but the namespace is essentially global. > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/authtype.js b/koha-tmpl/intranet-tmpl/prog/js/authtype.js >index f1ce1c87f2..ad6bd83e87 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/authtype.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/authtype.js >@@ -41,7 +41,7 @@ $(document).ready(function() { > var filename = $(this).val(); > if ( ! /(?:\.csv|\.ods)$/.test(filename)) { > $(this).css("background-color","yellow"); >- alert(_("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); >+ alert(__("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); > $(this).val(""); > $(this).css("background-color","white"); > } >@@ -73,7 +73,7 @@ $(document).ready(function() { > } > } > obj.css("background-color","yellow"); >- alert(_("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); >+ alert(__("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); > obj.val(""); > bj.css("background-color","white"); > return false; >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22490
:
133813
|
133906
|
134072
|
134204
|
134207
|
146854
|
146868
|
147337