Analyzer does not warn of non-localized strings

Originator:m.quinones.garcia
Number:rdar://24284913 Date Originated:21/01/16
Status:Open Resolved:
Product:Version 7.3 Product Version:beta (7D111g)
Classification:Enhancement Reproducible:Always
 
Summary:
Xcode 7.3 beta introduced a new analyzer setting named "CLANG_ANALYZER_LOCALIZABILITY". Enabling this warning correctly warns of hardcoded strings, but it does not warn of non-localized strings in the .strings files.

Steps to Reproduce:
1. Create new project
2. Enable CLANG_ANALYZER_LOCALIZABILITY 
3. Create a label in a view controller
4. Set text using bundle API using a non-localized string:
label.text = NSLocalizedString(@"non-localized", nil);

Comments

The steps are not clear

Just with NSLocalizedString(@"non-localized", nil) you don't know if the key is localized or not in the .strings file. Remember that the second parameter is just a comment for the translator (that doubles as default translation if there is not .strings). I don't think the compiler should check the actual .strings, it can slow down (even more) the compilation. Perhaps it can warn about a missing comment in NSLocalizedString call.

I think it should be checked as it's not a compiler operation, but an analyzer operation.

By m.quinones.garcia at March 30, 2016, 11:15 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!