Bugzilla – Attachment 110815 Details for
Bug 26395
Move translatable strings out of letter.tt into letter.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26395: Move translatable strings out of letter.tt into letter.js
Bug-26395-Move-translatable-strings-out-of-lettert.patch (text/plain), 6.25 KB, created by
David Nind
on 2020-09-27 06:47:11 UTC
(
hide
)
Description:
Bug 26395: Move translatable strings out of letter.tt into letter.js
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-27 06:47:11 UTC
Size:
6.25 KB
patch
obsolete
>From 80d37dd6226c26ff7f32b315fcb3df75bd0241b9 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 4 Sep 2020 19:10:50 +0000 >Subject: [PATCH] Bug 26395: Move translatable strings out of letter.tt into > letter.js > >This patch moves strings defined for translation in letter.tt >into letter.js for translation using the new double-underscore >i81n function. > >Note, the "MSG_NO_NOTICE_FOUND" usage has been removed because it didn't >work. > >To test, apply the patch and go to Tools -> Notices & Slips. > >- Use the "Copy" dropdown to copy an existing notice to a specific > library. >- Save the copied notice. >- Return to the "All libraries" view on the Notices & Slips page. >- Repeat the same process above: Copy the same notice to the same > library. >- When you click save on the "Add notice" page you should get an error > message, "A letter with the code 'ACCTDETAILS' already exists for > <library>" > >- From the "All libraries" view on the Notices & Slips page, copy the > text in the "Code" column of an existing notice. >- Click "New notice" and choose the module of the notice you copied > from. >- On the "Add notice" page, paste the code into the "Code" field and > enter a name in the "Name" field. >- Click "Save" without making any other changes. You should get an error > message, "Please fill at least one template." >- Enter some data into one of the message body fields but not message > subject, and click "Save" again. >- You should get an error, "Please specify title and content for > <notice>" >- Enter data in the message subject field and click "Save" again. >- You should get an error, "A default letter with the code <CODE> > already exists." > >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/letter.js for translation, > e.g.: > > msgid "Please fill at least one template." > 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. > >Signed-off-by: David Nind <david@davidnind.com> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt | 6 ------ > koha-tmpl/intranet-tmpl/prog/js/letter.js | 13 +++++-------- > 2 files changed, 5 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >index 29e89152cc..e51e719aba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >@@ -552,12 +552,6 @@ > var code = '[% code | html %]'; > var new_lettercode = '[% new_lettercode | html %]'; > var new_branchcode = '[% new_branchcode | html %]'; >- var MSG_CODE_EXISTS = _("A default letter with the code '%s' already exists."); >- var MSG_CODE_EXISTS_FOR_LIBRARY = _("A letter with the code '%s' already exists for '%s'."); >- var MSG_EMPTY_TITLE_AND_CONTENT = _("Please specify title and content for %s"); >- var MSG_EMPTY_TEMPLATES = _("Please fill at least one template."); >- var MSG_LOADING = _("Loading"); >- var MSG_NO_NOTICE_FOUND = _("No matching notices found"); > var columns_settings = [% TablesSettings.GetColumns( 'tools', 'notices', 'lettert', 'json' ) | $raw %]; > </script> > [% Asset.js("js/letter.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/letter.js b/koha-tmpl/intranet-tmpl/prog/js/letter.js >index 7f4cb2ef6d..c2e353bfe8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/letter.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/letter.js >@@ -1,5 +1,5 @@ > /* Variables defined in letter.tt: */ >-/* global _ module add_form copy_form no_op_set MSG_EMPTY_TITLE_AND_CONTENT MSG_EMPTY_TEMPLATES code MSG_CODE_EXISTS MSG_CODE_EXISTS_FOR_LIBRARY MSG_NO_NOTICE_FOUND interface theme KohaTable columns_settings */ >+/* global _ module add_form copy_form no_op_set code interface theme KohaTable columns_settings */ > > var modal_loading = "<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+ __('Loading...') +"</div>"; > >@@ -18,9 +18,9 @@ function checkCodes( new_lettercode, new_branchcode ){ > success: function (data) { > if ( data.letters.length > 0 ) { > if( new_branchcode === '' ) { >- alert( MSG_CODE_EXISTS.format(new_lettercode)); >+ alert(__("A default letter with the code '%s' already exists.").format(new_lettercode)); > } else { >- alert( MSG_CODE_EXISTS_FOR_LIBRARY.format(new_lettercode, new_branchcode) ); >+ alert(__("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode)); > } > $(".spinner").hide(); > } else { >@@ -49,9 +49,6 @@ $(document).ready(function() { > { "bSortable": false, "aTargets": [ "nosort" ] }, > { "sType": "title-string", "aTargets" : [ "title-string"] } > ], >- "oLanguage": { >- "sZeroRecords": MSG_NO_NOTICE_FOUND >- }, > "exportColumns": [0,1,2,3], > }, columns_settings); > >@@ -92,7 +89,7 @@ $(document).ready(function() { > ) { > var mtt = $(this).find('input[name="message_transport_type"]').val(); > at_least_one_exists = 1; // Only one template has to be filled in for form to be valid >- alert( MSG_EMPTY_TITLE_AND_CONTENT.format( mtt ) ); >+ alert(__("Please specify title and content for %s").format(mtt)); > are_valid = 0; > } else if ( title.length > 0 && content.length > 0 ) { > at_least_one_exists = 1; >@@ -101,7 +98,7 @@ $(document).ready(function() { > > if ( ! at_least_one_exists ) { > // No templates were filled out >- alert( MSG_EMPTY_TEMPLATES ); >+ alert( __("Please fill at least one template.") ); > 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 26395
:
109683
|
110815
|
110824