How to apply localization without Storyboard - ios

I don't use storyboard or xib for this project (full code)
When I add new localization, it shows no file in the list, and when I press Finish, no folder created.

You need a Localizable.strings file. If you already have that, select the file in the left panel. Then, click the button that should be in the right panel that says "Localize..."
Once you do this, you should be able to add other localizations the way you were trying to.

Related

Can we read ios storyboard xml code?

Hi i want to read ios app storyboard xml file and wants to store it in array or any other place. So is it possible to read storyboard xml file.
Yes you can. Just right click on storyboard file and select open as source code. That's it.
open the project navigator on the left, select the Main.storyboard, right click, select open as "source code"

Assistant editor(Xcode 7.3) always showing interface file in storyboard , even when I choose manually

Even after deleting derived data many times, and trying other things, I am still facing this problem. Can you help me?
You can try using the shortcut key instead, to open up the assistant editor.
Shortcut key: -
option + click on the file which you want to open up in the assistant editor
Guys I just stop dealing with this problem by changing the settings in xcode 9.2. And now i use Navigation Pane.
Here is how it works :
Ok now if you go to xcode -> preferences -> navigation
and Choose the "Uses Focused Editor" as in the picture below.
Now you can manually select inside the Navigation Pane.
Just click whichever page you would like to change and select in the Navigation Pane.
Here is a few screenshots :
Pictures shows code files but it works with everything you can click in the Navigation Pane.
Try to drag and drop file from the Project Navigator into the path of the Assistant Editor as temporary fix.
You also can click on this icon to bring recent files.
Try to clean your project, clean Build Folder, restart Xcode.
Make sure the view controller in your Storyboard has correct custom class name.
I think I know the problem you're having. I experience it too, but it's intermittent. Sometimes clicking Manual shows me the entire project folder and I can select the editable classes, but other times it only shows the interface versions of them, which aren't editable and cannot have IBOutlets dragged to them (you can tell b/c it'll say internal class and has less code). I have noticed that if I toggle back and forth between Automatic and Manual, I can usually get the editable class to appear. I also will toggle the assistant editor off, select a different View Controller or two on the storyboard, then go back to my original one, turn the Assistant Editor back on, and it starts working again.
There are other discussions of it here, here, and here. This suggestion of turning off indexing sounds intriguing and worth a try if the problem keeps reappearing. UPDATE: This trick with hitting the + and opening a 2nd file, then closing the interface file, worked great when I tried it just now.
Here are pics of how the Automatic side shows the actual file when the Manual side only shows the interface, which says internal next to class:

How to restore the main.storyboard after deleting the .xcodeproj and adding it back

In my iOS application I deleted the .xcodeproj file to remove it from git control and then I've add the same file few days later.
Now I have a storyboard which is the one from a few days and I have changed a lot on the storyboard. So how can I regenerate the correct storyboard back?
The thing is, that everything works if I start the application except that I can't work with the storyboard in this form.
For example a scene in my storyboard looks like this:
The white views are not displayed
Open your Xcode project
Right click on the folder your want to add your Storyboard file to
Click Add files to "your-project-name"...
Browse to your storyboard and add it

Can't add languages to my app

I'd like to add a 2nd language to my app. If I go to my project und press the + under Localizations I can select a langue but can't go further (no files are displayed). If I click finish the language isn't added.
Maybe you don't have any localizable file ? Or Xcode didn't find them...
Anyway, you can always localize files manually :
Select your file in the left panel
Open the right panel in the "File Inspector" tab (first icon at the top)
Click the "Localize" button
Try again to add a language

How to localize images in iOS if they are set up in a storyboard?

I know how to localize storyboard elements like label, buttons etc. However, I faced a problem where I need to localize the images that were setup in a storyboard in the attribute inspector for the Image View.
Is there a way to localize those without setting those images up in the code, in the viewDidLoad method and calling setImage:[UIImage imageNamed: NSLocalizedString(...)]; ?
Any kind of help is highly appreciated!
I guess I figured it out...maybe not the ideal way of doing it but works for me...
Open image folder in your Project Navigator (panel).
When you click one of the images, on the right (Inspector panel) you'll see the button "Localize".
Clicking on that button gives you a pop-up asking if you want it to be the base (in my case I say yes).
So now in the inspector there're check boxes: Base, language 1, language 2 etc (language n - is the languages you added to your project in the localization settings).
So now if you put a check mark into one of the language check boxes, your image file will have a drop down arrow showing that it has some content inside. If you click that, you'll see how it expands showing the localized files with the name of the language in the () brackets.
However, at this point those files are all the same as the base. So now you need to substitute the base files with the localized ones.
If you right click on the file that needs to be localized, say myImage.png(German), open it in Finder, and replace that file with the right one. Important! The name of the file should stay the same!
I'll post the screenshots later, so it's all clear how to do it.
Using Xcode 9.2
you can achieve it easily like the following
1- From Assets
2- Then you will need to change the Direction option AND CHOOSE BOTH
xcode will allow you to add 3 more image for other language resource
3- add your needed image and use it in story board or from code as well

Resources