This is a function defined in the Foundation Framework. It returns a localized version of a string.
Questions tagged [nslocalizedstring]
410 questions
6
votes
1 answer
Localize a float and specify number of decimal places in iOS
I have a float that I'd like to display to one decimal place. E.g. 104.8135674... to be displayed as 104.8 in English. Usually I'd use:
myString = [NSString stringWithFormat:@"%.1f",myFloat];
However, I'd like to localize the number, so I…

MattyG
- 8,449
- 6
- 44
- 48
6
votes
2 answers
Placeholder and NSLocalizedString
I'm trying to translate my application and I find it difficult to translate when there are half a placeholder. I need to locate the following code:
[textView1 insertText:[NSString stringWithFormat:@"%@ è il %i/%i/%i. Il giorno delle settimana è %@.…

Andrea
- 427
- 3
- 16
5
votes
2 answers
Macro for NSLocalizedString
All my calls of NSLocalizedString have nil as second param, because i don't use any comments. But i hate to repeat myself. Now i'm asking myself if it's ok to define a macro like LSSTRING(str) that calls NSLocalizedString(str, nil), and if so how?

peko
- 11,267
- 4
- 33
- 48
5
votes
2 answers
xcode localized string not loaded
I have met a strange problem with the localized strings. I have only a 'Localizable.strings' in my 'en.lproj' folder and it works fine. all the strings are shown on device. but the next time i compile it and run, it shows only the ID of the strings.…

boreas
- 1,041
- 1
- 15
- 30
5
votes
3 answers
how to use #undef directive in swift 2.3
I want to undefine or override NSLocalizedString in swift 2.3 and i search a lot about it and finally i found a way in Objective C to do this as below.
#undef NSLocalizedString
#define NSLocalizedString(key,_comment) your_function_name
I want to…

Sumit Jangra
- 651
- 5
- 16
5
votes
0 answers
How to add Unicode escape sequence in Localizable.strings?
How can a Unicode escape sequence be added to a string in Localizeable.strings file if the string is casted to NSString?
Here is one (ugly) example:
// Localized string: "\u{200F}Number %@" = "\u{200E}Number %@";
let string =…

Manuel
- 14,274
- 6
- 57
- 130
5
votes
1 answer
Notification Service Extensions with NSLocalizedString
I am using Notification Serivce Extension to change the text coming from the server as per what I Want.
However, that was working good with normal strings. but when I used NSLocalizedString with it, it dosent show the localized string, instead it…

FamousMaxy
- 686
- 5
- 21
5
votes
2 answers
Send localized string key in loc-args for iOS Push notifications
My application supports 4 languages & push notifications. When I send push notification to APNS , I am sending loc_key & loc-args. Now I need to send localized strings in loc-args array so that I can translate those on iOS app side when app receives…

iOSAppDev
- 2,755
- 4
- 39
- 77
5
votes
2 answers
iOS strings file collision - Same string in source langage, different in target
So, I'm localizing an app from japanese to english.
In japanese, there is no distinction between (say) "Mr." and "Ms."(/"Mrs."), so I need to do something like this:
/* Salutation format for user (male) */
"%@様" = "Mr. %@";
/* Salutation format for…

Nicolas Miari
- 16,006
- 8
- 81
- 189
4
votes
3 answers
NSLocalizedString returns text that is defined nowhere
OK, I am officially flabbergasted. I started an IOS project some time ago, and juggled around with localization a bit at the start, which became a bit of a mess, because I did not know how to do that properly yet.
Now I have decided to do the…

fishinear
- 6,101
- 3
- 36
- 84
4
votes
1 answer
Localized string with argument adds line breaks and brackets around argument
I am trying to display a localized string that contains an argument. Instead of displaying the string in one line with the argument embedded, the result is a broken 3-line string:
Expected result:
The price is $9.99/year.
Result:
The price is (
…

Kqtr
- 5,824
- 3
- 25
- 32
4
votes
0 answers
Disable localization in UILocalNotification alertBody
I'm using local notifications in my chat app (using Long polling). The problem is when the user receives a new chat while the app is in the background, the message affected to UILocalNotification alertBody is replaced with the localized string of…

Zakaria
- 1,040
- 3
- 13
- 28
4
votes
2 answers
NSLocalizedString Problem
I've got:
-(IBAction)about {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"About", @"Title of AlertView")
message:@"App name \n© My name \n2010"
…

Leon
- 417
- 3
- 11
- 24
4
votes
1 answer
Special - Chinese characters in string
I am doing language translation in code.
self.title.text = [NSString stringWithFormat:NSLocalizedString(@"Q%ld", nil), (long)quizNumber];
I have added localization which works fine in French case but in Chinese '%ld' comes on the screen.
If I put…

A_G
- 2,260
- 3
- 23
- 56
4
votes
2 answers
Dynamic/runtime dispatch in Swift, or "the strange way structs behave in one man's opinion"
I'm not horribly new to Swift, nor to Objective-C, but I saw some odd behavior when working with an Error subtype today that led me to dig a little deeper.
When working with an NSString subclass (yes, the below example functions similarly for…

Craig Otis
- 31,257
- 32
- 136
- 234