Changeset 30155 in osm


Ignore:
Timestamp:
2013-12-28T21:35:45+01:00 (11 years ago)
Author:
holgermappt
Message:

Reorganized i18n.

Location:
applications/editors/josm/plugins/photoadjust
Files:
4 added
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photoadjust

    • Property svn:ignore set to
      josm_trans_*gz
      build
      po
  • applications/editors/josm/plugins/photoadjust/build.xml

    r30137 r30155  
    1919         See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
    2020    -->
    21     <property name="plugin.author" value="Holger Mappt"/>
     21    <property name="plugin.author" value="holgermappt"/>
    2222    <property name="plugin.class" value="org.openstreetmap.josm.plugins.photoadjust.PhotoAdjustPlugin"/>
    2323    <property name="plugin.description" value="Make photos movable and position them on the map."/>
     
    3131    <property name="plugin.dist.dir" value="../../dist"/>
    3232    <property name="plugin.javadoc.dir" location="javadoc"/>
    33     <property name="gettexttasks.jar" value="../../i18n/lib/gettext-ant-tasks-0.9.7.jar"/>
    3433       
    3534    <!-- ** include targets that all plugins have in common ** -->
    3635    <import file="../build-common.xml"/>
     36    <!-- ** internationalization ** -->
     37    <import file="i18n/build-i18n.xml"/>
    3738
    3839    <!--
     
    5253    </target>
    5354
    54     <!--
    55     **********************************************************
    56     ** gettext - string extraction and merge
    57     **********************************************************
    58     -->
    59     <target name="gettext-init" description="Loads the Ant gettext and contrib tasks.">
    60         <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
    61     </target>
    62     <target name="pot" description="Extract translatable strings from source." depends="gettext-init">
    63         <mkdir dir="po"/>
    64         <gettext-extract keysFile="${ant.project.name}.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
    65             <fileset dir="src" includes="**/*.java"/>
    66         </gettext-extract>
    67         <echo file="po/${ant.project.name}.pot" append="true">
    68 #. Plugin ${ant.project.name}
    69 #: build.xml:1
    70 msgid "${plugin.description}"
    71 msgstr ""
    72 </echo>
    73     </target>
    74     <target name="pomerge" description="Merge extracted strings into language files.">
    75         <exec executable="perl">
    76             <arg line="pomerge.pl"/>
    77         </exec>
    78     </target>
    79     <target name="poimport" description="Import the PO files from the tarball launchpad-export.tar.gz exported from Launchpad.">
    80         <exec executable="perl">
    81             <arg line="poimport.pl"/>
    82         </exec>
    83     </target>
    84     <target name="lang" description="Prepare *.lang files in data directory.">
    85         <exec executable="perl">
    86             <arg line="../../i18n/i18n.pl data po/*.po"/>
    87         </exec>
     55    <target name="additional-manifest">
     56        <antcall target="mftrans"/>
    8857    </target>
    8958</project>
  • applications/editors/josm/plugins/photoadjust/i18n/poimport.pl

    r30149 r30155  
    11#! /usr/bin/perl -w
    2 ###
    3 ### poimport.pl - Import the translation from the tarball downloaded
    4 ###     from Launchpad.
     2
     3#####################################################################
     4### http://www.perl.com/doc/manual/html/utils/pod2man.html
     5### http://search.cpan.org/dist/perl/pod/perlpod.pod
     6
     7=head1 NAME
     8
     9poimport.pl - Import the translation from the tarball downloaded from
     10Launchpad.
     11
     12=head1 SYNOPSIS
     13
     14B<poimport.pl> [B<--help>] [B<--man>] [B<--podir> I<po>]
     15    [B<--workdir> I<poimport>] [B<--(no)rmworkdir>] I<tarball>
     16
     17=head1 DESCRIPTION
     18
     19Import the plugin translations from Launchpad.  The argument
     20I<tarball> can be a tarball file that was downloaded from Launchpad, a
     21tarball download URL, a JOSM translation branch revision number
     22(e.g. I<789>), or the keyword I<latest> for the latest revision.
     23Default is to download the latest translation branch revision.
     24
     25=head1 OPTIONS
     26
     27=over 4
     28
     29=item B<--help>
     30
     31Prints a brief help message and exits.
     32
     33=item B<--man>
     34
     35Prints the manual page and exits.
     36
     37=item B<--podir>
     38
     39Destination directory relative to directory where this script was
     40started in.  Default is F<po>.
     41
     42=item B<--workdir>
     43
     44Temporary directory.  A unique directory name that is not used for
     45anything else.  Default is F<poimport>.
     46
     47=item B<--rmworkdir>
     48
     49Remove the temporary directory after the work is done.  Disable
     50removal with B<--normworkdir>.  Default is to remove the temporary
     51directory.
     52
     53=back
     54
     55=cut
     56#####################################################################
    557
    658use strict;
     
    961use File::Spec::Functions;
    1062use File::Basename;
     63use Getopt::Long;
     64use Pod::Usage;
    1165
    1266### Name of the tarball downloaded from Launchpad.  Or download URL.
    13 ### Or JOSM translation branch revision number.
    14 my $tarball = "launchpad-export.tar.gz";
     67### Or JOSM translation branch revision number.  Or keyword "latest".
     68my $tarball;
     69#$tarball = "launchpad-export.tar.gz";
    1570#$tarball = "http://launchpadlibrarian.net/159932691/launchpad-export.tar.gz";
    1671#$tarball = "http://bazaar.launchpad.net/~openstreetmap/josm/josm_trans/tarball/747";
    1772#$tarball = "747";
    18 ### Temporary directory.  A unique directory name that is not used for
    19 ### anything else.
    20 my $workdir = "importpo";
    21 ### Remove the temp. directory after the work is done (0/1)?
    22 my $rmworkdir = 1;
    23 ### Destination directory relative to directory where this script was
    24 ### started in.
    25 my $podir = "po";
     73#$tarball = "http://bazaar.launchpad.net/~openstreetmap/josm/josm_trans/tarball";
     74$tarball = "latest";
     75my $workdir = "poimport";       ### Temp. directory.
     76my $rmworkdir = 1;              ### Remove the temp. directory (0/1)?
     77my $podir = "po";               ### Destination directory.
     78my $showhelp = 0;               ### Show help screen.
     79my $showman = 0;                ### Show manual page of this script.
     80
     81GetOptions('help|?|h'   => \$showhelp,
     82           'man'        => \$showman,
     83           'podir=s'    => \$podir,
     84           'workdir=s'  => \$workdir,
     85           'rmworkdir!' => \$rmworkdir,
     86          ) or pod2usage(2);
     87
     88pod2usage(1) if $showhelp;
     89pod2usage(-exitstatus => 0, -verbose => 2) if $showman;
    2690
    2791### Check for arguments.  The only supported argument is the tarball.
     
    3397}
    3498
     99my $josmtburl = "http://bazaar.launchpad.net/~openstreetmap/josm/josm_trans/"
     100  . "tarball";
     101
    35102### Check for JOSM translation branch revision number.
    36103if ($tarball =~ m/^\d+$/) {
    37   $tarball = "http://bazaar.launchpad.net/~openstreetmap/josm/josm_trans/"
    38     . "tarball/" . $tarball;
     104  $tarball = $josmtburl . "/" . $tarball;
     105}
     106### Or for keyword "latest", i.e. the latest JOSM translation revision.
     107elsif ($tarball eq "latest") {
     108  $tarball = $josmtburl;
    39109}
    40110
     
    50120    if ($tarball =~ m:/([^/]+)/tarball/(\d+)$:) {
    51121      $downfile = $1 . "_" . $2 . ".tar.gz";
     122    }
     123    else {
     124      $downfile .= ".tar.gz";
     125    }
     126  }
     127  elsif ($downfile eq "tarball") {
     128    ### Download of latest revision.
     129    if ($tarball =~ m:/([^/]+)/tarball$:) {
     130      $downfile = $1 . "_latest.tar.gz";
    52131    }
    53132    else {
  • applications/editors/josm/plugins/photoadjust/i18n/pomerge.pl

    r30149 r30155  
    11#! /usr/bin/perl -w
    2 ###
    3 ### pomerge.pl - Run msgmerge with the files in the po directory and
    4 ###     remove untranslated strings.
     2
     3#####################################################################
     4### http://www.perl.com/doc/manual/html/utils/pod2man.html
     5### http://search.cpan.org/dist/perl/pod/perlpod.pod
     6
     7=head1 NAME
     8
     9pomerge.pl - Run msgmerge with the files in the po directory and
     10    remove untranslated strings.
     11
     12=head1 SYNOPSIS
     13
     14B<poimport.pl> [B<--help>] [B<--man>] [B<--podir> I<po>]
     15    [B<--project> I<project>]
     16
     17=head1 DESCRIPTION
     18
     19This script merges the translated strings with the template POT file
     20(msgmerge).  It then removes all untranslated strings (msgattrib).
     21The script works with all PO files in the po directory.
     22
     23=head1 OPTIONS
     24
     25=over 4
     26
     27=item B<--help>
     28
     29Prints a brief help message and exits.
     30
     31=item B<--man>
     32
     33Prints the manual page and exits.
     34
     35=item B<--podir>
     36
     37Directory with PO files that are to be merged.  Default is F<po>.
     38
     39=item B<--project>
     40
     41Project or plugin name.  If the name of the template is F<plugin.pot>,
     42then this name is I<plugin>.  Default is I<josm>.
     43
     44=back
     45
     46=cut
     47#####################################################################
    548
    649use strict;
    750use File::Spec::Functions;
     51use Getopt::Long;
     52use Pod::Usage;
    853
    9 ### Directory with PO files that are to be merged.
    10 my $podir = "po";
     54my $podir = "po";               ### Directory with PO files that are merged.
     55my $project = "josm";           ### Project/plugin name.
     56my $showhelp = 0;               ### Show help screen.
     57my $showman = 0;                ### Show manual page of this script.
     58
     59GetOptions('help|?|h'  => \$showhelp,
     60           'man'       => \$showman,
     61           'podir=s'   => \$podir,
     62           'project=s' => \$project,
     63          ) or pod2usage(2);
     64
     65pod2usage(1) if $showhelp;
     66pod2usage(-exitstatus => 0, -verbose => 2) if $showman;
     67
    1168### Path to POT file.
    12 my $potfile = catfile($podir, "photoadjust.pot");
     69my $potfile = catfile($podir, $project . ".pot");
    1370
    1471foreach my $pofile (split("\n", `find $podir -name "*.po"`)) {
Note: See TracChangeset for help on using the changeset viewer.