Changeset 9435c45 in git


Ignore:
Timestamp:
05/03/15 01:05:16 (5 years ago)
Author:
Olly Betts <olly@…>
Branches:
line_contents, master, stereo, travis-osx
Children:
5c11105
Parents:
381311b
Message:

lib/extract-msgs.pl: Preserve any header from the existing .pot
file.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r381311b r9435c45  
     1Thu Mar 05 01:04:44 GMT 2015  Olly Betts <olly@survex.com>
     2
     3        * lib/extract-msgs.pl: Preserve any header from the existing .pot
     4          file.
     5
    16Thu Mar 05 00:51:17 GMT 2015  Olly Betts <olly@survex.com>
    27
  • lib/extract-msgs.pl

    r381311b r9435c45  
    66use Locale::PO;
    77
    8 my $pot_creation_date = strftime "%Y-%m-%d %H:%M:%S +0000", gmtime();
     8sub pot_creation_date {
     9    return strftime "%Y-%m-%d %H:%M:%S +0000", gmtime();
     10}
    911
    1012use integer;
     
    6668}
    6769
    68 print << "END";
    69 # Survex translation template.
    70 # Copyright (C) YEAR COPYRIGHT HOLDERS
    71 # This file is distributed under the same licence as Survex.
    72 #
    73 msgid ""
    74 msgstr ""
    75 "Project-Id-Version: survex\\n"
    76 "Report-Msgid-Bugs-To: olly\@survex.com\\n"
    77 "POT-Creation-Date: $pot_creation_date\\n"
    78 "PO-Revision-Date: YEAR-MO-DA HO:MI:SE +ZONE\\n"
    79 "Language-Team: LANGUAGE <LL\@li.org>\\n"
    80 "MIME-Version: 1.0\\n"
    81 "Content-Type: text/plain; charset=utf-8\\n"
    82 "Content-Transfer-Encoding: 8bit\\n"
    83 END
    84 
    8570my $num_list = Locale::PO->load_file_asarray("survex.pot");
    8671my $first = 1;
     
    9378    if ($first) {
    9479        $first = 0;
    95         next if ($po_entry->msgid eq '""');
     80        if ($po_entry->msgid eq '""') {
     81            chomp(my $header = $po_entry->dump);
     82            print $header;
     83            next;
     84        }
     85        print << "END";
     86# Survex translation template.
     87# Copyright (C) YEAR COPYRIGHT HOLDERS
     88# This file is distributed under the same licence as Survex.
     89#
     90msgid ""
     91msgstr ""
     92"Project-Id-Version: survex\\n"
     93"Report-Msgid-Bugs-To: olly\@survex.com\\n"
     94"POT-Creation-Date: ${\(pot_creation_date)}\\n"
     95"PO-Revision-Date: YEAR-MO-DA HO:MI:SE +ZONE\\n"
     96"Language-Team: LANGUAGE <LL\@li.org>\\n"
     97"MIME-Version: 1.0\\n"
     98"Content-Type: text/plain; charset=utf-8\\n"
     99"Content-Transfer-Encoding: 8bit\\n"
     100END
    96101    }
    97102    my $msg;
Note: See TracChangeset for help on using the changeset viewer.