mcfroob
mcfroob

Reputation: 1154

No <target> in XLIFF file exported from Xcode

When I export my XLIFF file from Xcode, none of the strings I declared with NSLocalizedString have a < target> element. The strings generated from my storyboard do have a < target> element. Has anyone seen this before? Google reveals nothing.

String:

let oops = NSLocalizedString("Oops!", comment: "Alert box header")

Resulting XLIFF:

  <trans-unit id="Oops!">
    <source>Oops!</source>
    <note>Alert box header</note>
  </trans-unit>

Upvotes: 1

Views: 532

Answers (2)

MatterGoal
MatterGoal

Reputation: 16430

The are a lot of useful tools that you can use to automatically write the target. Check on the App Store looking for xliff... some of these tools are also free.

As example, XLiffy seems to be easy enough to use.

Upvotes: 0

Chase T
Chase T

Reputation: 116

I don't know specifically about XCode's behavior, but <target> is optional, so this is legal (although possibly inconvenient) XLIFF. (source: xliff 1.2)

You should be able to create add a <target> element during translation without problem, and most translation environments that support XLIFF should be able to do this as well.

Upvotes: 2

Related Questions