Questions tagged [nslocalizedstring]

This is a function defined in the Foundation Framework. It returns a localized version of a string.

410 questions
17
votes
1 answer

iPhone/iOS: How can I get a list of localized strings in all the languages my app is localized in?

I need to send my server a list of localizations for a particular string. Meaning, if my app has a string Foo which is localized as @"Foo" in English and @"Фу" in Russian, I'd like to send the server a list such as this: String Foo: English:…
Tatiana Racheva
  • 1,289
  • 1
  • 13
  • 31
17
votes
3 answers

App localization showing the key instead of the value in iOS

I've been using localization in my app, but for some reason, some of the strings (not all of them) won't translate, I see the key instead the value. I've tried to check if the app finds the localization files by doing this: NSString *enPath =…
ytpm
  • 4,962
  • 6
  • 56
  • 113
17
votes
1 answer

How does localizedStringWithFormat work?

Please note I am not asking about NSLocalizedString() the macro. I am asking about the NSString class function + (instancetype)localizedStringWithFormat:(NSString *)format, .... These are two separate things. Question I'm trying to use the NSString…
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
16
votes
7 answers

Unit Testing iPhone Code That Uses NSLocalizedString

I have an iPhone iOS4.1 application that uses localized strings. I have just started building unit tests using the SenTestingKit. I have been able to successfully test many different types of values. I am unable to correctly test any of my code that…
Jay Haase
  • 1,979
  • 1
  • 16
  • 36
15
votes
6 answers

iPhone: NSLocalizedString in interface builder?

Is there any way to insert an NSLocalizedString in interface builder. For example set a label text to a localized string instead of a static string? I really hate to create a property for every single item that requires a localized string.
aryaxt
  • 76,198
  • 92
  • 293
  • 442
15
votes
2 answers

iOS Get localized version of a string for a specific language

I'm building an application for iOS that will be available in both English and French languages. I've read some tutorials around internationalization and I have an understanding of how it works and what I need to do. The problem I'm having is there…
raydowe
  • 1,285
  • 1
  • 16
  • 31
14
votes
3 answers

XCode 9 localization export/import doesn't include NSLocalizedString() or comments

Situation: We use XCode exporting/importing tools to generate localizable files for our translators. This was going fine in XCode 8. Since we updated to XCode 9 we see a couple of problems. Problems: When exporting a localization via…
Thermometer
  • 2,567
  • 3
  • 20
  • 41
14
votes
4 answers

Is it possible to localize UITabBarItem text in a storyboard automatically?

I'm new to native iOS development, and have been playing with localizing storyboards. I've been localizing the text for UILabel and UIButton objects in my storyboard by updating the Main.strings files for the storyboard: //…
asgeo1
  • 9,028
  • 6
  • 63
  • 85
13
votes
5 answers

Translate attributed string

I have a UILabel with an attributed string. Here is a printscreen of it: Now, I have to translate this attributed string to english and italian. I am searching for a way to do this. Can I build this attributed string in code part by part? I have…
BennoDual
  • 5,865
  • 15
  • 67
  • 153
12
votes
1 answer

iOS: How to localize strings with multiple interpolated parameters?

How do I use NSLocalizedString to build a string with multiple parameters while giving the translator control to change the order if they wish? An example in my Localizable.string is: "score_out_of"="Your score is %i out of %i"; And would be…
Chris
  • 6,076
  • 11
  • 48
  • 62
12
votes
3 answers

Run unittests with a specific locale (en_US or none)

Is there a way to force a specific locale when running unittests? Eg. always use en_US or force no locale, so that none of the .lproj files are loaded. My unittest is sensitive to the currently selected language in the Settings app (in the iOS…
neoneye
  • 50,398
  • 25
  • 166
  • 151
11
votes
2 answers

Customise Mainstoryboard.strings per target

I have an Application with 2 targets. String resources in the app are scattered across the code and storyboard file. Now I need totally distinct set of strings for both the targets (Although in English language though for both targets). I was able…
Dibzmania
  • 1,934
  • 1
  • 15
  • 32
11
votes
2 answers

iOS is there a way to assign Localized String to a UILable from IB/storyboard

I want to assign NSLocalizedString(key, comment) to a UILabel from storyboard without creating an outlet for it.
Nagesh
  • 167
  • 1
  • 2
  • 11
11
votes
5 answers

XLIFF localization tools for Xcode 6

Xcode 6 introduced a new localization workflow which uses the open .XLIFF format. Xcode extracts the strings from NSLocalizedString, strings in storyboards / XIB files and creates a single XLIFF file for each localization. I'm looking for good…
Felix
  • 35,354
  • 13
  • 96
  • 143
11
votes
9 answers

NslocalizedString return the key instead of the value

I create tow Localizable.strings files one for english and the second for arabic : /* The number 1 */ "LABEL_ONE" = "label number one"; I am using this code to get the string value: [self.Lable1 setText:NSLocalizedString(@"LABEL_ONE", @"The number…
user3648409
  • 293
  • 4
  • 10
1
2
3
27 28