Bug 10041 - Provide a koha-translate script to aid package users on installing translations
Summary: Provide a koha-translate script to aid package users on installing translations
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-14 00:16 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2013-12-05 20:09 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 10041 - Provide a koha-translate script to aid package users on installing translations (9.77 KB, patch)
2013-04-14 00:22 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10041 - Provide a koha-translate script to aid package users on installing translations (11.29 KB, patch)
2013-04-15 15:00 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10041 - Provide a koha-translate script to aid package users on installing translations (11.16 KB, patch)
2013-04-15 18:06 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10041 - Provide a koha-translate script to aid package users on installing translations (11.16 KB, patch)
2013-04-15 18:14 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10041 - Provide a koha-translate script to aid package users on installing translations (11.16 KB, patch)
2013-04-15 18:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10041 - Provide a koha-translate script to aid package users on installing translations (11.37 KB, patch)
2013-04-17 00:02 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2013-04-14 00:16:45 UTC
Until we have solved the packaging of koha template translations, provide a command that manages the installed translations in a proper way.
Comment 1 Tomás Cohen Arazi (tcohen) 2013-04-14 00:22:12 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2013-04-14 14:52:56 UTC
Testing.

1) -i|u|r without lang code dies with (shift: can't shift that many)
   perhaps check if langcode and die with a graceful message.
   Unless you try to mimic what translate script do without lang code,
   install/update/remove all langs.
   
2) List all. There are 2 files with "opac" in name (prog|ccsr), 
   so you report twice.
   Perhaps using $(ls $PO_DIR *-i-opac-t-prog-v-3006000.po)?

3) Install. Could test if all lang files are present? (staf|opac|ccsr|pref)
   only to report any missing, and then proceed (translate script will 
   complain anyway).

4) Remove ok. Sysprefs language and opaclanguages could reference
   a removed lang but I think it's harmless.

5) Update. The message if you try to install again a lang is misleading.
   update option in 'misc/translator/translate' script is not to
   update translated files but to update translation files (PO).
   So, if your update is to re-install, do so (install) silently. 
   Or change the message to reflect what you are really doing
   and allow a re-install.
   Or remove update option.

No koha-qa errors.
Comment 3 Tomás Cohen Arazi (tcohen) 2013-04-15 15:00:18 UTC Comment hidden (obsolete)
Comment 4 Tomás Cohen Arazi (tcohen) 2013-04-15 15:31:29 UTC
(In reply to comment #2)
> Testing.
> 
> 1) -i|u|r without lang code dies with (shift: can't shift that many)
>    perhaps check if langcode and die with a graceful message.
>    Unless you try to mimic what translate script do without lang code,
>    install/update/remove all langs.

Ok, fixed.

> 2) List all. There are 2 files with "opac" in name (prog|ccsr), 
>    so you report twice.
>    Perhaps using $(ls $PO_DIR *-i-opac-t-prog-v-3006000.po)?

I did't notice because the current packages don't ship the ccsr theme. Fixed.

> 3) Install. Could test if all lang files are present? (staf|opac|ccsr|pref)
>    only to report any missing, and then proceed (translate script will 
>    complain anyway).

Added the -c|--check switches. The check is performed on update and install commands, and prevents from running if some .PO file is missing.

> 4) Remove ok. Sysprefs language and opaclanguages could reference
>    a removed lang but I think it's harmless.

Oh, at least I wrote an 'rm -rf' command that does not fail! 

> 5) Update. The message if you try to install again a lang is misleading.
>    update option in 'misc/translator/translate' script is not to
>    update translated files but to update translation files (PO).
>    So, if your update is to re-install, do so (install) silently. 
>    Or change the message to reflect what you are really doing
>    and allow a re-install.
>    Or remove update option.

As I'm focusing on the end user (non-techie) the idea is that new .PO are provided and they can use the script to update the templates. So, different semantics from the 'translate' command. Fixed.
Comment 5 Tomás Cohen Arazi (tcohen) 2013-04-15 18:06:00 UTC Comment hidden (obsolete)
Comment 6 Tomás Cohen Arazi (tcohen) 2013-04-15 18:14:58 UTC Comment hidden (obsolete)
Comment 7 Tomás Cohen Arazi (tcohen) 2013-04-15 18:21:37 UTC Comment hidden (obsolete)
Comment 8 Bernardo Gonzalez Kriegel 2013-04-17 00:02:26 UTC
Created attachment 17494 [details] [review]
[SIGNED-OFF] Bug 10041 - Provide a koha-translate script to aid package users on installing translations

Until we have solved the packaging of koha template translations, provide a command that manages the installed translations in a proper way.

To test, build a Debian package of current master+the patches from this bug :-D and try the many options running koha-translate --help provide.

The command itself can be grabbed from a git checkout with this patch applied to test the script's funcionality. If it (and its docs) fits the package building stuff, I'll test on monday when I can be back on my workstation.

Sponsored-by: Universidad Nacional de Córdoba

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

Comment: Good adition. Work as described. No errors.
Copied to /usr/local/bin. No errors on install, update, remove, list and check.
Comment 9 Mason James 2013-04-27 15:29:18 UTC
(In reply to comment #8)
> Created attachment 17494 [details] [review] [review]
> [SIGNED-OFF] Bug 10041 - Provide a koha-translate script to aid package
> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

QA-comment: woah, looks good! :)

hmmm, one small problem for me - creating a fr-FR language dir failed
Tomás, any ideas?

see below...

# which koha-translate  
/usr/sbin/koha-translate

# koha-translate  -l
en
en-NZ
Kore-KR

# koha-translate  -l -a|grep FR
fr-FR

# koha-translate  -i fr-FR
Error: /usr/share/koha/misc/translator/po/fr-FR-opac-ccsr.po not found.
Comment 10 Mason James 2013-04-27 16:24:08 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > Created attachment 17494 [details] [review] [review] [review]
> > [SIGNED-OFF] Bug 10041 - Provide a koha-translate script to aid package
> > Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
> 
> QA-comment: woah, looks good! :)
> 
> hmmm, one small problem for me - creating a fr-FR language dir failed

ahh, sorry - my fault here

passing QA...
Comment 11 Jared Camins-Esakov 2013-05-02 02:33:53 UTC
This patch has been pushed to master and 3.12.x.
Comment 12 Chris Cormack 2013-05-09 09:22:19 UTC
Pushed to 3.10.x will be in 3.10.6