[Bug 24975] New: Refactor database translations
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Bug ID: 24975 Summary: Refactor database translations Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: I18N/L10N Assignee: julian.maurice@biblibre.com Reporter: julian.maurice@biblibre.com QA Contact: testopia@bugs.koha-community.org CC: frederic@tamil.fr, jonathan.druart@bugs.koha-community.org This is an attempt to make the process of translating database strings (like itemtype descriptions) easier for developers and translators. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 101703 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101703&action=edit 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) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- That looks like a great idea. What about the interface (for AVs)? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=20307 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24977 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24977 [Bug 24977] Enable translations for authorised values (POC) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 101786 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101786&action=edit 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 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bgkriegel@gmail.com, | |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Thanks for picking this up Julian, it's looking great so far! :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #101703|0 |1 is obsolete| | --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 102387 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102387&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #101786|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 102388 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102388&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- I like this, and it's working pretty well in testing.. few comments however 1/ The 'Localization' option appears in the admin home screen whether or not you have any translations installed.. if you then navigate into it you get an ajax request that fails for the datatable if there are no translations available. 2/ You switch from Koha::Object classes to plain DBIx ResultSets.. was that deliberate and if so can you explain why (I'm betting it was a performance perspective?) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Martin Renvoize from comment #7)
I like this, and it's working pretty well in testing.. few comments however
1/ The 'Localization' option appears in the admin home screen whether or not you have any translations installed.. if you then navigate into it you get an ajax request that fails for the datatable if there are no translations available. 2/ You switch from Koha::Object classes to plain DBIx ResultSets.. was that deliberate and if so can you explain why (I'm betting it was a performance perspective?)
Both points answered on IRC.. 1/ was a mistake my end.. forgot to rebuild the schema's after applying the patches on second test run. Signing off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #9 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #7)
2/ You switch from Koha::Object classes to plain DBIx ResultSets.. was that deliberate and if so can you explain why (I'm betting it was a performance perspective?)
(pasting my answer on IRC here for reference:) I had performance in mind (but i did not measure it), but also, some parts of Koha use DBIx::Class directly, so by putting the code at DBIX::Class level it should work whether you use dbix::class or koha::objects. Thanks for testing :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jonathan.druart@bugs.koha-c |y.org |ommunity.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102387|0 |1 is obsolete| | --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102513 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102513&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102388|0 |1 is obsolete| | --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102514 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102514&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #12 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- It does not work for me. The table does not load on admin/localization.pl DBIx::Class::Storage::DBI::_dbh_execute(): Unknown column 'me.context' in 'field list' at /kohadevbox/koha/svc/localization line 35 I rebased the patches because of conflicts with bug 4944. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #13 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Jonathan Druart from comment #12)
It does not work for me. The table does not load on admin/localization.pl
DBIx::Class::Storage::DBI::_dbh_execute(): Unknown column 'me.context' in 'field list' at /kohadevbox/koha/svc/localization line 35
You should probably recreate the DBIx schema files, 'context' has been renamed 'group' in the last patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #14 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 102688 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102688&action=edit Bug 24975: Fix l10n_source definition in kohastructure.sql -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #15 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102701 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102701&action=edit Bug 24975: Fix syntax issues -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I've talked a bit with Julian, and there is something that is not correct IMO. The translation for the item type "BK/Books" is picked using its description, "Books". Which means that if we have another itemtype with the same description "BK2/Books", its translation string will be used for BK. For instance: BK/Books translated in fr-FR => "Livre" BK2/Books translated in fr-FR => "Autre livre" Item type BK will be display "Autre livre" in French. I should also note that the collation for the 2 new tables is utf8mb4_bin (instead of the usual utf8mb4_unicode_ci), to differentiate "Book" and "book". But I have tried: BK/Books translated in fr-FR => "Livre" BK2/books translated in fr-FR => "Autre livre" An I still see "Autre livre" for "BK/Books". I know it does not make a lot a sense in a real-life situation, but I think we hit a design issue. This problem might be highlighted even more for AV, when we will need to take into account the "interface". I think we should rethink this a bit and have (add back) a method at Koha::ItemType level to retrieve the translated string. That will give us more flexibility for future changes (now we need to update all the occurrences of db_t). I still think this implementation is better than the original one, but it still need a bit of tuning to be ready IMO. Failing QA/In Discussion. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #17 from Julian Maurice <julian.maurice@biblibre.com> ---
I still think this implementation is better than the original one, but it still need a bit of tuning to be ready IMO.
I think there is no perfect solution, but maybe the best solution, and the simplest one, is to go back to using the code of itemtype/AV, instead of the description, like you suggested. With codes there will be no duplicates, and no collation issues. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #18 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Are you hoping to continue here Julian.. it's looking so promising :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #19 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #18)
Are you hoping to continue here Julian.. it's looking so promising :)
Yes. I don't know when but I will continue -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_20_11_target -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |In Discussion --- Comment #20 from Julian Maurice <julian.maurice@biblibre.com> --- I've been rethinking about this. If we fetch a translation using a key like "itemtype-BK", or "authorisedvalue-CCODE-FIC-OPAC" it might work well for these two type of entities, because there would be a 1:1 relationship between every string and its translation, and there should not be too much duplicated translations. But what if we want to make MARC frameworks translatable too ? Say I have 10 frameworks that share 95% of their field/subfield descriptions, I'll have to translate each of these strings 10 times, because there would be a translation for "framework-FW1-245a-OPAC" and another for "framework-FW2-245a-OPAC" and so on. Waste of time and DB space. So I think it would be better to fetch a translation using the text, for instance "framework-Title". That way every field/subfield description in a MARC framework that is "Title" would be translated the same way and the translator would need to translate it only once. Bonus: if you create a new framework it will already be translated. Now there is still a design issue with the current implementation (comment 16) where Koha allows to give multiple translations to the same original text, but only one of those will be picked and the others will never show up. I think it can be solved by using a different db schema, but before going into more details I would like to hear what people think about the "key vs text" topic. By the way, I think the collation issue in comment 16 was in fact a cache issue. The cache is not always cleared when it should be, and I tested the exact same example and it worked for me. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #21 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Julian Maurice from comment #20)
I've been rethinking about this.
If we fetch a translation using a key like "itemtype-BK", or "authorisedvalue-CCODE-FIC-OPAC" it might work well for these two type of entities, because there would be a 1:1 relationship between every string and its translation, and there should not be too much duplicated translations. But what if we want to make MARC frameworks translatable too ? Say I have 10 frameworks that share 95% of their field/subfield descriptions, I'll have to translate each of these strings 10 times, because there would be a translation for "framework-FW1-245a-OPAC" and another for "framework-FW2-245a-OPAC" and so on. Waste of time and DB space.
So I think it would be better to fetch a translation using the text, for instance "framework-Title". That way every field/subfield description in a MARC framework that is "Title" would be translated the same way and the translator would need to translate it only once. Bonus: if you create a new framework it will already be translated.
Now there is still a design issue with the current implementation (comment 16) where Koha allows to give multiple translations to the same original text, but only one of those will be picked and the others will never show up. I think it can be solved by using a different db schema, but before going into more details I would like to hear what people think about the "key vs text" topic.
By the way, I think the collation issue in comment 16 was in fact a cache issue. The cache is not always cleared when it should be, and I tested the exact same example and it worked for me.
I'm confused.. you seem to suggest shifting from code based keys to description based keys and then revert again in the next paragraph. I feel like we should be using code based keys for flexability/reliability but allow for a fallback chain for cases like frameworks.. so for example 'framework-FW2-245a-OPAC' could fallback to a 'framework-*-245a-OPAC' for a case where the FW2 specific case doesn't exist? I need to look at the code again to really get to grips with that suggestion so please feel free to cast it aside if it's non-sense. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #22 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #21)
(In reply to Julian Maurice from comment #20)
I've been rethinking about this.
If we fetch a translation using a key like "itemtype-BK", or "authorisedvalue-CCODE-FIC-OPAC" it might work well for these two type of entities, because there would be a 1:1 relationship between every string and its translation, and there should not be too much duplicated translations. But what if we want to make MARC frameworks translatable too ? Say I have 10 frameworks that share 95% of their field/subfield descriptions, I'll have to translate each of these strings 10 times, because there would be a translation for "framework-FW1-245a-OPAC" and another for "framework-FW2-245a-OPAC" and so on. Waste of time and DB space.
So I think it would be better to fetch a translation using the text, for instance "framework-Title". That way every field/subfield description in a MARC framework that is "Title" would be translated the same way and the translator would need to translate it only once. Bonus: if you create a new framework it will already be translated.
Now there is still a design issue with the current implementation (comment 16) where Koha allows to give multiple translations to the same original text, but only one of those will be picked and the others will never show up. I think it can be solved by using a different db schema, but before going into more details I would like to hear what people think about the "key vs text" topic.
By the way, I think the collation issue in comment 16 was in fact a cache issue. The cache is not always cleared when it should be, and I tested the exact same example and it worked for me.
I'm confused.. you seem to suggest shifting from code based keys to description based keys and then revert again in the next paragraph. Sorry for the confusion... where did I lost you exactly ? :) Just to be clear, I suggest description based keys.
I feel like we should be using code based keys for flexability/reliability but allow for a fallback chain for cases like frameworks.. so for example 'framework-FW2-245a-OPAC' could fallback to a 'framework-*-245a-OPAC' for a case where the FW2 specific case doesn't exist? But what if the description of 245a for FW2 is different from the 245a of default framework ? Won't we have a wrong translation ?
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #23 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- I'm coming back around to keying on the original text now rather than a definitive unique key. However, I think we should allow for the key to be passed in additional and perhaps other variables too eventually. My thinking behind this is all the various options we have now for plural forms and the likes in the rest of the translation system. It's those cases I could see requiring additional options to refine which version of a translation to 'pick'. So.. my thinking is along the lines db_t($itype->itemtype, $itype->description, { key => $itype->code, count => $x }); Where the first two params are required, but the hashref or additional arguments is optional depending on the situation. This way, we can key on the description text and allow for passing the code as an option to allow for more specific selection it it exists but fallback to just description as the key if it does not. Something similar to the way we allow falling back through rules in the circ rules system.. if the more specific case doesn't exist we trap the less specific case. I'll have a little play with the code but I think this could end up flexible enough to support future expansions and allow for more and less specific cases in translation as required. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #24 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Katrin, Bernardo, can you give us your feeling on this topic please? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #25 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Code speaks more than words.. I've been having a play with a couple of followups to use a 'key' rather than rely on the string as the key for lookup, adding 'fuzzy' support and re-introducing an accessor method on the Koha::ItemType object: https://gitlab.com/mrenvoize/Koha/-/commits/bug_24975 Still a work in progress but would love some feedback as to whether this might be a route to adopt. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #26 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #25)
Code speaks more than words.. I've been having a play with a couple of followups to use a 'key' rather than rely on the string as the key for lookup, adding 'fuzzy' support and re-introducing an accessor method on the Koha::ItemType object:
https://gitlab.com/mrenvoize/Koha/-/commits/bug_24975
Still a work in progress but would love some feedback as to whether this might be a route to adopt.
Does it solve the problem we mentioned with framework translations ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #27 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- We key on new 'key' field. So it leaves it up to the person whome implements the next translatable feature to pick an appropriate key. For frameworks I would suggest a group of 'framework' and a key of 'marc field'.. thus allowing to translate at the default framework level but keep marc fields distinct for the cases as mentioned by Jonas on IRC. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #28 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- What I'm also tempted to do is add a standardly named accessor be to objects with translatable fields.. ->translation_key which would produce the right key from the internal fields behind the scenes. So for itemtype it simply passes through itemtype, but for a it might pass $code_$interface for example. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #29 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #27)
We key on new 'key' field. So it leaves it up to the person whome implements the next translatable feature to pick an appropriate key.
For frameworks I would suggest a group of 'framework' and a key of 'marc field'.. thus allowing to translate at the default framework level but keep marc fields distinct for the cases as mentioned by Jonas on IRC.
I'm confused. Do you mean something like db_t('framework', 'marc field', { marc_field => '245a', type => 'opac' }) or db_t('framework', '245a-opac') or db_t('framework-FW1', '245a-opac') or something else ? I could not find what Jonas mentioned on IRC, that probably doesn't help me to understand :) Can you paste it or summarize it here ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #30 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Julian Maurice from comment #29)
(In reply to Martin Renvoize from comment #27)
We key on new 'key' field. So it leaves it up to the person whome implements the next translatable feature to pick an appropriate key.
For frameworks I would suggest a group of 'framework' and a key of 'marc field'.. thus allowing to translate at the default framework level but keep marc fields distinct for the cases as mentioned by Jonas on IRC.
I'm confused. Do you mean something like db_t('framework', 'marc field', { marc_field => '245a', type => 'opac' }) or db_t('framework', '245a-opac') or db_t('framework-FW1', '245a-opac') or something else ?
I could not find what Jonas mentioned on IRC, that probably doesn't help me to understand :) Can you paste it or summarize it here ?
db_t('framework', '245a'); or if you need it at an interface level too db_t('framework', '245a-opac'); i.e. We leave defining the granularity of the key to the developer adding the translation option to the component and we discus that granularity there. What I've not done is any form of fallback system.. i.e. if we wanted to allow one to optionally define translations at a more granular level, for per framework for example. example db_t('framework', 'FA-245a');.. fall back to just '245a' if the 'FA-' translation doesn't exist. I felt that was out of scope for here.. and perhaps not really required. I'll go dig out the IRC log. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #31 from Martin Renvoize <martin.renvoize@ptfs-europe.com> ---
kohaputti maybe 013e and 583l could use different translations in finnish, 583l = "Kunto" and 013l = "Tila" I mean you could translate Kunto also as Tila I guess so not the best example but someone could do it like this... kohaputti a safe bet here would be frameworks+field+subfield, the meaning cannot change between different frameworks, can it? Also, why even allow changing the descriptions for each framework separately
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #32 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- To add detail to that.. it's two different translations for the single word 'Status' in English for the Finnish translation. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #33 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #30)
db_t('framework', 'FA-245a');.. fall back to just '245a' if the 'FA-' translation doesn't exist. I felt that was out of scope for here.. and perhaps not really required.
The problem with that is that we don't know if we should fall back. 245a may have a completely different description in FA than in default framework. (Well maybe not for 245a, but you get the point) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #34 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- My point is.. I've tried to make it flexible enough without introducing too much additional overhead/code complexity here. I suggest we should not second guess the level of translation requirements/granularity of different components here but rather defer that to each bug introducing additional translation options. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #35 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Martin Renvoize from comment #28)
What I'm also tempted to do is add a standardly named accessor be to objects with translatable fields.. ->translation_key which would produce the right key from the internal fields behind the scenes. So for itemtype it simply passes through itemtype, but for a it might pass $code_$interface for example.
That means Koha::Object(s) should be aware of the interface (opac/staff) ? :/ (In reply to Martin Renvoize from comment #34)
My point is.. I've tried to make it flexible enough without introducing too much additional overhead/code complexity here. I suggest we should not second guess the level of translation requirements/granularity of different components here but rather defer that to each bug introducing additional translation options. We have the same goal, just different opinions on how to achieve that. If we do it right from the beginning, making more kind of objects translatable will be easier. I think it's worth taking some time to think about it.
By using codes as translation key, it can work for MARC frameworks too, but it will require to translate the same strings multiple times. To avoid that, we would need to implement some kind of fallback mechanism. By using descriptions as translation key, there is no need for fallback. Every string have to be translated only once. However it doesn't allow to translate the same string in different ways (like in comment 31). Doing that will also require a fallback mechanism. So, do we want to use a code as key (eg. "245a") and refine with other codes ("FW2"), or do we want to use a description as key (eg. "Title") and refine with other codes ("FW2", "245a") ? I'd say the fallback for a description-based key is more likely to be accurate ("Kunto" is not very different in meaning from "Tila"), whereas a fallback for a code-based key can be simply wrong if descriptions are different. Now that I think about it, this refinement system could also include the group ("itemtype", "framework", ...) so we'd have to translate "Title" only once, and it would be translated everywhere the same way, except if one add a different translation for [framework, FW2, 245a] for instance. That being said, I recognize that frameworks are a particular case, and it may not be worth it to add all these translation features just for that. But having a separate translation system for frameworks is not ideal either... It would be simpler if all frameworks shared their descriptions :) BTW, I really like the idea of "fuzzy" you've added -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|jonathan.druart@bugs.koha-c | |ommunity.org | Keywords|rel_20_11_target |rel_21_05_candidate --- Comment #36 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Could we get a work team on this one and target 21.05? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |RM_priority -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #37 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Also very interested in this, can provide testing and QA. A quick discussion on how to approach this would be nice! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |23681 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23681 [Bug 23681] Patron restrictions should be user definable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_21_05_candidate |rel_21_11_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Patrick Robitaille <patrick.robitaille@collecto.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |patrick.robitaille@collecto | |.ca -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Marjorie Barry-Vila <marjorie.barry-vila@collecto.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marjorie.barry-vila@collect | |o.ca -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_21_11_candidate, | |RM_priority | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|23681 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23681 [Bug 23681] Patron restrictions should be user definable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #38 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Any news here ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #39 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- I think my branch contained the latest in progress work.. but it needs a non-trivial rebase. My hope is to catc Jonathan and Julian at Hackfest to work through the final details... it feels so close! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #40 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 132388 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132388&action=edit Bug 24975: Fix bugs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #41 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- This patch fixes 3 500 errors, to apply on top of Martin's remote branch. I translated Books to "Livres" in fr-FR, install templates for fr-FR but there is nothing displayed. At least on the item table of the catalogue/detail.pl page. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102513|0 |1 is obsolete| | --- Comment #42 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132508 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132508&action=edit 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> https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102514|0 |1 is obsolete| | --- Comment #43 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132509 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132509&action=edit 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> https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102688|0 |1 is obsolete| | --- Comment #44 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132510 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132510&action=edit Bug 24975: Fix l10n_source definition in kohastructure.sql https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102701|0 |1 is obsolete| | --- Comment #45 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132511 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132511&action=edit Bug 24975: Fix syntax issues https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #46 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132512 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132512&action=edit Bug 24975: (follow-up) Rebase for bug 21946 https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #47 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132513 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132513&action=edit 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. https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #48 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132514 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132514&action=edit Bug 24975: Re-introduce translated_description accessor method https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #49 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132515 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132515&action=edit Bug 24975: Add translation_key method example https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #50 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132516 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132516&action=edit Bug 24975: Use translation_key in preference to description https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #51 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132517 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132517&action=edit Bug 24975: Add to Koha::UI::Form::Builder::Item https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #52 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132518 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132518&action=edit Bug 24975: DBIC Build https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132388|0 |1 is obsolete| | --- Comment #53 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132519 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132519&action=edit Bug 24975: Fix bugs https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #54 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132520 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132520&action=edit Bug 24975: Pass transation_key in GetItemsInfo https://bugs.koha-community.org/show_bug.cgi?id=24875 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132508|0 |1 is obsolete| | --- Comment #55 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132521 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132521&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132509|0 |1 is obsolete| | --- Comment #56 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132522 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132522&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132510|0 |1 is obsolete| | --- Comment #57 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132523 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132523&action=edit Bug 24975: Fix l10n_source definition in kohastructure.sql -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132511|0 |1 is obsolete| | --- Comment #58 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132524 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132524&action=edit Bug 24975: Fix syntax issues -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132512|0 |1 is obsolete| | --- Comment #59 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132525 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132525&action=edit Bug 24975: (follow-up) Rebase for bug 21946 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132513|0 |1 is obsolete| | --- Comment #60 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132526 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132526&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132514|0 |1 is obsolete| | --- Comment #61 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132527 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132527&action=edit Bug 24975: Re-introduce translated_description accessor method -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132515|0 |1 is obsolete| | --- Comment #62 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132528 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132528&action=edit Bug 24975: Add translation_key method example -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132516|0 |1 is obsolete| | --- Comment #63 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132529 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132529&action=edit Bug 24975: Use translation_key in preference to description -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132517|0 |1 is obsolete| | --- Comment #64 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132530 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132530&action=edit Bug 24975: Add to Koha::UI::Form::Builder::Item -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132518|0 |1 is obsolete| | --- Comment #65 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132531 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132531&action=edit Bug 24975: DBIC Build -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132519|0 |1 is obsolete| | --- Comment #66 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132532 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132532&action=edit Bug 24975: Fix bugs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132520|0 |1 is obsolete| | --- Comment #67 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132533 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132533&action=edit Bug 24975: Pass transation_key in GetItemsInfo -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff --- Comment #68 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Right... that's my branch rebased and a few bugs fixed and all uploaded to here. This includes the work I did on translation_key as an example.. i'm envisaging something along the lines of below for AV's as another example. sub translation_key { return $self->code . ":" . C4::Context->interface; } In the itemtypes case I've cheated slighty with translation key stuff.. as it is just retunring itemtype behind the scenes I didn't go ahead and expose it more widely in C4::Search for example. Still need to expose the 'fuzzy' flagging in the UI... but that should be trivial to do. I think the 'code' vs 'description' issues may have gone away with the frameworks having been moved into pootle translations now. Hopefully this gives us a point to delve back in. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #69 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132546 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132546&action=edit Bug 24975: Fix bug -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132521|0 |1 is obsolete| | --- Comment #70 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132562 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132562&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132522|0 |1 is obsolete| | --- Comment #71 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132563 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132563&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132523|0 |1 is obsolete| | --- Comment #72 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132564 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132564&action=edit Bug 24975: Fix l10n_source definition in kohastructure.sql -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132524|0 |1 is obsolete| | --- Comment #73 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132565&action=edit Bug 24975: Fix syntax issues -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132525|0 |1 is obsolete| | --- Comment #74 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132566 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132566&action=edit Bug 24975: (follow-up) Rebase for bug 21946 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132526|0 |1 is obsolete| | --- Comment #75 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132567 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132567&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132527|0 |1 is obsolete| | --- Comment #76 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132568 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132568&action=edit Bug 24975: Re-introduce translated_description accessor method -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132528|0 |1 is obsolete| | --- Comment #77 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132569 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132569&action=edit Bug 24975: Add translation_key method example -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132529|0 |1 is obsolete| | --- Comment #78 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132570 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132570&action=edit Bug 24975: Use translation_key in preference to description -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132530|0 |1 is obsolete| | --- Comment #79 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132571 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132571&action=edit Bug 24975: Add to Koha::UI::Form::Builder::Item -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132532|0 |1 is obsolete| | --- Comment #80 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132572 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132572&action=edit Bug 24975: Fix bugs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132533|0 |1 is obsolete| | --- Comment #81 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132573 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132573&action=edit Bug 24975: Pass transation_key in GetItemsInfo -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132531|0 |1 is obsolete| | --- Comment #82 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132574 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132574&action=edit Bug 24975: DBIC Build -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #83 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 132575 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132575&action=edit Bug 24975: Fix db_t The query here is difficult.. I wanted to return FULL LEFT JOIN, but filtering on the joined data (l10n_targets.language) means we drop the l10n_source rows where there are no corresponding l10n_targets with language code. I tried setting `l10n_targets.language => [ $language, undef ]` to include null values, but that doesn't work either. I then tried coming up with a correlate subquery instead of the join and couldn't get dbic to play nicely there either. As such, I've fallen back to multiple queries over the relationship.. I'm sure we can do better... but this works for now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #84 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Ready for testing.. Code wise, we should merge lots of these commits.. they're messy right now but show the thought process as they are. Testing wise, ensure the itemtype translations continue to all work as expected. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Joonas Kylmälä <joonas.kylmala@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@iki.fi Status|Needs Signoff |Patch doesn't apply --- Comment #85 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- (In reply to Martin Renvoize from comment #84)
Ready for testing..
Martin, I assume the patches attached to this bug report from you are the latest. They don't apply anymore. Could you do a rebase? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #86 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Ping Martin -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Lauren Denny <lauren_denny@sil.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lauren_denny@sil.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #132546|0 |1 is obsolete| | Attachment #132562|0 |1 is obsolete| | Attachment #132563|0 |1 is obsolete| | Attachment #132564|0 |1 is obsolete| | Attachment #132565|0 |1 is obsolete| | Attachment #132566|0 |1 is obsolete| | Attachment #132567|0 |1 is obsolete| | Attachment #132568|0 |1 is obsolete| | Attachment #132569|0 |1 is obsolete| | Attachment #132570|0 |1 is obsolete| | Attachment #132571|0 |1 is obsolete| | Attachment #132572|0 |1 is obsolete| | Attachment #132573|0 |1 is obsolete| | Attachment #132574|0 |1 is obsolete| | Attachment #132575|0 |1 is obsolete| | --- Comment #87 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149941 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149941&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #88 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149942 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149942&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #89 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149943 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149943&action=edit Bug 24975: Fix l10n_source definition in kohastructure.sql -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #90 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149944 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149944&action=edit Bug 24975: Fix syntax issues -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #91 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149945 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149945&action=edit Bug 24975: (follow-up) Rebase for bug 21946 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #92 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149946 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149946&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #93 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149947 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149947&action=edit Bug 24975: Re-introduce translated_description accessor method -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #94 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149948 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149948&action=edit Bug 24975: Add translation_key method example -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #95 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149949 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149949&action=edit Bug 24975: Use translation_key in preference to description -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #96 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149950 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149950&action=edit Bug 24975: Add to Koha::UI::Form::Builder::Item -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #97 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149951 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149951&action=edit Bug 24975: Fix bugs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #98 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149952 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149952&action=edit Bug 24975: DBIC Build -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #99 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149953 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149953&action=edit Bug 24975: Fix db_t The query here is difficult.. I wanted to return FULL LEFT JOIN, but filtering on the joined data (l10n_targets.language) means we drop the l10n_source rows where there are no corresponding l10n_targets with language code. I tried setting `l10n_targets.language => [ $language, undef ]` to include null values, but that doesn't work either. I then tried coming up with a correlate subquery instead of the join and couldn't get dbic to play nicely there either. As such, I've fallen back to multiple queries over the relationship.. I'm sure we can do better... but this works for now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #100 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149954 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149954&action=edit Bug 24975: Some more fixes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|julian.maurice@biblibre.com |jonathan.druart+koha@gmail. | |com --- Comment #101 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Patches rebased, not without troubles... IMO there are inconsistencies in the way we deal with itemtypes, and we should correct that in this patch set. We should always either call db_t in the script and pass the translated version to the template, or pass the object and let the template deals with it. Ready for testing (spoiler: it is full of bugs). Remote branch pushed to https://gitlab.com/joubu/Koha/-/commits/bug_24975 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #102 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- If this has not moved forward in 2 months I won't be back to it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #103 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 149956 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149956&action=edit Bug 24975: (follow-up) Fix dbrev -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #104 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- DataTables warning: table id=localization - Ajax error. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #105 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 149957 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149957&action=edit Bug 24975: WIP remove db_t from controllers This is not done yet, for discussion. I don't think we should call db_t in controllers, or we do it better, but now it's confusing. This patch may impact performances, as we are not caching the itemtype object. Ideas? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #106 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- An error occurred : Inconsistent hierarchy during C3 merge of class 'Koha::I18N': current merge results [ Koha::I18N, ] merging failed on 'Exporter' at /app/qatools/koha-qa.pl line 112. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #107 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Will post some more comments tomorrow. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #108 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Some findings in random order: I am missing an Add button on admin/localization. You can clear a record and remove it; but perhaps adding a Delete button would be nice too. Not sure why we are using DBIC here instead of Koha objects. No performance figures are given to justify. Koha::Object should be our standard. opac/opac-search.pl my $description = $itemtypes->{$itemtype}->{iscat} ? $itemtypes->{$itemtype}->{description} - : db_t('itemtype', Koha::ItemTypes->find($itemtype)->itemtype); + : Koha::ItemTypes->find($itemtype)->translated_description; $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{}; Weird code. package Koha::Template::Plugin::ItemTypes; sub GetDescription { return $parent ? $self->t($parent->description) . "->" . $self->t($itemtype->description) : $self->t($itemtype->description); Omission for switching to itemtype. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #109 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- There is still something confusing in the table design: select * from l10n_source; +----------------+----------+-----+------------------------+ | l10n_source_id | group | key | text | +----------------+----------+-----+------------------------+ | 1 | itemtype | BK | Books | | 2 | itemtype | BKS | Books | | 3 | itemtype | CF | Computer Files | select * from l10n_target; +----------------+----------------+----------+-----------------+-------+ | l10n_target_id | l10n_source_id | language | translation | fuzzy | +----------------+----------------+----------+-----------------+-------+ | 2 | 1 | nl-NL | Boek | 0 | | 3 | 2 | en | BKS_EN | 0 | | 4 | 2 | nl-NL | Boek | 0 | The source seems to be the English text. But I can translate it into EN again via target. Easiest seems to be: prevent having EN in the target table. Shouldnt we check if we are calling db_t btw for an English translation? We should not be looking for the English translation of itemtype if we have the description already in our object. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #110 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- db_t could be made more flexible? Now we look for key and we removed description. But I think we should support both. Not sure how the concept of localization group will grow. But it might be too big soon for loading all its sources and finding corresponding translations. (The code needs a join here.) For instance, thinking about AV, I am probably only interested in a particular category and not in all entries under 'authorised_values' if that was the group. Other areas may have other needs again. This is a quite fundamental issue on the design of db_t. It feels not complete. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #111 from Jonathan Druart <jonathan.druart+koha@gmail.com> ---
Bug 24975: Add translation_key method example
This breaks the whole logic. If there is no translation we are displaying the code instead of the non-translated description. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #112 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Jonathan Druart from comment #111)
Bug 24975: Add translation_key method example
This breaks the whole logic. If there is no translation we are displaying the code instead of the non-translated description.
Forget that, that's not correct. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #113 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Marcel de Rooy from comment #108)
Some findings in random order:
I am missing an Add button on admin/localization. You can clear a record and remove it; but perhaps adding a Delete button would be nice too.
What would you like to add? You are not supposed to need it, at least for now.
Not sure why we are using DBIC here instead of Koha objects. No performance figures are given to justify. Koha::Object should be our standard.
It avoids 2 new packages, Koha::I18N::L10nSource[s]? I would go without them to start with this approach, please keep things as simple as possible.
opac/opac-search.pl my $description = $itemtypes->{$itemtype}->{iscat} ? $itemtypes->{$itemtype}->{description} - : db_t('itemtype', Koha::ItemTypes->find($itemtype)->itemtype); + : Koha::ItemTypes->find($itemtype)->translated_description; $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{}; Weird code.
All this "itemtype category" code is ugly, but why is this part weird? (there is a comment above about non-translatability of item type categories)
package Koha::Template::Plugin::ItemTypes; sub GetDescription { return $parent ? $self->t($parent->description) . "->" . $self->t($itemtype->description) : $self->t($itemtype->description); Omission for switching to itemtype.
Should be fixed now. (In reply to Marcel de Rooy from comment #109)
There is still something confusing in the table design: select * from l10n_source; +----------------+----------+-----+------------------------+ | l10n_source_id | group | key | text | +----------------+----------+-----+------------------------+ | 1 | itemtype | BK | Books | | 2 | itemtype | BKS | Books | | 3 | itemtype | CF | Computer Files | select * from l10n_target; +----------------+----------------+----------+-----------------+-------+ | l10n_target_id | l10n_source_id | language | translation | fuzzy | +----------------+----------------+----------+-----------------+-------+ | 2 | 1 | nl-NL | Boek | 0 | | 3 | 2 | en | BKS_EN | 0 | | 4 | 2 | nl-NL | Boek | 0 | The source seems to be the English text. But I can translate it into EN again via target. Easiest seems to be: prevent having EN in the target table.
The source (l10n_source.text) also contain the default in case there is no translation. We should keep it.
Shouldnt we check if we are calling db_t btw for an English translation? We should not be looking for the English translation of itemtype if we have the description already in our object.
If we are not doing worst with this patch than before, I would not recommend to add more to it. First step should be to have something pushed that is stable. Then we can iterate and improve. (In reply to Marcel de Rooy from comment #110)
db_t could be made more flexible? Now we look for key and we removed description. But I think we should support both.
No, that's the whole point of the discussion earlier. We should go with the key. At least not for now.
Not sure how the concept of localization group will grow. But it might be too big soon for loading all its sources and finding corresponding translations. (The code needs a join here.) For instance, thinking about AV, I am probably only interested in a particular category and not in all entries under 'authorised_values' if that was the group. Other areas may have other needs again. This is a quite fundamental issue on the design of db_t. It feels not complete.
Well, it's cached, I would not care much about performances here, that should not be a problem if we are doing things correctly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #149954|0 |1 is obsolete| | Attachment #149956|0 |1 is obsolete| | Attachment #149957|0 |1 is obsolete| | --- Comment #114 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 150015 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150015&action=edit Bug 24975: Simplify and uniform calls to get the translation This patch add a caching mecanism for ItemType objects. We are also caching the result of the image location and the translation key so that we can retrieve from the cache and pass them to the temmplate. We should avoid call to db_t in the controller scripts, and prefer to pass the itemtype object and let the template does what it needs (retrieve the translated description, display the image) Note that the new Koha::Template::Plugin::ItemTypes->GetSorted should certainly be used in other places, for instance in * catalogue/search.pl sub prepare_adv_search_types * opac/opac-search.pl but those 2 occurrences are tricky and we would like to prevent regressions (as much as possible...) A major change is the modification of the prototype of search_compat, I am not sure this patch is updating all the template when the result of the search is passed. Note that Koha::SearchEngine::Elasticsearch::Search could use Koha::ItemTypes->get_from_cache, and certainly other places as well(?) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #115 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- I haven't spent much time testing this patch, but attaching to get feedback if possible. TODO tests are missing... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #116 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- TODO: * Add the entries into l10n_* tables when a new item type is created. * Remove them when the item type is deleted? * What to do when the description of an item type is modified? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #117 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 150033 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150033&action=edit Bug 24975: to squash - fix search.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150033|0 |1 is obsolete| | --- Comment #118 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 150034 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150034&action=edit Bug 24975: to squash - fix search.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #119 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Jonathan Druart from comment #116)
TODO: * Add the entries into l10n_* tables when a new item type is created. * Remove them when the item type is deleted? * What to do when the description of an item type is modified?
There are stuffs in Koha/Schema/Result/Itemtype.pm to deal with that actually. I need to retest. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #120 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Jonathan Druart from comment #116)
TODO: * Add the entries into l10n_* tables when a new item type is created.
Does this mean there have to be entries even if you don't translate? (sorry, I should maybe know from the rest of the patch/bug)
* Remove them when the item type is deleted?
Removing translations when the itemtype is deleted makes sense to me.
* What to do when the description of an item type is modified?
I think, when an itemtype description is modified, this should not change the translations or remove them. Libraries will take care of it and a typo fix or modification should not cause any changes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #121 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- See previous comment, that's not relevant. (In reply to Katrin Fischer from comment #120)
* What to do when the description of an item type is modified?
I think, when an itemtype description is modified, this should not change the translations or remove them. Libraries will take care of it and a typo fix or modification should not cause any changes.
This will need to be confirmed however. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #122 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Jonathan Druart from comment #121)
See previous comment, that's not relevant.
(In reply to Katrin Fischer from comment #120)
* What to do when the description of an item type is modified?
I think, when an itemtype description is modified, this should not change the translations or remove them. Libraries will take care of it and a typo fix or modification should not cause any changes.
This will need to be confirmed however.
Confirmed? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=35200 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW Assignee|jonathan.druart+koha@gmail. |koha-bugs@lists.koha-commun |com |ity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Koha collecto <koha@collecto.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |koha@collecto.ca -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #123 from Julian Maurice <julian.maurice@biblibre.com> --- Re-reading all comments and patches after a year and a half... the end result doesn't look easier to use that what we currently have in master: db_t('itemtype', $itemtype->{translation_key}) I can't precisely tell what is wrong with this, but it's definitely harder to read than: $itemtype->translated_description I think this is because at first, I tried to fit the gettext (POT/PO files) model into database, and then it evolved to use a (primary) key as "source string" instead of the original string, trying to fit this in a system not really designed for it. So I tried another approach. Since it appear we want to use the primary key as the "matching point" between an object and its localizations, I tried storing itemtypes localizations in a dedicated `itemtypes_localizations` table and see how much I could generalize it to make it easy to localize other tables data. I will submit the result soon in a new bug report. It's not finished but I need to get feedback in order to continue. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #124 from Julian Maurice <julian.maurice@biblibre.com> --- => bug 38136 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=38136 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 --- Comment #125 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #114)
Created attachment 150015 [details] [review] Bug 24975: Simplify and uniform calls to get the translation
This patch add a caching mecanism for ItemType objects. We are also caching the result of the image location and the translation key so that we can retrieve from the cache and pass them to the temmplate.
We should avoid call to db_t in the controller scripts, and prefer to pass the itemtype object and let the template does what it needs (retrieve the translated description, display the image)
Note that the new Koha::Template::Plugin::ItemTypes->GetSorted should certainly be used in other places, for instance in * catalogue/search.pl sub prepare_adv_search_types * opac/opac-search.pl but those 2 occurrences are tricky and we would like to prevent regressions (as much as possible...)
A major change is the modification of the prototype of search_compat, I am not sure this patch is updating all the template when the result of the search is passed.
Note that Koha::SearchEngine::Elasticsearch::Search could use Koha::ItemTypes->get_from_cache, and certainly other places as well(?)
This patch was quite good. Will move it to a separate bug. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Michaela Sieber <michaela.sieber@kit.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michaela.sieber@kit.edu --- Comment #126 from Michaela Sieber <michaela.sieber@kit.edu> --- Question : Can we close this bug now that bug 38136 has been pushed? It blocks bug 24977 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #127 from Julian Maurice <julian.maurice@biblibre.com> --- Yes. I'm closing it And I'll also close bug 24977 because it is replaced by bug 38460 *** This bug has been marked as a duplicate of bug 38136 *** -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org