John Darrington <[EMAIL PROTECTED]> writes:

> On Thu, Jul 03, 2008 at 11:33:19AM -0700, Ben Pfaff wrote:
>      John Darrington <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] --no-translator | pigpo.pl 
> [EMAIL PROTECTED]

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 <[EMAIL PROTECTED]>


_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to