Bug 10214 - malformed syspref.po file
Summary: malformed syspref.po file
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Frédéric Demians
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-07 16:22 UTC by Paul Poulain
Modified: 2014-12-07 20:02 UTC (History)
4 users (show)

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


Attachments
Proposed patch (2.70 KB, patch)
2013-05-14 11:30 UTC, Frédéric Demians
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10214 Add header to syspref po files (2.81 KB, patch)
2013-05-14 12:27 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[PASSED QA] Bug 10214 Add header to syspref po files (2.96 KB, patch)
2013-05-15 05:41 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Poulain 2013-05-07 16:22:01 UTC
The ln-LN-pref.po file (in misc/translator/po/, generated by ./translate install|update ln-LN is malformed.

It lacks the .po header that is in other i18n files:

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2013-05-07 08:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

Without this header, a tool like transifex complains (and refuses to upload the file). Adding it fixes the problem
Comment 1 Zeno Tajoli 2013-05-07 19:03:28 UTC
The header is useful also for a GUI tool like Poedit
Comment 2 Paul Poulain 2013-05-14 10:40:31 UTC
Le 07/05/2013 18:42, Bernardo Gonzalez Kriegel a écrit :> 
> I use to download syspref.po, add the header and then upload to pootle.
> We may check how is created/updated.
> 
The .po files are generated by misc/translator/translate script.

Digging a little, I've found that the culprit is probably in LangInstaller.pm,
sub save_po {
    my $self = shift;
    # Write .po entries into a file put in Koha standard po directory
    Locale::PO->save_file_fromhash( $self->po_filename, $self->{po} );
    say "Saved in file: ", $self->po_filename if $self->{verbose};

Other .po are generated by tmpl_process3.pl AFAIK (but i'm not a translation process specialist, I may be wrong)
Comment 3 Frédéric Demians 2013-05-14 10:47:09 UTC
Can anyone post the missing header here as a comment? I will take a look at how to add it directly from the translation script.
Comment 4 Frédéric Demians 2013-05-14 11:30:19 UTC Comment hidden (obsolete)
Comment 5 Frédéric Demians 2013-05-14 11:33:47 UTC
This patch applies on master and 3.12 branch
Comment 6 Bernardo Gonzalez Kriegel 2013-05-14 12:27:02 UTC Comment hidden (obsolete)
Comment 7 Katrin Fischer 2013-05-15 05:41:42 UTC
Created attachment 18142 [details] [review]
[PASSED QA] Bug 10214 Add header to syspref po files

With this patch, header is created when creating a new syspref .po file
for a new language (translate create), and is added if it doesn't
already exist when updating an existing language (translate update).

To test:

(1) Create a new language syspref file:

    ./translate create -p xx-XX

    Check that there is an header

(2) Update an existing syspref file without header:

    ./translate update fr-FR

    Check that fr-FR-pref.po has a header

(3) Update an existing syspref file with header:

    Modify fr-FR-pref.po. Add an email, or whatever.

    ./translate update fr-FR

    Check that fr-FR-pref.po has a header with the manual modification

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

Comment: Work as described. No errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Also tested that updated pref files can still be installed correctly.
Comment 8 Jared Camins-Esakov 2013-05-15 11:22:57 UTC
This patch has been pushed to master and 3.12.x.
Comment 9 Bernardo Gonzalez Kriegel 2013-06-14 02:17:20 UTC
Pushed to 3.10.x, will be in 3.10.7

This solves translation files issues, I think is good for 3.10