Localization of Bundle Display Name fails in XCode 4 - iphone

I have an app that is localized in two languages. I'm trying to change the bundle display name according to the selected localization.
In many articles on the Internet, this is done localizing the info plist file.
I'm using XCode 4 and it automatically creates a MyProject-Info.plist file containing the bundle display name.
As soon as I try to localize it (even having only the first language added) I cannot build the app anymore, cause the Identifier field in the "Summary -> iOS Application Target" section in the project properties becomes blank (and I cannot edit it).
What happens in the file structure of the project is that the original MyProject-Info.plist files is moved to the en.lproj folder, as well as duplicated into the other *.lproj folders I have (one for each supported language).
Any hint?

1.select "InfoPlist.strings" file
2.Open “File Inspector"
3.add your localization language at Localization Section.
4.Open "InfoPlist.strings(English)" file, add CFBundleDisplayName = "Yours English Application Display Name";
5.Open "InfoPlist.strings(your local language)" file, add CFBundleDisplayName = "Yours Local Application Display Name";

Taking the risk of being redundant, let me just clarify (as I've tested this right now) that the trick is to translate the InfoPlist.strings and never the MyProject-Info.plist.

Related

Switching to Base Internationaliztion

My app is currently localized for English and Japanese, with seperate storyboards for each. I want to switch to base localization so that I only have to maintain a single storyboard. I've checked the "Use Base Internationalization" box in the project's info tab and chosen the English iPhone and iPad storyboards for the base.
I assume I should delete the Japanese iPhone and iPad storyboards I had previously used, but I don't see an option to delete them when right-clicking on their files in the file inspector. Should I delete these old storyboards, and, if so, how?
** Edit **
Changing the 'Main Interface' shown in the screenshot doesn't allow me to delete the Japanese storyboard. It's hard to tell which storyboard to select in the dropdown because its width is more narrow than the storyboard names, but that's a separate issue.
This tutorial drives you through the process step-by-step. This is how it worked for me:
Remove all localizations and leave only the base.
Ensure that the localized files were moved from the project directory (in Finder)
Add the localizations one-by-one
The localized strings are extracted from the storyboard only when the localization is created. The Tutorial above provides a script that can help you keeping the localized files up to date if the storyboard is changed.
In your case, you will have to merge the existing translations into the new files but I suppose it is not a huge deal compared to the gain with using a single file.
For reference, the process is described in this official tutorial too: http://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/chapters/InternationalizeYourApp/InternationalizeYourApp/InternationalizeYourApp.html
After cleaning and reloading, I was able to remove the Japanese storyboards by clicking on the - in the project settings:

AppName doesn't change, after renaming in xcode

I have two apps which are 90% same.So I have used the same code and renamed it in xcode.After that I have installed it in my device.So it is giving the previous appname not the new name.So Kindly tell me.Let me know if you need any more details.
If you are refering to the label inside the app icon in the springboard (the iPhone "desktop") , you will need to open the YourApp-Info.plist (located, usually, in Supporting Files) and change the value for Bundle display name (or CFBundleDisplayName).
go to your Xcode project, select the desired target, click on "Build settings" and look for "Product Name", now enter the new desired name.
To change the name of the app on the iOS home screen, you need to change the CFBundleDisplayName key in your app's Info.plist file.
https://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-110725-TPXREF135
As everyone say, the bundle display name is the name displayed on your device.
You might want to change the bundle identifier too, but it's for corresponding to your provisionning profiles and to be posted on another identifier on the app store.
You might want to rename your Xcode project, I found yesterday a way to do this easily: click on your project name (on left panel), go on the right panel (open it if not) and change the "project name" textfield. it will ask you to rename lot of files automatically.
Finally, have you considered to create a new target, instead of creating a new project ? If the differences are just images and nib file, you can duplicate an app easily, this way.

How to add localized .strings files back to Xcode?

I have a .strings file that is localized in a number of languages. I'd like to add it to my Xcode project. How do you get Xcode to correctly reference the files? I've tried
dragging the english version of the .strings file (found in English.lproj) to Xcode and hoping it would automatically pick up the other localized versions of the file -- it doesn't.
dragging all 5 localized versions of the .strings file (found in English.lproj, es.lproj, etc.) assuming Xcode would create a single file reference with the various localized versions -- it crashes.
dragging each of the .lproj folders to Xcode hoping it would figure out that the file in each of the folders is all the same file, but localized -- nope
dragging the English version of the localized .strings file to Xcode, then add a localization that already exists -- Xcode warns that it will overwrite the file, but doesn't give the option to use the existing file.
UPDATE: Submitted a bug report to Apple: #10181468.
The simplest way as of Xcode 4.6 is to drag localization file (.strings file, not the folder it's located inside of) from Finder to the Xcode project tree. Be accurate and drag to the top of .strings group, not to the bottom or inside of the group as the latter makes Xcode crash.
Add the original file (only the file, not the .lproj folder) then make it localizable, add all languages you want, xcode will create .lproj folders and duplicate your original file for each language.
After you can overwrite each file duplicated by your already translated file (either the file if it have the same name or content).
Don't forget to set the format of the original file to UTF-16 when you add it.

How can I make Info.plist show English names?

I have a project with two Info.plist files (one for each target). In the second Info.plist, when I add a field it shows the internal name instead of the English name. For example UISupportedInterfaceOrientations instead of "Supported Interface Orientations".
Also, when I click on the dropdown list to see all options, some of the options that are available in the first .plist file are not in the second (eg CFBundleIconFiles). The two problems are really the same thing (anything which shows the internal name does not appear in the dropdown).
The Bundle Verion is 1.1 in both files, the CFBundleInfoDictionaryVersion are both the same, as are the plist version and the DTD.
What's stopping the second plist from giving me these options? Thanks.
alt text http://img.skitch.com/20100708-ctia2e6yfwgd7twdnepryidayr.jpg
Xcode has a couple of different editors to show the contents of plist files. One of them is the generic plist editor, which shows the names of the keys without translation. The plist editor can also be in the specialized Info.plist mode, where it knows about the structure of this special type of plist file and translates keys to english.
I don't know how Xcode decides which editor to use, so the following is just guessing: I assume Xcode looks into the selected target to check the path to the Info.plist file and if it is the edited file, uses the specialized editor. So if you have one target selected, but open the other targets Info.plist it might use the generic editor instead.
Xcode also manages file types for each file in the project. You can override Xcode's automatic guesses by opening the file's settings (click on the file in the outline view and press command-I). Maybe there's a file type to identify Info.plist files.
As a last resort, you can always open the file by right clicking it in the outline view. In the context menu from "Open as ..." you can choose how to open it. I usually use "Source Code File" since I like to see the original XML.
Typically, there are times when not all options are shown. If you know it is supposed to exist, you can just add the key (via copy/paste) from the XML file of the other info.plist. I normally just open it up as XML and work in that mode (which gives non-English names).
All keys can be found here: http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html
In the latest XCode, it has been converting everything automatically to English names for me though even when I try to paste as a non-English name in the property list editor.
Short Answer
Select iPhone Info.plist from the View > Property List Type menu.
Explanation
This actually has nothing to do with the plist file itself. It's how Xcode (via the Property List Editor) presents the file.
You can test this by, in Finder, making a copy of a correctly-displaying plist file. Open the copy in the Property List Editor (usually the default application). The copy usually won't display the English names (until you change the Property List Type).
Xcode will remember the type you select and save it in the .xcodeproj file.

iPhone XCode - How to change title below app icon

What is the best way to rename the app so that the title below the app icon can have spaces but the build files doesn't have spaces. (ie, title is "My Project" and build file is MyProject.app)
I changed PRODUCT_NAME but when I do that the app file also contains spaces.
Renaming all the fields seems to work fine except I can't find EXECUTABLE_NAME which is the default value for "Executable file".
Thank you,
Tee
The field that you have to change is the Bundle Display Name (CFBundleDisplayName is the raw key name) in the info.plist file from ${PRODUCT_NAME} to 'your desired name'.
Note: CFBundleDisplayName is different from CFBundleName. CFBundleDisplayName is the human visible/marketing name displayed on the device home screen, under the icon etc. While CFBundleName is the filename of the IPA and the folder for the app on the file system, 'Whatever' for example would be archived as Whatever.ipa and the app would be installed on a device under the folder called Whatever.app.
I'm using Xcode 6 and in the Info.plist, the key is called Bundle Name and the default is $(PRODUCT_NAME). You can double click and change the name, you'll be able to verify it.
If you view the source code for the plist, you'll see:
<key>CFBundleName</key>
<string>Change this to the string to display under the icon</string>
There should really be a caveat here. If you have shell scripts and other things dependent on the original app name, you may be committed to some extensive changes if you pursue the above solution. If you only want to change the display name, and only that, there's a Bundle display name under Info of your target under Custom iOS Target Properties.
You can edit info.plist in Info tab in xCode