This is a function defined in the Foundation Framework. It returns a localized version of a string.
Questions tagged [nslocalizedstring]
410 questions
11
votes
4 answers
NSLocalizedString not defaulting to Base language
I have the following problem with a small iOS 7 project on which I'm testing the localisation capabilities.
I have a default project, with one VC, in which I have one button in the middle of the scene
in my VC I have an IBOutlet to my button called…

tufyx
- 163
- 1
- 8
10
votes
1 answer
What do NSLocalizedString() parameters "value" and "tableName" do?
The Apple docs for this (both in Xcode and webpage) have exactly no explanation of the parameters.
https://developer.apple.com/documentation/foundation/1418095-nslocalizedstring
For reference, the function signature is
NSLocalizedString(
_ key …

Andrew Duncan
- 3,553
- 4
- 28
- 55
10
votes
3 answers
Xcode 7 crash: [NSLocalizableString length] 30000
The app just hangs on iOS7,8,9, makes 30000 calls to [NSLocalizableString length]
The cpu is on max.
see https://forums.developer.apple.com/thread/16001 also
(lldb) bt
* thread #1: tid = 0x2cb4df, 0x0349065c Foundation`-[NSLocalizableString length]…

Zsolt
- 3,648
- 3
- 32
- 47
10
votes
3 answers
iOS Localization: Best Practices
What are your best practices regarding Localization for iOS?
I have been working quite a lot with Localization but it feels like is not good enough and scalable. There needs to be some better way.
This is my current approach:
Using .strings files +…

user023
- 1,450
- 2
- 17
- 21
10
votes
1 answer
Swift use unicode character in localization.strings
I am trying to put a unicode character inside my localization.strings file. When I manually set a label's text to "\u{F071}", the character appears properly. When I have that character as part of a string within the localization file, then the…

Mike Walker
- 2,944
- 8
- 30
- 62
10
votes
5 answers
Multiple Localized .strings Files in iOS App Bundle
I have a fairly complicated project, consisting of several large localized sub-projects.
Most of my sub-projects are localized through a single Localizable.strings file. This file is copied into a SubProjectName.bundle target, which is used in…

simeon
- 4,466
- 2
- 38
- 42
9
votes
2 answers
Xcode 8 Ambiguous expansion of macro NSLocalizedString
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)…

m.y
- 691
- 9
- 21
9
votes
3 answers
Testing localizations in an iOS playground
Is there a way to get localized strings into an iOS playground? I have a number of right-to-left language translations that include format codes that I had to edit with a hex editor (to ensure the codes were in the correct byte order), and I wish to…

JustinHK
- 758
- 1
- 6
- 19
9
votes
1 answer
using nsattributedstring and nslocalizedstring
My old code uses NSLocalizedString to display the following where outputText was an NSMutableString that contained many such lines in a single output session:
[outputText appendFormat: NSLocalizedString(@"\n\n%@ and %@ are identical. No comparison…

Mickey
- 95
- 1
- 6
8
votes
3 answers
Enabling Double Length Pseudolanguage doesn't work in Xcode 7.3
I'm trying to use the Double Length Pseudolanguage to test potential layout problems with other languages. I've enabled Application Language -> Double Length PseudoLanguage in scheme editor but when I run the app in the simulator, none of the…

ninjaneer
- 6,951
- 8
- 60
- 104
8
votes
1 answer
Unicode not converted when displayed
I'm localizing an app to spanish, and characters are encoded in the Localizable.strings file for that language using Unicode. For example, I have the entry: "login.saveSettings"="Guardar configuraci\\u00F3n:"; which is displayed in a UILabel exactly…

Mihai Fonoage
- 478
- 2
- 8
- 23
8
votes
3 answers
iOS - NSLocalizedString is only returning the key string
I'm having some trouble debugging my NSLocalizedString implementation. Should be simple, but whatever I do, the function only returns the KEY string.
I'm using XCode 4.5 and iOS6, so I:
Added a new file called File.strings.
In my project settings I…

Brett
- 11,637
- 34
- 127
- 213
8
votes
2 answers
Force genstrings to build the Localizable.strings file in order of appearance rather than alphabetically
I'm new to internationalization and localization for iOS. I'm running genstrings:
find . -name \*.m | xargs genstrings -o en.lproj to generate my Localizable.strings files. It builds the file in alphabetical order (by key).
For ease of translation…

MattyG
- 8,449
- 6
- 44
- 48
7
votes
3 answers
Alternative strings for different targets of same App - use NSLocalizedString?
I'm building a version of an App I have already released, but with a few changes. It's not quite a lite/full version relationship, but they're similar enough that I'm using the same project with a different target.
I'd like to reword almost all of…

Smikey
- 8,106
- 3
- 46
- 74
7
votes
1 answer
What language specifically is Chinese, language code 'zh'?
I understand that there is Simplified Chinese (zh-Hans) and Traditional Chinese (zh-Hant).
However Xcode allows to localize for Chinese (zh).
From the localization fallback concept I understand that it is the fallback for Simplified Chinese and…

Manuel
- 14,274
- 6
- 57
- 130