Bug 24875

Summary: Remove extra punctuation from tools home page
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: TemplatesAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: 1joynelson, dcook, hayleypelham, lucas, martin.renvoize
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.05, 19.05.10
Attachments: Bug 24875: Remove extra punctuation from tools start page
Bug 24875: Remove extra punctuation from tools start page
Bug 24875: (follow-up) Remove ending . from Comments
Bug 24875: Remove extra punctuation from tools start page
Bug 24975: Refactor database translations
Bug 24975: Keep the translations, prevent duplicates, and other fixes
Bug 24975: Fix l10n_source definition in kohastructure.sql
Bug 24975: Fix syntax issues
Bug 24975: (follow-up) Rebase for bug 21946
Bug 24975: Use 'key' for translation lookup
Bug 24975: Re-introduce translated_description accessor method
Bug 24975: Add translation_key method example
Bug 24975: Use translation_key in preference to description
Bug 24975: Add to Koha::UI::Form::Builder::Item
Bug 24975: DBIC Build
Bug 24975: Fix bugs
Bug 24975: Pass transation_key in GetItemsInfo

Description Katrin Fischer 2020-03-16 06:45:26 UTC

    
Comment 1 Katrin Fischer 2020-03-16 06:51:08 UTC
Created attachment 100720 [details] [review]
Bug 24875: Remove extra punctuation from tools start page

The patron clubs note was ending with .., but patch also removed
some single . to be consistent with the majority of entries on the
tools page.

To test:
- Check the tools start page for ending . in the notes
- Apply patch
- Verify the punctuation is now consistent
Comment 2 David Cook 2020-03-16 07:02:29 UTC
I loved the initial typo ๐Ÿ˜…
Comment 3 Lucas Gass 2020-03-16 23:29:27 UTC
I think there is still one more under Comments > Moderate patron comments.
Comment 4 Bernardo Gonzalez Kriegel 2020-03-17 15:36:56 UTC
Created attachment 100910 [details] [review]
Bug 24875: Remove extra punctuation from tools start page

The patron clubs note was ending with .., but patch also removed
some single . to be consistent with the majority of entries on the
tools page.

To test:
- Check the tools start page for ending . in the notes
- Apply patch
- Verify the punctuation is now consistent

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 5 Katrin Fischer 2020-03-22 11:04:35 UTC
Created attachment 101351 [details] [review]
Bug 24875: (follow-up) Remove ending . from Comments

