Skip to content

Instantly share code, notes, and snippets.

@mamemomonga
Created July 9, 2013 02:58
Show Gist options
  • Save mamemomonga/5954353 to your computer and use it in GitHub Desktop.
Save mamemomonga/5954353 to your computer and use it in GitHub Desktop.
OSX用 日本語ローカライズされたディレクトリを作成
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
binmode(STDIN,':utf8');
binmode(STDOUT,':utf8');
use File::Path;
# 参考
# http://msyk.net/macos/jaguar-localize/
if(!$ARGV[0] || !$ARGV[1]) {
print "USAGE: $0 [en_name] [ja_name]\n";
exit;
}
my $en_name=$ARGV[0];
my $ja_name=$ARGV[1];
utf8::decode($en_name);
utf8::decode($ja_name);
my $basedir="$en_name.localized";
mkpath("$basedir/.localized");
{
open(my $fh,'>:utf8',"$basedir/.localized/en.strings") || die $!;
print $fh qq{"$en_name" = "$en_name";\n};
}
{
open(my $fh,'>:utf8',"$basedir/.localized/ja.strings") || die $!;
print $fh qq{"$en_name" = "$ja_name";\n};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment