Skip to content

Instantly share code, notes, and snippets.

@kocoai
Last active July 11, 2019 12:00
Show Gist options
  • Save kocoai/bdb89be96af1fba41448921928aac1ad to your computer and use it in GitHub Desktop.
Save kocoai/bdb89be96af1fba41448921928aac1ad to your computer and use it in GitHub Desktop.
template NSLocalizedString #swiftgen #swift
extension L10n {
fileprivate static func tr(_ key: String, _ args: CVarArg...) -> String {
// Load from App's Bundle first
let format: String = NSLocalizedString(
key,
bundle: Bundle.main,
value: NSLocalizedString(key, bundle: Bundle(for: SportStringsBundleToken.self), value: "", comment: ""),
comment: ""
)
return String(format: format, locale: Locale.current, arguments: args)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment