1
votes

here is a sample line:

    playLabel = [CCLabelTTF labelWithString:NSLocalizedString(@"play", nil) fontName:@"font.ttf" fontSize:32];

and my font.ttf file only support English/Chinese/Japanese, and if it is korean, nothing will show up. so i want to use Arial font for Korean (but still my custom font.ttf font for chinese/japanese, for french or spanish it's fine though since i can simply ignore the mark above letters.

so how can i do this? or should i make a method like [Helper getFont] and return different font files for different localization?

and also, when adding the language, i have multiple choices for one language (like 'zh' is chinese, but 'zh-hans' is simplified chinese and 'zh-hant' is traditional chinese, so can i just use zh for both case if i don't want to separate them?

1
should i make a method like [Helper getFont] and return different font files for different localization seems the optimal solution.Ahmad Kayyali
do you mean that i need to #define kLanguageBritish @"en-GB" , #define kLanguageFrench @"fr" etc, and then if (xxx == kLanguageKorean) return @"Arial"; else if (xxx == kLanguageSimpliedChinese return @"font.ttf" ?OMGPOP
and do you have a full list of language strings like "Zh-hans" for simplified chinese.OMGPOP
should i use 2 boolean methods, isLocalizationSupported and isCustomFontFileSupported?OMGPOP

1 Answers

3
votes

I am not sure if this will work (seems like it should), but what about if you defined the different font names in your localization files?

NSString *fontName = NSLocalizedString(@"playLabelFontName", nil);

playLabel = [CCLabelTTF labelWithString:NSLocalizedString(@"play", nil) fontName:fontName fontSize:32];

In your English/Chinese/Japenese localization file put:

"playLabelFontName" = "font.ttf"

In your Korean put:

"playLabelFontName" = "Arial.ttf"