Xcode Base Internationalization with no Main.storyboard - xcode

I'm trying to follow the tips in Apple's I18N and L10N Guide. I have a pre-existing project from which I have (long ago) deleted the Base.lproj folder. Why? Because I have no Main.storyboard or LaunchScreen.xib. Both of those things are handled programmatically.
However I do have a large number of subsidiary storyboards, including a WatchKit Interface.storyboard. When I click the + in the Project (not target) Localizations section, Xcode presents a dialog that lists only the Interface.storyboard file. Not any of the many others.
How can I persuade Xcode to help me localize the other storyboards? Can I do this all manually? As usual, I am sure it is my mental model that needs refinement.

This is an example where configuration yields convention. That is, if you customize your folder hierarchy, Xcode can adapt and implement its naming conventions.
Select storyboard file in left pane (Project navigator)
Click Doc icon (File inspector) in right pane
Click Localize...
This will create a new Base.proj folder inside whatever folder holds the storyboard. If you are like me, you have done lots of folder-factoring. Xcode goes along with this.
Then you go back to the Project Localizations section and click + to add locales. Xcode creates extracts the strings from your storyboard and creates new folders for the corresponding .strings files.

Related

How do I embed projects using Xcode 10?

I've been searching the internet for hours trying to figure this out. In previous versions of Xcode, I could drag a .xcodeproj file onto my workspace, and the groups, etc. of that project would be in the main one. That is, its sources and products would be accessible in the parent project. I mean to do this for a new private framework of mine, but it seems that in Xcode 10.2.1, this behavior is changed.
When I follow the instructions found in Apple's archived documentation (all that seems to survive), the .xcodeproj file sits alone in my file inspector. No reference hierarchy, and nothing happens when I click on it. On top of that, that project's frameworks are not accessible to the parent project.
Has anyone here figured out how this changed in Xcode 10, and what we are to do about it now? Many thanks!
This certainly feels like a workaround, but it does seem to work:
Open one of the projects you want to be in the final workspace
From the "File" menu choose "Save As Workspace…" and save it somewhere on disk
This will create a new workspace that looks identical to the Xcode project you originally opened.
From the "File" menu choose "Add files to “WorkspaceName“…" and select the next project you want in the workspace
At this point it will probably put the newly added project "inside" of the existing one in the file navigator pane. Simply drag it out to the top level and it will be on the same level as the original project. You should be able to twirl open the disclosure triangle and see the source files it contains. Clicking on the project will show the targets it contains.
Repeat as necessary for the remaining Xcode projects
As you add projects, the schemes from each project will show up in the popup menu under the scheme button in the toolbar.

iOS - Using Base localization pane is always empty

In Xcode have added two localizations, German and English. I am following documentation on Apple regarding "Use Base Internationalization" which is obtained by going to the project, clicking Info and pressing on the checkbox.
If I do this, it launches a pane or page which is empty.
IE:
How do I get it to be populated, or otherwise be in a situation to select the relevant resource file?
The answer is to localize your storyboards. Go to storyboard, there is a button called localize. If you do this, the pane is no longer empty.
Check the answer from hassan83 (https://stackoverflow.com/users/1586924/hasan83) in another question. It solved my problems.
https://stackoverflow.com/a/27720065/7017099
"This could happen if Base Internationalization was active before then disabled and files deleted manually.
Create Base.lproj folder in your project folder using the finder.
Move your main story board to it also using the finder.
Fix the reference to it from Xcode.
Remove app from device, clean & build
your project.
All will be back to normal."

My localizations are not taken into account

I'm trying to localize an existing application. Here is a simple thing that I can't make work:
I have added the needed languages into localizations from the project info tab
Activated the l10n for one of my storyboards
Adapted the strings into the newly created .strings files
Cleaned the app
Removed the app from the simulator
Relaunched the app in the simulator
Changed the language in the simulator
No effect...
I am used to i18n in other languages & frameworks and I have to say I never saw it as complicated & unintuitive as in Xcode.
Could someone help me with that ? Am I forgetting something here ?
Here is how I fixed it:
Disable localizations for each resource
Make sure to have Use Base internationalization checked from the project's Info tab
Move all resources that needed localizations somewhere specific (From Finder)
Reattach the references from Xcode (with the right Utilities panel location folder button)
Activate localizations for each resource selecting Base as base
The last step moves each file into Base.lproj and creates a strings files into each selected {lang}.lproj.
For future files to localize, don't put them into Base.lproj yourself, otherwise Xcode will create another Base.lproj subfolder to move the file into.
I think that Xcode organizing files into his own "groups" (almost) totally disconnected from the real folder hierarchy is the thing that constantly confuses me (not even talking about git). I don't really understand the advantage of having this detached hierarchy.

How to add localization language to Xcode 4.4?

In reference to this guide:
How to localize my app with Xcode 4?
I noticed that under Localization, my Xcode 4.4 shows no [+] button:
How can I add languages to the Localization list?
Note: I'm not using IB. I purely need a localized strings file with translated strings for a game.
My workaround so far: I created the de.lproj folders manually, copied the strings file into de.lproj, added it to Xcode and Xcode did recognize the file as german. Xcode also added German to the Localization list. I'm wondering if there is an easier way to do this (from within Xcode) instead of copying & adding the files manually?
Select your project from the project navigator to open the project editor. Select your project from the left side of the project editor. Click the Info button at the top of the editor. You should see a list of localizations along with a button to add a localization. Click the Add button and choose a language. A sheet will open that lets you choose what files to localize.

xcode doesn't recognize localization in Info.plist

I am using Xcode 4.4.
As you may all know, there is an easy option to localize resource files in Xcode. You can also internationalize your plist Files, which is my approach.
But since 4.4 it doesn't seem to work properly anymore.
All you have to do is the following:
In <project>-Info.plist file add key "Localization" which adds a subarray where you add your country codes as items
now you can localize you resource file (like Localizable.strings) i.e. like so: followed by a modal screen where you're able to choose the languages defined in plist file
Enter! The resource file now lives in <country identifier>.lproj folder.
In Xcode 4.4 you cannot choose your language, defined in plist file. Only English.
I tried everything. Don't want to localize manually.
Also in Xcode versions below 4.4 it was possible to add new languages with a '+'-button. It is not possible:
Look at this:
Any suggestions. Or do I do it just the wrong way?
Here is how you localize your recources in Xcode 4.4+ :
Click on your project (navigator)
On 'Info' tab under your project you'll see the 'Localizations' section
Click on + to add a language
Choose the files you want to localize in the sheet that will be displayed
Now Xcode will automatically create and put your files under the respective language folders.
Finally if you want to localize other sources (such as image files), click on your file, bring the file inspector pane and click 'Make Localized...' button under 'Localization' section. Xcode will fire up another sheet with the available languages, choose the language and you're ready. I hope that this makes sense.
The question is, too, how to localize multiple Info.plist files for multiple targets.
This is done very easily. Just add the languages you want your localization in to the projectile, as described above.
Then you click your several Info.plist Files, each for each target.
Open up the Utilities sidebar
Click "Make localized"
Then choose between the in the project-file setup languages and you're done.

Resources