Core Data and Special Characters in App Name - ios

I understand that if the app name contains spacing, then when we append the app name to Core Data entity class name, we need to replace the spaces with underscores e.g. My Game with My_Game.
What if the app name contains exclamation mark i.e. ! or ? how does this effect the application name?

Bluehound made the best point of all, that core data models and project names shouldn't contain crazy characters (which Xcode and MacOS might not deal predictably with). The place to add your exclamation points and/or those crazy characters is in the app's Info.plist file, which is where the display name is set via the "CFBundleDisplayName".
How do to this can be found in this tutorial.

Related

iOS - fastlane deliver, localized App Store description from strings file?

I'm getting ready to have my app localized into other languages.
I'm using NSLocalizedStringWithDefaultValue to provide default English text within code, although I guess none of that maybe relevant.
I'm not adding localized text directly to nib or storyboards, everything is in my strings file.
I'll probably end up uploading those to a localization site.
So I'd like to use fastlane deliver to upload screenshots and meta data.
However I'd like to find a method where I can pickup values from my strings files.
So I guess my question is, how can I get my strings value into my deliver text file?
Or is there a better / quicker approach I should use?

iOS App Localisation Best Practices And Placeholders

We're currently at the stage of looking at localising our app in to multiple languages now that the general concepts of the app have been decided. This is something I want to ensure is done correct from the start to lower the risk of headaches in the future.
The app targets iOS 7 and above, uses storyboards, and is written in Swift.
Storyboards
When working with a storyboard (or a xib), what's the best way to mark a UI element as "not to be translated"? For example, I have a placeholder string for a user's display name (Display Name), which will be replaced by a users display name at run time. This display name will not be localised, but neither should the string "Display Name". Is there a method of not having a UI element's value automatically put in to the strings file? If not, is going in to that file and manually removing strings I don't want localising a sustainable option?
Strings In Code
I'm using the Swift function NSLocalizedString with the key and comment parameters. Some places I've seen say to set the key to be a unique id based on the context (e.g., intro.login-button-text), while others seem to just put the full string in the default language (e.g., Login). I like the idea of the unique ids for the key, but would this not go against the idea of the "base" language?
Exporting
Xcode 6's "Export For Localization" option seems very useful for getting the correct format of file to be sent to translators. However, as mentioned previously, placeholder text does not need to be translated. Should these placeholders be removed from the exported xliff or the strings file prior to export?
Looking for the the same questions myself. Hope this will help you and others. Also I would recommend to have some kind of tool to organize the xliff/string files
Storyboards:
I've seen developers putting non translating texts in storyboard with extra parentheses. i.e. {Display name}.
By using this you can see by the translation itself if it needs to be translated or not. We use oneskyapp.com and can select to hide those translations and they will be hidden for each import of that key.
Strings in Code
By following this thread they suggest to use keywords.
Best practice for key values in translation files
Exporting
I cannot find a way to have some translations automatically removed when exporting. Off course you can put the views which has dynamic fields in different XIB/storyboards and decide not to translate those.
Again a tool like onskyapp.com can help you with this.
Formats
As of context with the field is important and a translation can be different when it is followed by i.e. a users name I would go for "%1$# is online!"

Localization not working on Xcode

I can't get my app to work with localization.
I have created a Localizable.strings file and ticked the languages that I am localizing. (For now I have base, english and spanish.)
Localized storyboard with three languages.
In Project settings > Info I checked Use Base internationalization and all languages are correctly added. (Moreover, beside the language it shows 2 Files Localized, which I guess they must be the storyboard and .strings file.
I am using this example for testing:
self.loginLabel.text = NSLocalizedString(#"login", #"Login text info");
This is how the Localizable.strings (Base) file is looking like:
"login" = "Log in";
However, it is not working and instead it is showing login. Have I forgotten a key step?
BTW: I have tried already changing the login text just it case something was overriding the label.
Those are the steps indeed, I don't think you've left anything out. I usually set the comment to nil instead of another NSString though - not sure if that makes a difference.
However, rather than in only base, make sure you're adding the same line also to the English and Spanish files (obviously translated as appropriate).
Next, for the language to show up, set the device to said language. Close your app and start it again. Strings should now show up in the other language.
Note that the Simulator often has trouble with new translations, especially when they've been added to an already deployed app. In that case, remove the app from the Simulator, click on Product - Clean, and re-deploy.
In my case, it didn't work because the UILabel text was set as "Attributed" instead of "Plain" in the Attributes Inspector.
Localization with a .strings file doesn't seem to work on Attributed strings.
I even had a storyboard with mixed Plain and Attributed string labels, and the localization only worked on the Plain ones.
For anyone having a similar issue in the future:
Check if your *.strings file has any non-printed characters.
I used JavaScript for a simple task and didn't realize it included some whitespace characters.
An easy way to check is to put the translation at the top of the file and see if it works. If it does, there might be some whitespace characters. The next steps are... binary search and remove the whitespace characters.

Localization for a very simple app.. How to connect a button?

I have a very simple app which only contains a PickerView, UILocalNotification, UIAlertview and less than 8 views. What I want is:
I have a main view which contains two buttons one says English and the other says French.
What in my mind is:
When the user hits English it'll take him to the Project I have right now,
However, when the User hits French it'll take him to a duplicated views that I'd simply and manually change and translate it's labels into French.
** Now my question is ** how do I translate the PickerView, LocalNotification and the AlertView? and how to connect the French button to these translations?
From what I've googled and read here in SO is that I can get the strings out and list them into Localizable.strings but I still don't know how to make my french button ask for these strings? Also, is there an easier and simpler way? any idea?
Thanks,
Kindly try this for doing localization
http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial
For buttons use something like this
[self.yourButton setTitle:NSLocalizedString(#"YOUR_KEY", #"Comment") forState:UIControlStateNormal];
Do not duplicate your views and view controller just for the sake of localization, considering that for both languages have the same layout and everything only thing that would change is the language. So add English strings and French strings to your project and use NSLocalizedString to get these values.
Note:NSLocalizedString works with device language only so if you want to change the app's language manually try this. I have used AMLocalizedString in many of my projects and they work fine.
Hi as you want to make it localized only at App basis not at device basis hence NSLocalisedString will not work you have to manage it so you have to take two different files and you have to fetch the string value on the basis of selected language. In similar manner as LocalisedString works as in localization there are multiple .strings file created for languages and it works in a way to select default language of the device and shows the text from the localised file.

iOS: Deleting localized string files in an update

I have an application in the App Store with the string files localized. The thing is I want to submit an update with the string files only in english,but when I install the app from xcode(only with the string files in english) in a device that has already the application installed(from the App Store) I can see the strings in other languages than english.
If I install the app in a device without the application already installed I can only see the strings in english,regardless the selected language on the device.
I know one option is to change the name of the string files,but I was wondering if there is a smarter way of doing this.
Thanks a lot
The problem is likely that your old localised.strings file is still hanging around in a different location. When you add or change languages using localisation, the strings file may be moved to a different folder. When the delta update occurs it obtains the new strings file, but fails to delete the old one because it's in a different location. However that location is higher up the search tree, and so gets found first when the app looks for a string.
One potential solution, though not a nice one, is to rename your localized.strings file to something different, then use the localizedStringFromTable command in all places you previously used localizedString, naming your new file as the table of origin. It's not a pretty fix, but it should work.
Another potential solution if you only need one language is to ensure that the strings file is stored in exactly the same bundle location as the one in the previous version.
I solved the problem with this line in the file main.m, right before calling to UIApplicationMain():
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:#"en"] forKey:#"AppleLanguages"];
Basically it forces the app to be available in English only.

Resources