To reproduce: Install and enable (in systempreferences:I18N/L10N language) e.g. Português Português (pt-PT) Português (pt-BR) Deutsch Deutsch (de-CH) Deutsch (de-DE) Go to cgi-bin/koha/tools/koha-news.pl and try to create news. The dropdown 'Display location' contains: - All - Librarian interface - Slip - OPAC (pt-BR) - OPAC (en) - OPAC (de-DE) OPAC (de-CH) and OPAC (pt-PT) are missing. It is not possible to create news for them (even if you disable e.g. de-DE or pt-BR) in system preferences).
Created attachment 30518 [details] [review] Bug 12705 - News not possible for one sublanguage if two sublanguages are installed To reproduce problem: Install and enable (in systempreferences:I18N/L10N language) e.g. Português Português (pt-PT) Português (pt-BR) Deutsch Deutsch (de-CH) Deutsch (de-DE) Go to cgi-bin/koha/tools/koha-news.pl and try to create news. The dropdown 'Display location' contains: - All - Librarian interface - Slip - OPAC (pt-BR) - OPAC (en) - OPAC (de-DE) OPAC (de-CH) and OPAC (pt-PT) are missing. It is not possible to create news for them (even if you disable e.g. de-DE or pt-BR) in system preferences). This patch reduces the possible languages to the main language. In the example above you will get: - All - Librarian interface - Slip - OPAC (pt) - OPAC (en) - OPAC (de) The OPAC then desiplays the news for all variants of a language. E.g. news for OPAC (de) is displayed for de-DE and de-ch News that already existed before applying the patch e.g. for de-DE will display for all de variants (de-DE and de-CH). To test: - Go to cgi-bin/koha/tools/koha-news.pl - Dropdown for location will display only main languages for OPAC (e.g. de instead of de-DE) - Create news for a language - Got to main page of OPAC, choose language variant - News should display - Choose other language variant for same language - News should display as well.
Marc, your patch works and has no errors, but I wonder if someone could see this as a regression because you can't put a news on a specific variant of a language. You can't right now, but the problem is the strange structure returned by getTranslatedLanguages() If you change this foreach my $language ( @$tlangs ) { push @lang_list, { language => $language->{'rfc4646_subtag'}, selected => ( $new_detail->{lang} eq $language->{'rfc4646_subtag'} ? 1 : 0 ), }; } with this foreach my $language ( @$tlangs ) { foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { push @lang_list, { language => $sublanguage->{'rfc4646_subtag'}, selected => ( $new_detail->{lang} eq $sublanguage->{'rfc4646_subtag'} ? 1 : 0 ), }; } } } then the problem is solved. Perhaps a new feature could be a multiple selection on target languages or interfaces for news display location. Another feature could show here only 'active' languages, i.e. only push if ( $sublanguage->{'enabled'} )
Bernardo, thanks for the comment. I considered to change getTranslatedLanguages() but: a) I could not really find out what to change... b) I was afraid that changes could have side effects because the function is used at several places Anyway, I think it is better to keep the behaviour as it was originally intended (News per language variants). At the moment the most important thing for me is to fix the bug, because I can not display de-CH news at the moment. Regarding the new features: ---- Perhaps a new feature could be a multiple selection on target languages or interfaces for news display location. MV: That would be nice for a follow up ---- Another feature could show here only 'active' languages, i.e. only push if ( $sublanguage->{'enabled'} ) MV: As far as I remember there was a discussion somewhere about this idea with following scenario: It could be possible that a library plans to introduce an additional language. They prepare some news in this language, but do not yet enable it.
(In reply to Marc Véron from comment #3) > Regarding the new features: > ---- > Perhaps a new feature could be a multiple selection on target languages or > interfaces for news display location. > MV: That would be nice for a follow up > Yeah, will think about that > Another feature could show here only 'active' languages, > i.e. only push if ( $sublanguage->{'enabled'} ) > MV: As far as I remember there was a discussion somewhere about this idea > with following scenario: It could be possible that a library plans to > introduce an additional language. They prepare some news in this language, > but do not yet enable it. Right, no changes there then :)
Comment on attachment 30518 [details] [review] Bug 12705 - News not possible for one sublanguage if two sublanguages are installed New patch follows.
Created attachment 30646 [details] [review] Bug 12705 - News not possible for one sublanguage if two sublanguages are installed To test: - Install two language variants (e.g. de-DE and de-CH) - Create OPAC news for each of them - Verify that they are displayed in OPAC as appropriate
Created attachment 30648 [details] [review] [SIGNED-OFF] Bug 12705 - News not possible for one sublanguage if two sublanguages are installed To test: - Install two language variants (e.g. de-DE and de-CH) - Create OPAC news for each of them - Verify that they are displayed in OPAC as appropriate Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Works Ok, no koha-qa errors
*** Bug 7541 has been marked as a duplicate of this bug. ***
Created attachment 30898 [details] [review] [PASSED QA] Bug 12705 - News not possible for one sublanguage if two sublanguages are installed To test: - Install two language variants (e.g. de-DE and de-CH) - Create OPAC news for each of them - Verify that they are displayed in OPAC as appropriate Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Works Ok, no koha-qa errors Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works ok, all installed languages now show up in the pull downs and display for the selected language in the OPAC. Passes tests and QA script.
Patch pushed to master. Thanks Marc!
(In reply to Tomás Cohen Arazi from comment #10) > Patch pushed to master. > > Thanks Marc! Pushed to 3.16.x, patch will be in 3.16.8