Localization in Xcode, Base and Language string files - xcode

I am having a lot of trouble getting any localization done in my app. I am trying to follow this tutorial http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014. When I add a language to my project and it asks me which files to localize it only gives me the option to choose the LaunchScreen.xib, no option for the StoryBoard. Is this normal?
I am also confused about the Localizable.strings file. I created one and then clicked localize on it. I want to translate my app from English into traditional. I have the option of choosing "Base" "English" and "Chinese" for the strings file. What is the difference between Base and English? Which one do I need? Do I just need "Chinese", paste the strings and write the translations in that? It's all very confusing ......
Edit:
step by step: First I add the Chinese Language:
No option for the storyboard here. I want to extract the strings from the storyboard so I can add the Chinese translations. Next I click on the storyboard and click localize. I then choose Chinese:
This is what the storyboard looks like in the inspector now
:
Chinese is selected but there are no other files under the storyboard, no string files. It doesn't expand or anything. :
For some reason it has added some files for the launch screen though...What am I doing wrong?

The reason your storyboard did not show up in the "Add Language" dialog and your xib file did was that the former was not yet marked for localization and the latter was. Had you first gone to your storyboard and clicked "Localize..." and selected "Base" for language, and then gone and added Chinese to the project, both files would have shown up in the list.
Which brings us to the second issue. The dialog message is ambiguous, but it is really asking you to select what language you want this storyboard file to correspond to (since you can have per-language .storyboard files). Given that this was your original storyboard, the right choice would have been "Base".

Related

Can I make Visual Studio automatically show corresponding header or implementation file in vertical split?

I'm new to Visual Studio, but have used several other IDE's over the years. I'm stunned by the poor out-of-the-box management of files, filters and "presentation" of coding, and now trying to find if there's a way to customize it the way I've found to be optimal for me.
First off, when programming C++, I'd like for the IDE to use a vertically split automatic view. Dragging and dropping a view to the right side giving me a "static" split is no problem, but that file will stay there untouched until I open another file while in this active view.
What I want is to make it so that when I click a .cpp-file in the explorer, it will show up in the left view - and its corresponding header-file will show in the right view. Likewise, when clicking a header-file, I'd want it to be presented in the right view and the corresponding .cpp-file to show in the left view. If either doesn't exist, just show a blank screen on its side.
When ctrl-clicking a class name, I'd want both the cpp and header-file to be presented, cpp on left and header on right.
Is this not possible?
The second thing that grinds my gears is the solution explorer. I simply don't understand the value of the filter system. I surely do not want every single .cpp file lined up alphabetically under each other, and every single header-file alphabetically another place. I want the explorer to replicate the folder structure as-is. And let me create a file in "src/my_folder/" by right-clicking "my_folder" and add->new item.
I've found that I can click "Switch views" and select "Folder view", but doing this seems to also invalidate the "Solution" and any configurations etc. The solution is literally gone, and the Build/Run-command switches to "Current document" and is completely detached from the project itself.
The closest option I've found is to be in "Solution view" and select "Show all files". The problem is that this shows literally all files and folders, including "output-folders", "hidden" and completely irrelevant files and folders that I don't want here. And I'm naturally not able to "hide" these files, as this is an option to "show all files".
Xcode on Mac has both of these features (and more snacks) pretty flawlessly implemented, and is my all-time favorite IDE per now.
Is there any way to replicate these features in Visual Studio?

How can I turn off Finder's icon preview for my app's document type?

