1
votes

What would be a good method to interchange the font depending on the location of the user. For example I have the word "Play", but if the user is in Japan I will need to use a different font to display "プレイ" on the screen. So far I have this to display the text button:

self.restartLabel = [SKLabelNode labelNodeWithFontNamed:@"BD Cartoon Shout"];
self.restartLabel.text = NSLocalizedString(@"RESTART", @"Restart");

I know I need to replace [SKLabelNode labelNodeWithFontNamed:@"BD Cartoon Shout"]; I just don't know how to replace it with something like this:

-(void)correctLanguage{

  NSString *localLanguage = [[NSLocale currentLocale] objectForKey: NSLocaleLanguageCode];
    NSLog(@"%@",localLanguage);

if ( [localLanguage isEqualToString:@"jp"] ) {
    [SKLabelNode labelNodeWithFontNamed:@"ヒラギノ角ゴ ProN W6"];
}
else {
    [SKLabelNode labelNodeWithFontNamed:@"cartoon"];
}

}
1

1 Answers

4
votes

Put the name of the font to use into your localization, and use NSLocalizedString to fetch it.