Tag: 本地化

获取用户的date格式? (DMY,MDY,YMD)

我正在创build一个表单,用户可以使用3个UITextFieldsinput自己的生日:1个月,1天,1年。 我想根据用户的date格式来安排它们。 即:美国用户的[MONTH] [DAY] [YEAR],欧洲用户的[DAY] [MONTH] [YEAR]等。 按国家划分的date格式地图: http : //en.wikipedia.org/wiki/Date_format_by_country#Map 什么是最简单的方式来获得这种格式? 现在我正在设置2000年10月20日的date并parsingstring。 NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; [components setDay:20]; [components setMonth:10]; [components setYear:2000]; NSDate *date = [calendar dateFromComponents:components]; NSLog(@"%@", [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterNoStyle]); 但我不认为这是正确的事情,因为我已经有太多不同的格式: 美国:10/20/00 FR:20/10/00 日本:2000/10/20 瑞典:2000-10-20

iOS:删除NSDecimalNumber中的千位分隔符以进行编辑

我有十进制数字存储在我的数据库中。 我根据用户的区域显示它们: – (NSString *) getLocalizedCurrencyStringWithDigits { NSNumberFormatter *numberFormatter =[[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; [numberFormatter setLocale:[NSLocale currentLocale]]; [numberFormatter setMinimumFractionDigits:2]; [numberFormatter setMaximumFractionDigits:2]; NSString *numberString = [numberFormatter stringFromNumber:self]; return numberString; } 我在可编辑的文本框中显示这些string。 所以如果用户开始编辑字段,我想删除千位分隔符。 否则(在我的国家),我input1'000.55,然后它不能识别“'”,只保存一个1.这是我的function来parsing文本字段,并在视图控制器这个确切的返回值将被保存到数据库: + (NSDecimalNumber *) getUnLocalizedDecimalNumberWithString:(NSString *)currencyString { NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; [numberFormatter setLocale:[NSLocale currentLocale]]; [numberFormatter setMinimumFractionDigits:2]; [numberFormatter setMaximumFractionDigits:2]; BOOL isDecimal […]

UIWebview加载不同的文件切换语言

我有不同的embeddedHTML文件在不同的语言。 我想根据当前的语言在webview中加载正确的文件。 有没有办法做到像NSLocalizableString一样简单? 谢谢

NSLocalizedString作为NSDictionary的关键

我在这个论坛上读到,可以使用NSLocalizedString作为NSDictionary的关键。 这是我的NSDictionary: LABELS = [[NSDictionary alloc] initWithObjectsAndKeys: NSLocalizedString(@"Threshold 0", @"Description for threshold 0") , @"threshold_0", NSLocalizedString(@"Threshold 1", @"Description for threshold 1"), @"threshold_1", NSLocalizedString(@"Threshold 2", @"Description for threshold 2"), @"threshold_2", NSLocalizedString(@"Threshold 3", @"Description for threshold 3"), @"threshold_3", NSLocalizedString(@"Threshold 4", @"Description for threshold 4"), @"threshold_4", nil]; 这是试图访问NSDictionary的代码: NSString *key = [NSString stringWithFormat: @"threshold_%d",{MY_VARIABLE}]; NSString *text = [LABELS […]

iOS的视网膜显示本地化的应用程序图标

我有问题显示与视网膜显示支持本地化的应用程序图标。 这怎么可能呢? 我试图使Icon.png和Icon@2x.png本地化,然后我试图使proj-Info.plist本地化,并尝试链接到不同的图像。 但只有项目语言的图标正在显示…

在iOS中禁用日文键盘的汉字自动完成(henkan)?

我正在使用UITextField并closures了正常的自动更正function,但我需要日语键盘才能在键入时不显示出现在键盘上方的汉字自动完成视图。 我正在尝试对用户进行测验,因此禁用此function很重要。 有任何想法吗?

本地通知何时didEnterRegion?

我有以下代码,当应用程序终止工作完美。 -(void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region{ UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = @"TEST NOTIFICATION"; notification.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; } 但是,当我做到以下几点: -(void) createTestNotification { UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = @"TEST"; notification.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; } -(void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region{ [self createTestNotification]; } 这是行不通的 ? 我只把我的代码移到外面没有别的? 我知道,当didEnterRegion被调用时,应用程序将只有5秒,但调用此方法不会花费这个时间? 更新1: 我刚刚发现区域 didEnterRegion返回的是我开始监测,而不是属于应用程序刚才看到它的信标的那个。我打算使用这个区域来获取我的自定义味精取决于该地区的主要和次要 。 但在我的情况下是不可能的,所以我开始测距,当didEnterRegion被调用,然后在didRangeBeacons返回信标数组我得到了属于这个信标的文本信息从本地数据库 “取决于主要和次要的” […]

智能sortingLocalized.strings文件

在我Localizable.Strings我尝试所有对按字母顺序。 是否有可能按字母顺序重新排列我的Localizable.strings ? Maby使用genstring或特殊的bash脚本? 在这里我有额外的要求来完成: 1.订购应不区分大小写。 2.第一个X(例如五个)行应该被复制,而不是有序的。 这个要求应该被满足,因为在Localized.strings文件中我有作者,公司名称和产品名称作为注释在上面。 3.保留意见 我想保留对翻译后的string的注释,并在每个翻译之间保留新的行。 这个注释是通过iOS开发人员的特殊的genstrings命令(例如find ./ -name "*.m" -print0 | xargs -0 genstrings -o en.lproj查找所有NSLocalizedString(@"Param",@"Comment") in我的代码并生成对/* Comment */ /r/n "Param" = "Param";文件)。 翻译前的注释行是可选的,可能只有1行。 例如文件: /* This is Billy */ "Billy" = "The smartest guy in the univererse"; /* The Hitchhiker's Guide to the Galaxy */ "42" = "the answer […]

iOS本地化/设置的国际化使用Xcode 6 XLIFF导出的笨拙

背景: Xcode 6添加了一个快速导出function,为每种语言创build一个XLIFF文件(只需从文件导航器中select您的项目,然后select菜单项编辑器→导出为本地化 )。 问题: 它工作得很好,在XML中包含了一切…除了设置捆绑string 。 有没有人有这方面的经验? 编辑: 经过深入的研究,看起来没有办法强制Xcode(版本6.1)将Settings Bundle Strings包含到XLIFF文件中。 所以它必须单独翻译。

iOS:如何构build双语言iOS本机应用程序

我的客户希望在应用程序内部应该有双语(阿拉伯语和英语)支持的iOS应用程序。我认为本地化将为此做出努力。但是对于阿拉伯语(RTL),devise布局是不同的。我怎样才能做到这一点? 应该为英文和阿拉伯文版本devise单独的Nib文件。请帮助我。