]> git.openstreetmap.org Git - rails.git/commit
Convert all the Potlatch locale files to a rails-like format (to make
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 23 Sep 2009 16:26:17 +0000 (16:26 +0000)
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 23 Sep 2009 16:26:17 +0000 (16:26 +0000)
commit889523944f024bf550fd6f256a592a9f15fe4f7f
treec891b1c30550eb4d17b3ff259ef072232a29d981
parent446227522531bd014c5878d0f3b754ef40c6a134
Convert all the Potlatch locale files to a rails-like format (to make
it easier for Translatewiki).

Here's the program I used to convert it:

{{{
    #!/usr/bin/env perl
    use feature ':5.10';
    use strict;
    use warnings;
    use YAML::Syck qw(Load LoadFile Dump DumpFile);
    use File::Slurp qw(slurp);
    use Data::Dump 'dump';
    use Encode qw(decode);
    use autodie;

    $YAML::Syck::Headless = 1;
    $YAML::Syck::SortKeys = 1;
    $YAML::Syck::ImplicitUnicode = 1;

    my %lang;
    chdir 'locales';
    my @yml = glob "*.yml";
    my @lang = map { s/\.yml//; $_ } @yml;

    for my $lang (@lang) {
        say "Loading $lang";

        my $file = "$lang.yml";
        $lang{$lang} = LoadFile($file);
        if (-f "$lang.html") {
            $lang{$lang}->{"help_html"} = slurp("$lang.html")
        }

        DumpFile("$lang.yml.new", { $lang => $lang{$lang} }) or die "arghl";
    }
}}}
26 files changed:
config/potlatch/locales/br.yml
config/potlatch/locales/cs.yml
config/potlatch/locales/cz.yml
config/potlatch/locales/da.yml
config/potlatch/locales/de.yml
config/potlatch/locales/en.html [deleted file]
config/potlatch/locales/en.yml
config/potlatch/locales/es.yml
config/potlatch/locales/fi.yml
config/potlatch/locales/fr.yml
config/potlatch/locales/hu.yml
config/potlatch/locales/is.yml
config/potlatch/locales/it.yml
config/potlatch/locales/ja.yml
config/potlatch/locales/ko.yml
config/potlatch/locales/lolcat.yml
config/potlatch/locales/nl.yml
config/potlatch/locales/no.yml
config/potlatch/locales/pt-BR.yml
config/potlatch/locales/ro.yml
config/potlatch/locales/ru.yml
config/potlatch/locales/sv.yml
config/potlatch/locales/tr.yml
config/potlatch/locales/vi.yml
config/potlatch/locales/zh-HANS.yml
config/potlatch/locales/zh-HANT.yml