Skip to content

Instantly share code, notes, and snippets.

@palaniraja
Created May 23, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palaniraja/a46ffb123eae79e19d99840e8006abce to your computer and use it in GitHub Desktop.
Save palaniraja/a46ffb123eae79e19d99840e8006abce to your computer and use it in GitHub Desktop.
Overriding NSLocalizedString function to print the keys used for debugging purpse
/**
* prints the localization key and string requested in log for debugging purpose
*/
#if DEBUG
public func NSLocalizedString(_ key: String, tableName: String? = nil, bundle: Bundle = Bundle.main, value: String = "", comment: String) -> String
{
let str = bundle.localizedString(forKey: key, value: value, table: tableName)
debugPrint("DEBUG: \(key) -> \(str)")
return str
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment