There was discussion on bug 4032 that multi-language support is important.
Created attachment 8621 [details] [review] Bug 7821 - {langcode} will be replaced with current interface language This makes bug 4032 support multi-language Koha installation which is important for some of Koha users.
Created attachment 8626 [details] [review] [SIGNED-OFF] Bug 7821 - {langcode} will be replaced with current interface language This makes bug 4032 support multi-language Koha installation which is important for some of Koha users. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> 1) After update XSLT system preferences are set to 'default'. All views (OPAC and staff, results and detail page) work and switching languages selects the correct translated file. 2) Leaving empty works and normal views are used. 3) Putting in a single URL without placeholder works. 4) Putting in a URL with placeholder works. Created local directories have to match the language codes. NOTE: In order to make the URLs and patchs work, the Utils file needs to be copied too.
QA comment: small patch, nothing to say, passed QA. Must be applied after 4032 passed QA
Just mentioning: Think the test /{langcode}/ works, but to my knowledge(..) curly braces should better be escaped in a regex. Normally they are used for repetition (a{2} means two characters a).
I agree. Something like \Q{langcode}\E would be much better. Should I re-submit patch or can QA fix this?
(In reply to comment #5) > I agree. Something like \Q{langcode}\E would be much better. Should I > re-submit patch or can QA fix this? I've fixed it, by using \{ and \} It work fine, thanks. Note that the result will be broken if you use {langcode} but don't provide a localised stylesheet for each language For example, you have en/stylesheet.xsl fr-FR/stylesheet.xsl set the syspref to {langcode}/stylesheet.xsl and activate german at the OPAC: displaying in english and french will be OK, in german, you'll get a nasty Perl error. Worth specifying it in the documentation!
I'm getting an error from /cgi-bin/koha/virtualshelves/shelves.pl which git bisect blames on the latest commit from this bug (f91bd36399b1ab46649482f80e0ff1b438a8d9f6): Bareword "C4::Templates::_current_language" not allowed while "strict subs" in use at /home/oleonard/kohaclone/C4/XSLT.pm line 175.
Created attachment 8724 [details] [review] Bug 7821 - fix C4::Templates::_current_language Bareword "C4::Templates::_current_language" not allowed while "strict subs" in use at /home/oleonard/kohaclone/C4/XSLT.pm line 175.
Created attachment 8725 [details] [review] Followup for current language call
QA Comment: Trivial fix.
Updatig severity - last patch if fixing a bug, not an enhancement.
Updating severity again... Cron <...> $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null (failed) Bareword "C4::Templates::_current_language" not allowed while "strict subs" in use at /home/katrin/kohaclone/C4/XSLT.pm line 175. Compilation failed in require at /home/katrin/kohaclone/C4/Search.pm line 29. BEGIN failed--compilation aborted at /home/katrin/kohaclone/C4/Search.pm line 29. Compilation failed in require at /home/katrin/kohaclone/C4/AuthoritiesMarc.pm line 24. BEGIN failed--compilation aborted at /home/katrin/kohaclone/C4/AuthoritiesMarc.pm line 24. Compilation failed in require at /home/katrin/kohaclone/misc/cronjobs/../migration_tools/rebuild_zebra.pl line 11. BEGIN failed--compilation aborted at /home/katrin/kohaclone/misc/cronjobs/../migration_tools/rebuild_zebra.pl line 11.
Bareword "C4::Templates::_current_language" not allowed while "strict subs" in use at C4/XSLT.pm line 175. Compilation failed in require at C4/Search.pm line 29. It seems that $ is missing from C4::Templates::_current_language in C4/XSLT.pm
Srdjan the latest patch the follow up, is the fix for that, it needs to be pushed ASAP, because master is currently broken until it is
Yes, I should be more observant and read all the comments as opposed to be lazy...
Patch pushed, if someone can explain why the () fixes the problem (or why, without () there is a problem), i'd like to have it !!!
Comment on attachment 8725 [details] [review] Followup for current language call () fixes it because _current_language is not a declared symbol, so perl treats it as a bareword, and strict barfs when compiling. _current_language() is a function call, so gets resolved at runtime (C and Java people hate that). C4::Templates::_current_language() exists, so it gets executed. So if you had in C4::Templates (which I thoroughly not recommend) sub _current_language () { return $_current_language; } C4::Templates::_current_language would have worked, () prototypes the function and makes it a symbol. That's why people use constant;