nslocalizedstring

Localized String with Interface Builder User Defined Runtime Attributes

折月煮酒 提交于 2019-12-10 13:32:46
问题 I am currently trying to create a localized accessibilityLabel in the storyboard (I am trying to avoid doing it programatically). It seems that whenever I use the Localized String option, the accessibilityLabels ends up being set to the localized string key that I have provided rather than the string itself. Does anyone have the solution to this problem? Any help would be greatly appreciated. 回答1: I guess you expect the localized string to be taken from Localizable.strings. The "Localized

genstrings does not work with macro for NSLocalizedString

核能气质少年 提交于 2019-12-10 11:11:00
问题 I would like to shorten "NSLocalizedString" to "_" so I'm using macro _(x) NSLocalizedString(@x, @__FILE__) . But now, when I want to generate strings for localization with find . -name \*.m | xargs genstrings it generates nothing. Any help? 回答1: You can tell genstrings to look for a different function by using the '-s' argument: genstring -s MyFunctionName .... However , MyFunctionName must follow the same naming and argument conventions as one of the built in NSLocalizeString macros. In

Multi-line strings in objective-c localized strings file

巧了我就是萌 提交于 2019-12-09 14:00:34
问题 I have a template for an email that I've put in a localized strings file, and I'm loading the string with the NSLocalizedString macro. I'd rather not make each line its own string with a unique key. In Objective-C, I can create a human-readable multiline string like so: NSString *email = @"Hello %@,\n" "\n" "Check out %@.\n" "\n" "Sincerely,\n" "\n" "%@"; I tried to put that in a .strings file with: "email" = "Hello %@,\n" "\n" "Check out %@.\n" "\n" "Sincerely,\n" "\n" "%@"; But I get the

iOS, Cocoa, AppiRater - How to localized Cancel Button for SKStoreProductViewController

◇◆丶佛笑我妖孽 提交于 2019-12-08 01:02:02
问题 How can I localize the "Cancel" button in the AppiRater view controller that is popped over? I was looking in the AppiRater code... it makes us of the SKStoreProductViewController like this: SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init]; Basically I want to something like this: [storeViewcontroller.navigationBar.cancelButton setText:NSLocalizedString(@"Cancel", nil)]; Any ideas? 回答1: Appirator? Rating SDK? Here is localized version of

Xcode 8 Ambiguous expansion of macro NSLocalizedString

流过昼夜 提交于 2019-12-07 01:38:39
问题 I have the following in my unit test .pch file to allow my unit tests to find the right bundle for the localization files and this was working fine until I upgraded to Xcode8. #undef NSLocalizedString #define NSLocalizedString(key, comment) [[NSBundle bundleWithIdentifier:@"Tests-Unit"] localizedStringForKey:(key) value:@"" table:nil] Now, I get the warning Ambiguous expansion of macro NSLocalizedString Which would explain why my unit tests fail as they can't find the localized string value

How to shift all UIView From Left to Right in iOS? (Objective-C)

女生的网名这么多〃 提交于 2019-12-06 13:37:40
问题 I am working on app which support English and Arabic languages. My requirement is when I choose English, all the UIView s should be displayed from Left to Right. (ie. on the left side there is an UIImageView and UILabel on the Right of UIImageView , see in pic below) But when user choose Arabic language then UIImageView should come to right side of screen and UILabel should come to the Left of UIImageView . Is it possible to do in iOS or I should create separte ViewController layout for

iOS, Cocoa, AppiRater - How to localized Cancel Button for SKStoreProductViewController

杀马特。学长 韩版系。学妹 提交于 2019-12-06 11:53:10
How can I localize the "Cancel" button in the AppiRater view controller that is popped over? I was looking in the AppiRater code... it makes us of the SKStoreProductViewController like this: SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init]; Basically I want to something like this: [storeViewcontroller.navigationBar.cancelButton setText:NSLocalizedString(@"Cancel", nil)]; Any ideas? Appirator? Rating SDK? Here is localized version of Appirator. Make sure you added all .lproj folder to your Xcode project. 来源: https://stackoverflow.com/questions

genstrings does not work with macro for NSLocalizedString

 ̄綄美尐妖づ 提交于 2019-12-06 05:00:45
I would like to shorten "NSLocalizedString" to "_" so I'm using macro _(x) NSLocalizedString(@x, @__FILE__) . But now, when I want to generate strings for localization with find . -name \*.m | xargs genstrings it generates nothing. Any help? You can tell genstrings to look for a different function by using the '-s' argument: genstring -s MyFunctionName .... However , MyFunctionName must follow the same naming and argument conventions as one of the built in NSLocalizeString macros. In your case, you can not just specify the string key, you must also specify the documentation string. In fact,

How to use Localizable.strings stored in a CocoaTouch Framework?

天大地大妈咪最大 提交于 2019-12-05 14:23:49
问题 I'd like to add multi-language support to a CocoaTouch Framework. The problem: The Localizable.strings file I created only gets used by NSLocalizedString when it's part of the main app and its target. I'd like to store it inside the Framework to keep things separate. How can I use the Localizable.strings when placed inside a CocoaTouch Framework? 回答1: Use: NSLocalizedString("Good", tableName: nil, bundle: NSBundle(forClass: self), value: "", comment: "") or you can create public func like

Xcode 8 Ambiguous expansion of macro NSLocalizedString

為{幸葍}努か 提交于 2019-12-05 05:39:35
I have the following in my unit test .pch file to allow my unit tests to find the right bundle for the localization files and this was working fine until I upgraded to Xcode8. #undef NSLocalizedString #define NSLocalizedString(key, comment) [[NSBundle bundleWithIdentifier:@"Tests-Unit"] localizedStringForKey:(key) value:@"" table:nil] Now, I get the warning Ambiguous expansion of macro NSLocalizedString Which would explain why my unit tests fail as they can't find the localized string value anymore. Any ideas what is wrong there? Is there something I need to now do differently? EDIT: I have a