[iOS]多言語化(4) | Cocoa練習帳

[iOS]多言語化(4)

今回も、『iPhoneアプリケーションプログラミング』で紹介されていた方法。Xcodeでibtoolを使った日本語Storyboar生成の方法だ。




「ビルドフェーズ」に「スクリプトを実行」を追加する。




target


add_run_script




以前と同様、ja.lprojのMainStoryboard.stringsを日本語化する。




/* Class = "IBUITableViewController"; title = "Master"; ObjectID = "12"; */
"12.title" = "原盤";
 
/* Class = "IBUIViewController"; title = "Detail"; ObjectID = "21"; */
"21.title" = "詳細";
 
/* Class = "IBUINavigationItem"; title = "Detail"; ObjectID = "26"; */
"26.title" = "詳細";
 
/* Class = "IBUILabel"; text = "Detail view content goes here"; ObjectID = "27"; */
"27.text" = "詳細を表示";
 
/* Class = "IBUINavigationItem"; title = "Master"; ObjectID = "36"; */
"36.title" = "原盤";
 
/* Class = "IBUILabel"; text = "Title"; ObjectID = "phq-AM-6qj"; */
"phq-AM-6qj.text" = "表題";



スクリプトを記述。




script




ibtool --import-strings-file Homepwner/ja.lproj/MainStoryboard.strings --write Homepwner/ja.lproj/MainStoryboard.storyboard Homepwner/en.lproj/MainStoryboard.storyboard
exit 0



実行




storyboard




run




日本語化されている。




関連情報
iPhoneアプリケーションプログラミング