I have managed to do the proper dance and get a custom UTI set up for my OS X app's document type, with a custom file extension and so forth. I set up an icon for my file type as well, and that is also working. I know this because when I save a new file from my app, I can see it appear in the Finder with the correct icon. BUT – about a second later, the Finder replaces my icon with one of its generic "preview" icons, showing the text contents of my file inside the icon, with my file extension, capitalized, at the bottom of the preview icon, like this:
I think this is happening because I declare my custom UTI as having MIME type text/plain and conforming to public.utf8-plain-text. I do want to do that, because they are in fact text files, and I want to allow the user to treat them as such, other apps to recognize them as such, etc. But given this, the Finder (perhaps through some QuickLook generator or something) therefore says "aha, it's a text file, I know how to make custom preview icons for text files!" and replaces my custom icon. Which, needless to say, is not what I want. How can I prevent this from happening? I'm using Objective-C in my project, but I don't think this is a language-specific issue; it all has to do with the UTI declarations in my app's plist.
Speaking of which, here's a screenshot of the way my UTI is configured in Xcode:
And here's a screenshot of the UTI export in Xcode:
It is fine that the icon previews there show as question marks; that is because the icon images are included in my project as a .iconset folder that is turned into the requisite .icns file by Xcode at build time, and Xcode isn't smart enough to show the right preview. But as I said above, the correct icon does display for a second in the Finder, before it gets replaced by the preview icon, so the setup of the icon .icns file and the binding of the .icns to the UTI is clearly working. Along the same lines, if I do a "Get Info" on my file in the Finder, by the way, it shows the correct icon there in the upper left of the information window. The correct icon is also shown in the title bar of the window in my app. It is just in the Finder's display that the wrong icon is used. Any ideas?
Upon further experimentation, the best solution I've been able to find so far involves changing the "conforms to" field from public.utf8-plain-text to simply public.text. The public.text UTI is for text of any kind – any encoding, with or without markup, etc. Any more specific conforms-to UTI seems to lead to the Finder (or whoever it is) replacing my icon. But with public.text the icon is not replaced, presumably because whoever is doing this feels like they don't have enough information to proceed, since public.text is so generic.
This is really non-optimal, since it means that the encoding used for my files is not stated publicly in my UTI export info, making it less likely that other apps will be able to open my app's files as text. If anybody else has a better solution, I'd be happy to vote for it in preference to this answer. But for posterity, I've put this answer up since it might help someone else in a similar boat.

Xcode 6 - Main.storyboard only showing up as source code, Interface Builder missing

Somehow my Xcode settings got messed up as it would only show my Main.storyboard file as XML code. I've been told this can be fixed by selecting the Interface Builder from the "Open As" menu, but there is nothing under the menu (the only "selection" is a greyed-out "<None>"). I've cleared my Xcode caches, but this does not help. Other than that, my project still compiles properly.
How can this be resolved?
As so many people have pointed out, right-click on the file and hover over Open As and select Default - Interface Builder.
However, if this is not an option for you because Open As shows <None>, make sure you are in the standard editor and not the version editor. Go up to View in Xcode menu --> view --> hover over Standard Editor and select Show Standard Editor. Now repeat the steps others have suggested and you should get the results you're looking for.
Hide Code Review helped here (Xcode 12.2).
You might be in code review mode and Xcode thinks you want to compare the XMLs
change to Standard Editor by clicking 'Command + Enter' key . Then Main.storyboard may show as Interface Builder.
I had the same issue, where "Open As" wasn't an option on the main storyboard, and xibs were also showing as XML.
The solution that worked for me was to right click on an xib which did have the "Open as --> Interface Builder" option. Then, I went back to storyboard, and the main storyboard showed up properly.
Tap on the Arrows icon that are left and right, see image below:
If you go over to the project outline and control click on the storyboard file and hold down the cursor, you will see the option to open as, this will let you open the storyboard as a certain type. Click on that and choose open as story board. Good luck!
EDIT#1
Sorry, I think I misread your post. I thought you were doing those steps from the menu bar. Not the outline. I am assuming you have restarted Xcode and your computer.
I had this issue with Xcode 8, no luck with Open As > menu... and the solution was as follow:
Make sure the Type is Default - Interface Builder in the Identity and Type right panel (see screenshot). In my case it was "Swift source code" selected :
Now, in the left pane, right-click on your storyboard, and magically then the option Open As > Interface Builder - Storyboard appeared !
I had "Main.storyboard.xml" in Xcode 9 folder but can not see "Default - Interface Builder" in the list of extensions proposed in "Identity and type".
I simply deleted the .xml extension in the name of "Identity and type" and then I can see again "Default - Interface Builder" in Open as.
This is just a quick fix/ long shot, and depending on the specifics of your situation it might not be helpful at all, but you can import and open storyboard files in other projects.
So, try importing your storyboard file in a new project and see if it displayed correctly there.
Has helped me in the past with misbehaving nib files.
Took some doing but I found how to fix this every time... When you click on the storyboard and it is showing as source, click on the icon that shows the utilities view on the righthand side.. Look for the identity type.. Type should be Default - Interface Builder.. Mine got switch to C Source Code.. Not sure how.. but...
I was stuck at (Hide Code Review helped here . You might be in code review mode and Xcode thinks you want to compare the XMLs)
left and right arrow icons is code review Mode

