pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: German translations for psppire


From: Ben Pfaff
Subject: Re: German translations for psppire
Date: Sun, 06 Jul 2008 16:05:11 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

John Darrington <address@hidden> writes:

> On Thu, Jul 03, 2008 at 11:33:19AM -0700, Ben Pfaff wrote:
>      John Darrington <address@hidden> writes:
>      
>      > I suggest what we do is to incorporate Andreas' patch, and also to
>      > remove de from po/LINGUAS until such time as a native German speaker
>      > wants to come forward and maintain a localisation.
>      
>      An alternative way to test localization support would be to use
>      one of the programs that do automatic translation into a fake
>      language, e.g. I believe that Red Hat once offered Pig Latin as a
>      "language".
>
>
> What we'd need would be a program which takes pspp.pot and
> automatically "translates" each string into pig latin.  So far I
> haven't been able to find a program to do that --- it shouldn't be too
> hard to write one.

Here's a try.  Invoke from 'po' directory as:
        msginit < pspp.pot -o - -l address@hidden --no-translator | pigpo.pl > 
address@hidden

I found this interesting tidbit on the wikipedia page for pig
latin: 
    Australia's use of Pig Latin is generally associated with the
    'lad' culture of Western Sydney and Northern
    Melbourne. "Lads" and "Lasses" use pig latin to fool
    authority figures and to cause public nuisance.
In the US, it's usually just kids having fun.

#! /usr/bin/perl
use warnings;
use strict;
my $in_msgstr = 0;
my $msgstr_num = 0;
while (<>) {
    if (/^(msgstr(?:\s*\[\d+\])?\s+")(.*)("\s*)$/) {
        if ($msgstr_num++ > 0) {
            $in_msgstr = 1;
            print $1, translate($2), $3;
        }
        next;
    } elsif ($in_msgstr) {
        if (/^(\s*")(.*)("\s*)$/) {
            print $1, translate($2), $3;
            next;
        } else {
            $in_msgstr = 0;
        }
    }
    print $_;
}

sub translate {
    local ($_) = @_;
    s/([%a-zA-Z]+)/mkpig($1)/ge;
    return $_;
}

sub mkpig {
    my ($orig) = @_;
    local $_ = $orig;

    return $_ if /^[^IaA]$/ || /^[A-Z]{2,}$/ || /%/;
    if (/^qu(.*)$/i) {
        $_ = "$1quay";
    } elsif (/^[^aeiou]/i) {
        s/^([^aeiouyAEIOUY]+)(.*)$/$2$1/;
        $_ .= 'ay';
    } else {
        $_ .= 'way';
    }
    return ($orig =~ /^[A-Z]+$/ ? uc($_)
            : $orig =~ /^[A-Z][a-z]+$/ ? ucfirst(lc($_))
            : $_);
}

-- 
"While the Melissa license is a bit unclear, Melissa aggressively
 encourages free distribution of its source code."
--Kevin Dalley <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]