5/15/2009

LanguageManager class

So I ended up writing my custom class called LanguageManager, which just holds all the strings that need to be translated and returns the strings.


LanguageManagerというクラスでlocalizationをすることに決定。オプションメニューでスイッチできるようにしたいので、アップルの自動的に認知するやつは使えなかった。


[LanguageManager translate:@"Start"];



+ (NSString *)translate:(NSString *)aString {
Settings *gameSettings = [Settings getInstance];
if (gameSettings.languageSettings == 0) return aString; // if user setting is English
if (gameSettings.languageSettings == 1){ //if user setting is Japanese
if(aString == @"Start") return @"スタート";
if(aString == @"Continue") return @"コンティニュー";
...


I wonder if there's any better way...
これでいいんかいな。

No comments:

Post a Comment