How to translate Xcode 3 properties to Xcode 4

I am currently watching the video tutorials series by TheNewBoston concerning iPhone development. Unfortunately, he uses Xcode 3 in his tuts so when showing the viewers what exactly should be done to complete certain steps, it is quite difficult to follow along. Here's what I've found that isn't parallel, some of which I am figuring out as I go along, but some is still ambiguous and would be great to be clarified on the site:
Resources is supposed to be the same as 4's 'Supporting Files' folder, however doesn't contain the ViewController files I'm looking for that he demonstrates on. (How do I get to the View display?)
There's no 'tools' top menu bar option
Under this I should be able to find the option item 'Library' which contains 'Attributes' (Where are all of these components located?) - (Actually as I'm going along I'm finding some of these, but for the sake of the site's Q&A style I'll pose the question regardless.)
"Build and Run" button on home toolbar is the same as the "Run" button in 4?
I clicked the Run button and it built, but I have a big white box rectangle after I was told to put the "Bacon" label on the View Controller (which I ended up finding) - what's up with that?
When trying to add an icon to the plist file, the option to do so on the chart is not featured - where is it?
Bucky chooses a View Based Application setting when creating a new project. This is not an option in Xcode 4. What is its closest relative?
What Bucky shows is actually not under the Supporting Files folder, just under the project folder. It will not have the ".xib" ending, but rather a ".storyboard" ending.
True. Sorry.
The Library you are looking for is in the bottom right hand corner of the window. It is one of the tabs that is currently displaying the "File Template Library". Two tabs down is the object library you're looking for.
Yes.
Likely, you were creating display components under the iPhone storyboard, and the option bar just a couple buttons right of the Run button will give you the option to display the iPhone simulator. It is possibly set to the iPad display at the moment.
You must create the property. Click on one of the properties and a (+) sign will display when the item is highlighted. Click it and a new property value will come up to be defined and type in "Icon File." Ergo, you are ready to follow further into the video tut.
Although I am not certain I believe it is known as the "Single View Application" option. It seems to me that they have the same properties.

Xcode Line Wrapping setting doesn't work

I'm trying to disable line wrap in Xcode 4.3.2 (4E2002), but the setting doesn't seem to work. I seriously HATE line wrapping and it makes me super-unproductive. I've always had it turned off before, but since the latest XCode-update, it is enabled regardless of setting.
Is this an Xcode bug?
This is my settings dialog:
This comes by some files you have set Wrap line in Show the File inspector.
Please choose a file. View -> Utilities -> Show File inspector then deselect Wrap lines in Text Settings section.
I had >ONE< file out of two dozen that was wrapping it's text in the XCode editor. Although I don't know how/why the file got into this state, I figured out what it was and how to fix it.
If you show the XCode right-hand Utilities pane, and select the Document icon at the top left, you'll see a variety of settings relevant to that one file, including it's name, type, and location. Below that are some "Text Settings" values, including a checkbox for "Wrap lines". If that box is checked, it overrides the XCode preference and wraps the lines.
This picture shows the XCode editor areas, in case you are confused: XCode Editor Areas

Resources