Created
August 6, 2013 03:55
-
-
Save fjolnir/6161882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compile localized nibs | |
require "tmpdir" | |
xib_dir = "#{ENV["PROJECT_DIR"]}/.../ja.lproj" | |
str_dir = "#{ENV["PROJECT_DIR"]}/.../en.lproj" | |
out_dir = "#{ENV["BUILT_PRODUCTS_DIR"]}/.../en.lproj" | |
Dir.mktmpdir do |tmpdir| | |
Dir.foreach xib_dir do |xib_name| | |
if File.extname(xib_name) == ".xib" | |
tmp_path = "#{tmpdir}/#{xib_name}" | |
nib_path = "#{out_dir}/#{File.basename(xib_name, ".*")}.nib" | |
str_path = "#{str_dir}/#{File.basename(xib_name, ".*")}.strings" | |
if File.exists?(str_path) | |
system("ibtool #{xib_dir}/#{xib_name} --write #{tmp_path} --strings-file #{str_path}") | |
system("ibtool #{tmp_path} --compile #{nib_path}") | |
else | |
system("ibtool #{xib_dir}/#{xib_name} --compile #{nib_path}") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment