Only import translations that don't exists for us yet.
+=item --cache
+
+Write a L<Storable> cache for things downloaded from Translatewiki and
+use it if it exists.
+
=back
=head1 AUTHOR
'h|help' => \my $help,
'locales-dir=s' => \(my $locales_dir = 'config/locales'),
'only-new' => \my $only_new,
+ 'cache' => \my $cache,
) or help();
# On --help
{
my @languages = @_;
- my $cache_file = "/tmp/merge-from-translatewiki.storable";
- if (-f $cache_file) {
- my $cache = retrieve($cache_file);
- return %$cache;
+ if ($cache) {
+ my $cache_file = "/tmp/merge-from-translatewiki.storable";
+ if (-f $cache_file) {
+ my $c = retrieve($cache_file);
+ return %$c;
+ }
}
my %translatewiki_languages;
$translatewiki_languages{$lang} = $flat_data;
}
- store \%translatewiki_languages, $cache_file;
+ if ($cache) {
+ store \%translatewiki_languages, $cache_file;
+ }
return %translatewiki_languages;
}