Bugzilla – Attachment 108399 Details for
Bug 26226
Move translatable strings out of biblio_framework.tt and into biblio_framework.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26225: Move translatable strings out of biblio_framework.tt and into biblio_framework.js
Bug-26225-Move-translatable-strings-out-of-bibliof.patch (text/plain), 6.13 KB, created by
Owen Leonard
on 2020-08-17 14:17:26 UTC
(
hide
)
Description:
Bug 26225: Move translatable strings out of biblio_framework.tt and into biblio_framework.js
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-08-17 14:17:26 UTC
Size:
6.13 KB
patch
obsolete
>From 28cb8e15405ecc72805da37805b5ef54fb1ac203 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 17 Aug 2020 13:04:27 +0000 >Subject: [PATCH] Bug 26225: Move translatable strings out of > biblio_framework.tt and into biblio_framework.js > >This patch removes the definition of translatable strings out of >templates and into the corresponding JavaScript file, using the new JS >i81n function. > >To test: > >- Apply the patch, go to Administration -> MARC bibliographic framework. >- Click Actions -> Export and save the file. >- Click Actions -> Import. >- Select a file which isn't CSV or ODS. You should get an error message, > "Please select a CSV (.csv) or ODS (.ods) spreadsheet file." >- Select the file you exported previously and click "Import." You should > see an error message, "Are you sure you want to replace the fields and > subfields for the default framework structure? ..." >- Click "OK." You should see a message in the modal window, "Importing > to framework:..." >- Edit your exported framework file in such a way that it isn't a valid > framework export. >- Repeat the process of importing the file. You should get an error > message, "Error importing the framework..." > >TESTING TRANSLATABILITY > >- Update a translation, e.g. fr-FR: > > > cd misc/translator > > perl translate update fr-FR > >- Open the corresponding .po file for JavaScript strings, e.g. > misc/translator/po/fr-FR-messages-js.po >- Locate strings pulled from > koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js for translation, > e.g.: > > msgid "Please select a CSV (.csv) or ODS (.ods) spreadsheet file" > msgstr "" > >- Edit the "msgstr" string however you want (it's just for testing). >- Install the updated translation: > > > perl translate install fr-FR > >- Switch to your newly translated language in the staff client > and repeat the test plan above. The translated strings should > appear. > >https://bugs.koha-community.org/show_bug.cgi?id=26226 >--- > .../intranet-tmpl/prog/en/modules/admin/biblio_framework.tt | 4 ---- > koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js | 11 ++++++----- > 2 files changed, 6 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt >index bfb8b36e35..a49009b3b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt >@@ -286,10 +286,6 @@ > [% INCLUDE 'datatables.inc' %] > [% Asset.js("js/admin-menu.js") | $raw %] > <script> >- /* Set some variable needed in biblio_framework.js */ >- var MSG_IMPORT_ERROR = _("Error importing the framework"); >- var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv) or ODS (.ods) spreadsheet file."); >- var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s."); > var template_path = "[% interface | html %]/[% theme | html %]"; > </script> > [% Asset.js("js/biblio_framework.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js b/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js >index 1b1337b044..b49fbe9b4f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js >@@ -1,3 +1,4 @@ >+/* global __ */ > /* Import/Export from/to spreadsheet */ > > var importing = false; >@@ -32,14 +33,14 @@ > > var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search); > if (matches && matches.length > 1) { >- alert( MSG_IMPORT_ERROR + " %s".format(decodeURIComponent(matches[1]))); >+ alert( __("Error importing the framework") + " %s".format(decodeURIComponent(matches[1]))); > } > > $('input.input_import').change( function() { > var filename = $(this).val(); > if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) { > $(this).css("background-color","yellow"); >- alert( MSG_SELECT_FILE_FORMAT ); >+ alert( __("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.") ); > $(this).val(""); > $(this).css("background-color","white"); > } >@@ -53,9 +54,9 @@ > var obj = $('#' + id + ' input:file'); > if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) { > var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val(); >- var MSG_OVERWRITE_WARNING = _("Are you sure you want to replace the fields and subfields for the " + frameworkcode + " framework structure? The existing structure will be overwritten! For safety reasons, it is recommended to use the export option to make a backup first."); >+ var MSG_OVERWRITE_WARNING = __("Are you sure you want to replace the fields and subfields for the %s framework structure? The existing structure will be overwritten! For safety reasons, it is recommended to use the export option to make a backup first.").format( frameworkcode ); > if (confirm( MSG_OVERWRITE_WARNING )) { >- $('#importing_' + frameworkcode).find("span").html(MSG_IMPORTING_TO_FRAMEWORK.format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>")); >+ $('#importing_' + frameworkcode).find("span").html( __("Importing to framework: %s. Importing from file: %s.").format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"), "") + "</i>")); > if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { > var timestamp = new Date().getTime(); > $('#importing_' + frameworkcode).find("img").attr('src', template_path + '/img/spinner-small.gif' + '?' +timestamp); >@@ -69,7 +70,7 @@ > return false; > } > obj.css("background-color","yellow"); >- alert( MSG_SELECT_FILE_FORMAT ); >+ alert( __("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.") ); > obj.val(""); > obj.css("background-color","white"); > return false; >-- >2.11.0
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 26226
:
108399
|
110779
|
110786