Bug 20545 - Add multi-language support to SIP2
Summary: Add multi-language support to SIP2
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-09 10:29 UTC by Katrin Fischer
Modified: 2019-02-26 17:46 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2018-04-09 10:29:26 UTC
At the moment the messages from the SIP2 server are in English by default and can be changed using a feature Kyle has written on bug 12571.

The problem is, that while this can be used to translate the message, it doesn't provide true multi-language support. It's very common to provide the GUI on the self checks in mulitple languages here, so there is a need for translating the errors etc. sent by Koha as well.

The SIP specification provides means to send a language code that would allow us to implement this properly. It uses a 3 character language code in its messages:

http://multimedia.3m.com/mws/media/355361O/sip2-protocol.pdf

Language Code
Unknown (default)  000 
English 001          
French 002          
German 003          
Italian 004          
Dutch 005          
Swedish 006          
Finnish 007          
Spanish 008          
Danish 009          
Portuguese 010          
Canadian-French 011          
Norwegian 012          
Hebrew 013          
Japanese 014          
Russian 015          
Arabic 016          
Polish 017          
Greek 018          
Chinese 019          
Korean 020          
North American Spanish 021 
Tamil 022          
Malay 023          
United Kingdom 024          
Icelandic 025          
Belgian 026          
Taiwanese 027
Comment 1 Kyle M Hall 2018-04-09 10:39:48 UTC
If we moved all SIP2 strings into Template Toolkit files it would make translation easy. I would recommend we use TT directly in the SIP2 code and *not* use C4::Templates do to it's cgi-centriticy and the fact that it would add a huge amount of overhead to the SIP server.
Comment 2 Kyle M Hall 2018-04-09 10:40:53 UTC
Also, if we are going this far, we should also allow alternative templates to be specified on a per-login basis in the SIP2 config.
Comment 3 Kyle M Hall 2018-04-09 10:51:30 UTC
Better idea from cait, use YAML and hook into the same translation system as the sysprefs. Still should allow alternatives in the config ; )
Comment 4 Magnus Enger 2018-04-16 11:06:18 UTC
This hints at a bug in the SIP2 implementation in Koha. In the SIP2 standard that Katrin references in Comment 1, "language" is listed as a "3-char, fixed length required field". The contents of this field should be the 3-digit language codes that Katrin lists. 

As fas as I can tell, Koha uses the contents of the borrowers.lang database field for the language, using 000 if the field is not set:
http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/SIP/ILS/Patron.pm;h=23c576493fbc6214905efd1297225057a80c537a;hb=HEAD#l252

If a language code like nb-NO is used for the language in SIP2 the language info will have both the wrong length and the wrong format. 

As far as I can tell, we should have a mapping somewhere from the codes we use in borrowers.lang to the 3-digit codes required by SIP2. 

Not sure if it makes sense to fix this as part of the present bug or if it should be a separate bug.
Comment 5 Katrin Fischer 2018-04-19 06:52:33 UTC
Hm, I was wondering if we should just response in the lanugage that was set in the request, assuming that it's the language selected on the self check GUI. Maybe a fallback to borrowers.lang?

Yes, we'd need to map the Koha language codes to the SIP2 codes in some way. Maybe a YAML system preference?
Comment 6 Colin Campbell 2018-04-19 10:12:33 UTC
Actually we always return 000 for the language because the language does not get set in the ILS::Patron objectand we fall back on default.

Would be interesting to see if self-issue machines take much notice of whats set, what they are configured for may override anything in the response
Comment 7 Magnus Enger 2018-04-23 09:06:41 UTC
(In reply to Colin Campbell from comment #6)
> Actually we always return 000 for the language because the language does not
> get set in the ILS::Patron objectand we fall back on default.

That has not been my experience. The one time I checked, borrowers.lang was empty and the three-digit language code was missing from the SIP2 response, giving the "fixed length" part of the response the wrong length.
Comment 8 Katrin Fischer 2018-04-23 09:59:28 UTC
I think borrowers.lang was added in 17.05 or 17.11, maybe you are looking at different versions? It's a rather recent addition.
Comment 9 abernaud 2018-07-06 10:12:50 UTC
Hello,
in my opinion, we should only use the language that was set in the request, assuming that it's the language selected on the self check GUI, as Katrin said in Comment #5.
All the messages displayed on the selfcheck machines aren't coming from Koha : some messages are sent directly by the selfcheck machine itself. So it would be better to use the language set on the GUI.
Best wishes
Anne-Claire (from Rennes, France)