Removes another extra ending . from the Comments section
of the tools start page.
Comment 6 Katrin Fischer 2020-03-22 11:04:57 UTC
(In reply to Lucas Gass from comment #3)
> I think there is still one more under Comments > Moderate patron comments.

Thx for the sign-off and pointing this out - added a tiny follow-up with the fix.
Comment 7 Jonathan Druart 2020-03-24 09:53:01 UTC
Created attachment 101523 [details] [review]
Bug 24875: Remove extra punctuation from tools start page

The patron clubs note was ending with .., but patch also removed
some single . to be consistent with the majority of entries on the
tools page.

To test:
- Check the tools start page for ending . in the notes
- Apply patch
- Verify the punctuation is now consistent

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 24875: (follow-up) Remove ending . from Comments

Removes another extra ending . from the Comments section
of the tools start page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Patches squashed
Comment 8 Martin Renvoize 2020-03-24 11:34:01 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Joy Nelson 2020-04-03 22:23:35 UTC
backported to 19.11.x for 19.11.05
Comment 10 Lucas Gass 2020-04-13 20:36:34 UTC
backported to 19.05.x for 19.05.10
Comment 11 Hayley Pelham 2020-04-17 02:06:38 UTC
Enhancement will not be backport to 18.11.x series.
Comment 12 Martin Renvoize 2022-03-30 06:32:17 UTC
Created attachment 132495 [details] [review]
Bug 24975: Refactor database translations

This is an attempt to make the process of translating database strings
(like itemtype descriptions) easier for developers and translators.

For developers by reducing the amount of code needed to enable
translations for a new kind of object (authorised values, letters, news,
...).
For translators by providing a single entry point for all translatable
strings

Table `localization` is replaced by two new tables `l10n_source` and
`l10n_target`. `l10n_source` contains the original text while
`l10n_target` contains the corresponding translations

`l10n_source` is automatically updated whenever an itemtype is
inserted, updated, or deleted, so it is always up to date (this is done
in Koha::Schema::Result::ItemType).
It means that if you delete an itemtype, translations get deleted too.
It also means that if you change an itemtype's description, translations
are lost (not sure if this should be fixed, since if description
changes, translations should probably be changed too)

It adds a new subroutine in Koha::I18N, `db_t`, which returns the
translation for a given context and string, according to the current
language. Translations are stored in memcached (if enabled).

So instead of having to declare a new subroutine
Koha::ItemType::translated_description, you can write
    db_t('itemtype', $itemtype->description)

In templates you can write
    [% ItemTypes.t(itemtype.description) %]

There's also a new page, accessible from the administration main page,
"Localization". It displays all translatable strings and allow to
translate them for all enabled languages.

Test plan:
1. Before applying the patch, make sure you have translated some
   itemtypes. Translations should be kept by the updatedatabase script.
   Before applying the updatedatabase you may want to comment the
   'DROP TABLE localization' statement if you want to keep this table
2. Apply patch, run updatedatabase.pl, run update_dbix_class_files.pl
   and reload starman
3. Go to Admin ยป Localization, verify that you have your itemtypes and
   their translations.
4. Verify that the filter is working (it filters on the source column
   only).
5. Translate some strings by clicking on one of the 'Translate' link,
   entering some text and clicking on the 'Save' button. You can remove
   a translation by emptying the text box.
6. Add a new item type. Verify that it appears in the Localization page
7. Change the description of this item type. Verify that the new
   description appears in Localization page and that the old description
   is gone
8. Delete this item type and verify that its description no longer
   appears in Localization page
9. Navigate through Koha (intranet and opac) in multiple languages and
   verify that item types are translated (if not, please verify in
   master too, not all occurrences were translated)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize 2022-03-30 06:32:22 UTC
Created attachment 132496 [details] [review]
Bug 24975: Keep the translations, prevent duplicates, and other fixes

Translations are no longer lost when you change an itemtype's
description, thanks to a new `l10n_source.key` column which must be
unique within it's "text group" ('itemtype' is a text group)
This also prevent duplicate entries in l10n_source

Columns were renamed to better match their purpose:
* context -> group
* source -> text

Use Koha::Cache::Memory::Lite if other caching systems are not available

Prepend 'l10n:' to the cache key to avoid conflicts

Test plan:
1. DROP TABLE IF EXISTS l10n_target, l10n_source
2. Follow the test plan from previous patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2022-03-30 06:32:26 UTC
Created attachment 132497 [details] [review]
Bug 24975: Fix l10n_source definition in kohastructure.sql
Comment 15 Martin Renvoize 2022-03-30 06:32:30 UTC
Created attachment 132498 [details] [review]
Bug 24975: Fix syntax issues
Comment 16 Martin Renvoize 2022-03-30 06:32:34 UTC
Created attachment 132499 [details] [review]
Bug 24975: (follow-up) Rebase for bug 21946
Comment 17 Martin Renvoize 2022-03-30 06:32:38 UTC
Created attachment 132500 [details] [review]
Bug 24975: Use 'key' for translation lookup

This patch switches from using the original text as a key for
translations to using a dedicated 'key' field.  We also add in a 'fuzzy'
flag to denote when the source text has changed and as such the
pre-existing translations may be incorrect.

ToDo:
1/ Expose 'Fuzzy' on the 'Localization' admin page
2/ Add a 'translation_key' method to Koha::Itemtype to encourage the
adoption of a standardly names accessor to get the 'translation_key'
from a Koha::Object derived class.
Comment 18 Martin Renvoize 2022-03-30 06:32:43 UTC
Created attachment 132501 [details] [review]
Bug 24975: Re-introduce translated_description accessor method
Comment 19 Martin Renvoize 2022-03-30 06:32:47 UTC
Created attachment 132502 [details] [review]
Bug 24975: Add translation_key method example
Comment 20 Martin Renvoize 2022-03-30 06:32:51 UTC
Created attachment 132503 [details] [review]
Bug 24975: Use translation_key in preference to description
Comment 21 Martin Renvoize 2022-03-30 06:32:55 UTC
Created attachment 132504 [details] [review]
Bug 24975: Add to Koha::UI::Form::Builder::Item
Comment 22 Martin Renvoize 2022-03-30 06:32:59 UTC
Created attachment 132505 [details] [review]
Bug 24975: DBIC Build
Comment 23 Martin Renvoize 2022-03-30 06:33:03 UTC
Created attachment 132506 [details] [review]
Bug 24975: Fix bugs
Comment 24 Martin Renvoize 2022-03-30 06:33:07 UTC
Created attachment 132507 [details] [review]
Bug 24975: Pass transation_key in GetItemsInfo