Xcode doesn't export strings from xibs for localization - xcode

I'm trying to follow Apple's localization guide with my project, but after I select Editor -> Export for Localization, the resulting .xliff file doesn't contain any strings from .xib files.
It has only strings from Localizable.strings and from Info.plist.

I did it!
Turns out, it was a project created in old Xcode version that doesn't support Base Internationalization.
I had to
Press “Localize” on all the xibs in the project
Then go to Project Settings and in the Info tab check “Use Base Internationalization” checkmark.
After this, the resulting .xliff file has all the .xib strings.

Related

SwitUI iOS localization language is not changing

I localized my app in Xcode 13.2.1 into two languages as shown on picture below - EN texts are hardcoded, CZ texts are in Localizable file (imported from xcloc file).
App is constantly appearing in CZ in Simulator even if I set EN language in Run scheme. The only way I found so far to change appearence to EN is to remove CZ localization from the app at all. Any hint, please? Thanks.
Here's how I was able to fix it:
Select the Localizable.strings file in the project navigator.
In the File Inspector, you'll see "English" being unchecked, you need to mark it checked.
By default, Xcode will copy an existing non-English localization for English, so we need to replace it with the original English translation. Luckily, it's possible to just extract it from the .xloc package.
Select menu Product - Export Localizations, make sure English is checked and run the export.
Open the directory of export in Finder, locate the en.xloc file. Right click on it and choose "Show package contents".
Inside the package, go to Source Contents/%TargetName%/en.lproj.
Inside, you'll see the Localizable.strings file. Copy it into your project, replacing the file that Xcode generated previously.
Rebuild the app.
After doing all that, English localization should be back.

Adding localizable strings on xcode 10.1

I have a swift app where I now want to add translations for some of the strings used in the app using NSLocalizedString.
In order to do this, I added a file named Localizable.strings to the project and pressed the "localize" button in the file inspector in order to add multiple languages to it. However only english appeared in the localization list, and I seem to be unable to add more.
Having looked around at SO and just googling around, many of the articles on how to do this mention that I should add more languages to my project under build settings. But the only setting I can change under Localization is one named "Localized String Macro Names", and there is no option to add languages there. There is also no "Use Base Internationalization" marker to check.
I have also tried to click on my project, then Editor -> Add Localization, but there all the languages are greyed out and I am unable to chose any of them.
I therefore suppose that you are supposed to do this differently in the latest version of xcode (10.1 atm). Can anyone help me figure out how you are supposed to do it?
It's about the project settings. Take a look at the image:
Under the Localizations you add new languages. After you add the language here you select which files you want to localize.
// update
Click on the top right button shown in the screen below and select your project under the PROJECT tab.
You just selected the wrong settings. The picture that you attached is actually under TARGET settings -> Build Settings, rather than project settings.
See the picture below to select "project settings" under xcode 10:
Xcode 10, project settings

Xcode Base Internationalization with no Main.storyboard

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.

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