nslocalizedstring

Translate attributed string

纵然是瞬间 提交于 2021-02-07 11:36:30
问题 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 only found a solution where the whole string is set and then the attributes are set by range. But when I translate the string, I don't know the range anymore, because the words are longer or smaller. 回答1: Another option is to create localized .rtf

Send localized string key in loc-args for iOS Push notifications

拥有回忆 提交于 2020-05-27 04:06:29
问题 My application supports 4 languages & push notifications. When I send push notification to APNS , I am sending loc_key & loc-args . Now I need to send localized strings in loc-args array so that I can translate those on iOS app side when app receives the push notification. But when I send localized strings in loc-args , instead of showing translated string in notification center , it just showed localized key as it is. My string file contains below 2 messages: "WINNER_ALERT"= "Congratulations

Alternative strings for different targets of same App - use NSLocalizedString?

你说的曾经没有我的故事 提交于 2020-01-22 14:46:10
问题 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 the strings I have used in the first version for the new version, and was wondering the best way to approach this. Rather than use #ifdef/#else statements before the declaration of each string, I was thinking of using NSLocalizedStrings. However,

NSLocalizedString not defaulting to Base language

廉价感情. 提交于 2020-01-02 02:17:08
问题 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 myButton in the viewDidLoad method of the VC I am setting the buttons's title: NSString *title = NSLocalizedString(@"MY_BUTTON", @"My comment for my button"); [self.myButton setTitle:title forState:UIControlStateNormal]; I generated the Localizable

How to make iOS app name localizable? [duplicate]

百般思念 提交于 2019-12-28 11:54:14
问题 This question already has answers here : How to localize bundle display name in iPhone app? (5 answers) Closed 2 years ago . I'm trying to find the easiest way to localize my app. I'm using sqlite, so I need basically only to switch my database name. Problem is the app name - can it be localized from code or I have to make x apps for x languages, so anyone will have app name in his/hers native language? The latter one seems like already rejected app to me... anyone? 回答1: I assume you mean the

How to make iOS app name localizable? [duplicate]

一笑奈何 提交于 2019-12-28 11:53:32
问题 This question already has answers here : How to localize bundle display name in iPhone app? (5 answers) Closed 2 years ago . I'm trying to find the easiest way to localize my app. I'm using sqlite, so I need basically only to switch my database name. Problem is the app name - can it be localized from code or I have to make x apps for x languages, so anyone will have app name in his/hers native language? The latter one seems like already rejected app to me... anyone? 回答1: I assume you mean the

NSLocalizedString(key: value: comment: ) with variable is not working in swift

蓝咒 提交于 2019-12-25 08:07:05
问题 I need to localize a string which has some variable and the localized string must be defined with key: value: comment format. Guys I tried many ways but don't get the right way yet. See here... let timeValue = 5 let timeString = "hours" //Bellows are working fine dateLabelString = String(format: "Overdue by %d %@", timeValue,timeString) //Working //Normal flat string dateLabelString = String(format: NSLocalizedString("Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"),

How to provide a localized description with an Error type in Swift?

心已入冬 提交于 2019-12-25 08:02:06
问题 I am defining a custom error type with Swift 3 syntax and I want to provide a user-friendly description of the error which is returned by the localizedDescription property of the Error object. How can I do it? public enum MyError: Error { case customError var localizedDescription: String { switch self { case .customError: return NSLocalizedString("A user-friendly description of the error.", comment: "My error") } } } let error: Error = MyError.customError error.localizedDescription // "The

NSLocalizedString is it really working?

佐手、 提交于 2019-12-23 21:10:28
问题 I misunderstand NSLocalizedString . I have a project with French and English .strings files. In project target - Localizations I have 6 files in French and English. In english.strings file: "hello" = "world"; In french.strings file: "hello" = "salut"; When I write a simple line of code to change label text: exerciseDescription.text = NSLocalizedString(@"hello", @"no comment"); Output is: hello I changed in iOS simulator : settings - general - international - language - French/English - Done

NSLocalizedStringFromTable not working in CocoaPod dependency

时间秒杀一切 提交于 2019-12-23 19:14:35
问题 I've installed REActivityViewController as a pod. Here's the picture of the Resources folder in the pod: And here's one of the lines trying to pull the strings: [_cancelButton setTitle:NSLocalizedStringFromTable(@"button.cancel", @"REActivityViewController", @"Cancel") forState:UIControlStateNormal]; The button titles come out not-localized. In this example it shows button.cancel . It's also not just this button title but all the buttons in this dependancy. EDIT So in my Main Project under