当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - how do you localize the contents of an UIAlertview

问题描述:

Using Base Internationalization, It's become really easy to produce automatic localizations based on Object ID. Here's a french version of something.

/* Class = "IBUILabel"; text = "Clear Memory"; ObjectID = "fHm-5n-KrF"; */

"fHm-5n-KrF.text" = "Effacer la mémoire";

But that only extends to things that Xcode can find in the storyboard.

It should be possible to include text strings in an AlertView. Surely.

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Wheel Cicumference" message:@"Ground Trace (mm):" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];

alert.alertViewStyle = UIAlertViewStylePlainTextInput;

alert.tag = 10;

[alert addButtonWithTitle:@"Accept"];

[alert show];

Apple docs are vast, and I haven't found anything meaningful so far. I don't necessarily wan't the answer laid out in full for me, Just set me off in the general direction

网友答案:

The only way i know to localize the UIAlert is the following:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", @"Error")
                     message:NSLocalizedString(message, message) delegate:nil
                      cancelButtonTitle:NSLocalizedString(@"OK", @"OK") otherButtonTitles:nil];
分享给朋友:
您可能感兴趣的文章:
随机阅读: