Import Localization gives "/* No Localized Strings */"

I am making an iOS library, no UI in it, and when I import a localized XLIFF file I get Localizable.strings for the target language but it has no data, just:


/* No Localized Strings */


The differences sheet during the import shows there are indeed two keys that have been translated. I don't see any error messages, so I don't know what I'm doing wrong.


This is shown in the right panel of the import differences:


unknown

/ Default author */

"Unknown"

"Uunnkknnoowwnn"

untitled

/ Default title */

"Untitled"

"Uunnttiittlleedd"


(I'm faking a translation to Finnish by just doubling letters.)


I'm using XCode 7.2 and Swift.

I'm somewhat confused about what you're trying to accomplish here. If there is no UI

then there are no strings to localize.

I have user-visible strings stored in my data. They are marked and translated like this:


title = NSLocalizedString("untitled", comment: "Default title")

I had exactly the same problem, also on Xcode 7.2! The app has bunch of NSLocalizedString(string, comment) instances and the exported xliff does contain all the strings in NSLocalizedString as expected. At this point my project has no existing Localizable.strings since it hasn't been localized before. Then I translated the xliff to another language, then imported it back to the project. The diffs panel does show all the diffs in translated strings, but after the Xcode import operation, I only got an empty Localizable.strings in target language and no Localizable.strings in development language.


My understanding is Xcode 7 is supposed to replace manuel generation (like genstrings) for Localizable.strings in development language with the Export/Import xliff functionality. However I am not sure how this new approach works for first time localization (thus no Localizable.strings in development language).

Did you find any solution to this problem? I'm having your same exact issue using Xcode 8.1, even testing the whole export/import process in a very basic test project.


Here are the steps to reproduce:

  • Create a new iOS project using the Single View Application template
  • Set the ViewController's title like this:
override func viewDidLoad() {
     super.viewDidLoad()
     title = NSLocalizedString("Hello", comment: "Salutation")
}
  • Add a new localization to the project (I chose Italian)
  • Export the .xliff file for the Italian localization by using the Editor > Export For Localization... command
  • Edit the it.xliff file and translate "Hello" to "Ciao"
  • Import the it.xliff file by using the Editor > Import Localizations... command
  • Xcode adds both Localizable.strings and InfoPlist.strings files to the project (in the it.lproj folder)
  • Open the Localizable.strings and/or InfoPlist.strings file and notice the only thing in there is the following line:
/* No Localized Strings */


As you wrote almost one year ago... I still don't know what I'm doing wrong.

did you find a solution? I have the same issue. Nothing works except German!

Finally I figured out. It was not \n but file location confusion.

When I exported the en.xliff file for translation only Main.Storyboard was localised to Base (under Base.lproj), Localized.strings were in the project's root folder. So the translated xliff files expected a source at the project root. It was fine for the first import (german) but at the same time it "localized" the file and moved it to the Base.lproj folder so the subsequent imports could not find the source file there anymore.

My workaround was to add a copy of the Localized.string file to the root again and remove it in Finder. The file will turn to red (missing) but the import process works fine at the end.

Import Localization gives "/* No Localized Strings */"
 
 
Q