nslocalizedstring

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

风格不统一 提交于 2019-12-03 13:17:12
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, the actual language is still the same. I read in this post that you can set the language yourself, so

iOS Get localized version of a string for a specific language

梦想的初衷 提交于 2019-12-03 12:27:26
I'm building an application for iOS that will be available in both English and French languages. I've read some tutorials around internationalization and I have an understanding of how it works and what I need to do. The problem I'm having is there is a specific case where I want to load French strings for an English user. I understand it's possible to set the language for the entire application, but that it requires the application to be restarted before it will take affect. I'd like to avoid this, and instead be able to pick to load French or English strings on demand. Is it possible to load

Overriding preferred strings localization on the fly for testing

夙愿已清 提交于 2019-12-03 03:51:37
Using the Settings app in the iPhone simulator to switch languages is a PITA way of testing localization tweaks. I'm trying to figure out a way to switch localizations (en/fr/es/etc) on the fly in my app with a debug setting without restarting the app. NSBundle provides ways of requesting localized resources from an arbitrary localization, e.g. - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)extension inDirectory:(NSString *)subpath forLocalization:(NSString *)localizationName But I find no equivalent for the string management subsystem. It sounds from these questions that

Change iphone app language with buttons and without restart of the app

雨燕双飞 提交于 2019-12-01 21:04:17
I want to change the language of my app. At the moment I am doing it at the following way. I have two buttons which are change the languages in NSUserDefaults. But before this affects my app I need to restart it. Here is my code. - (IBAction)changeDutch:(id)sender { [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"nl", @"en", nil] forKey:@"AppleLanguages"]; } - (IBAction)changeEnglish:(id)sender { [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", @"nl", nil] forKey:@"AppleLanguages"]; } This works fine. But I don't want every time to

Unicode not converted when displayed

帅比萌擦擦* 提交于 2019-12-01 16:29:03
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 like that ("Guardar configuraci\\u00F3n:"), instead of "Guardar configuración:". I tried different variations, such as "\u00F3", or "\\U00F3", but without any success. I use NSLocalizedString this way: self.saveSettingsLabel.text = NSLocalizedString(@"login.saveSettings", @"Save Settings:"); What am I doing wrong? Thanks for any help! Mihai The

Use default language fallback when key is untranslated

混江龙づ霸主 提交于 2019-12-01 09:28:35
Can i use default language (e.g. English) for untranslated keys in my other language Localizable.strings files ? To achieve this, you could use the English words as the keys in the Localizable.strings file. Another approach would be to check the outcome of NSLocalizedString and return the default english version (using a 'forced' bundle) in case the result is the same as the key. It could look something like this extension NSString { class func NSLocalizedStringWithDefault (key:String, comment:String)->String { let message = NSLocalizedString(key, comment: comment) if message != key { return

NSLocalizedString Problem

空扰寡人 提交于 2019-12-01 07:31:21
I've got: -(IBAction)about { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"About", @"Title of AlertView") message:@"App name \n© My name \n2010" delegate:self cancelButtonTitle:NSLocalizedString(@"Back", @"Cancel Button Title") otherButtonTitles:nil]; [alert show]; [alert release]; } And in the Localizable.strings : /* Title of AlertView */ "About" = "Über"; /* Cancel Button Title */ "Back" = "Zurück"; My problem: When the language is german it's german but when I change the language to english the alert view is still german What's wrong? Make the Localizable

Invalid Siri Support - Warning iTunes Connect

China☆狼群 提交于 2019-12-01 07:07:54
问题 I'm integrate SiriKit in my app for ride a book but after send my app to TestFlight I get a mail response with the next warnings. Invalid Siri Support - No example phrase was provided for INGetRideStatusIntent in the "en-CO" language Invalid Siri Support - No example phrase was provided for INRequestRideIntent in the "en" language I have added the necessary translation to my InfoPlist.string for each localised version but the problem still happens. I'm using the AppIntentVocabulary.plist

Use default language fallback when key is untranslated

▼魔方 西西 提交于 2019-12-01 06:49:14
问题 Can i use default language (e.g. English) for untranslated keys in my other language Localizable.strings files ? 回答1: To achieve this, you could use the English words as the keys in the Localizable.strings file. Another approach would be to check the outcome of NSLocalizedString and return the default english version (using a 'forced' bundle) in case the result is the same as the key. It could look something like this extension NSString { class func NSLocalizedStringWithDefault (key:String,

NSLocalizedString Problem

為{幸葍}努か 提交于 2019-12-01 04:21:25
问题 I've got: -(IBAction)about { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"About", @"Title of AlertView") message:@"App name \n© My name \n2010" delegate:self cancelButtonTitle:NSLocalizedString(@"Back", @"Cancel Button Title") otherButtonTitles:nil]; [alert show]; [alert release]; } And in the Localizable.strings : /* Title of AlertView */ "About" = "Über"; /* Cancel Button Title */ "Back" = "Zurück"; My problem: When the language is german it's german but when