XLIFF not importing to .stringsdict correctly for some languages?

Hello,


We're using XLIFF for our localization.


After importing XLIFF localization in Xcode 9, the Localizable.stringsdict doesn't contain all plural formats.


E.g., when importing German (de-DE), we have this in our XLIFF file:


      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/NSStringLocalizedFormatKey:dict/:string">
        <source>%#@count@</source>
        <target>%#@count@</target>
      </trans-unit>
      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/count:dict/few:dict/:string">
        <source>clients</source>
        <target>Endgeräte</target>
      </trans-unit>
      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/count:dict/many:dict/:string">
        <source>clients</source>
        <target>Endgeräte</target>
      </trans-unit>
      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/count:dict/one:dict/:string">
        <source>client</source>
        <target>Endgerät</target>
      </trans-unit>
      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/count:dict/other:dict/:string">
        <source>clients</source>
        <target>Endgeräte</target>
      </trans-unit>
      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/count:dict/two:dict/:string">
        <source>clients</source>
        <target>Endgeräte</target>
      </trans-unit>
      <trans-unit id="/COMMON_LABEL_CLIENT_COUNT:dict/count:dict/zero:dict/:string">
        <source>clients</source>
        <target>Endgeräte</target>
      </trans-unit>


There are some extra format values; German uses only "one" and "other" according to http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html.


But, when imported using Xcode 9, all we get is this:


    "COMMON_LABEL_CLIENT_COUNT" =     {
        NSStringLocalizedFormatKey = "%#@count@";
        count =         {
            NSStringFormatSpecTypeKey = NSStringPluralRuleType;
            NSStringFormatValueTypeKey = d;
            zero = "Endger\U00e4te";
        };
    };


The strange thing is that when we for instance import Danish (da) with the exact same format, only different values, we get this:


    "COMMON_LABEL_CLIENT_COUNT" =     {
        NSStringLocalizedFormatKey = "%#@count@";
        count =         {
            NSStringFormatSpecTypeKey = NSStringPluralRuleType;
            NSStringFormatValueTypeKey = d;
            one = klient;
            other = klienter;
            zero = klienter;
        };
    };


Which is pretty much correct (although the "zero" format shouldn't be there). Is this a (known) bug? Or are we doing something wrong?


We have noticed this happens also for Spanish (es-ES) localization (also only "zero" format is imported).

Replies

After importing XLIFF localization in Xcode 9, the Localizable.stringsdict doesn't contain all plural formats.

You should definitely file a bug about this. This sounds like a straightforward bug to me. Alas, this isn’t really my area of expertise, so I don’t have any other input beyond that.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

For me, the XLIFF import for Localizable.stringsdict is totally broken for both French and German. It ends up stripping all the XML headers from the target .stringsdict files, doesn't correctly apply the translated strings, and converts all of the accented characters to escape sequences. It's as if internally the XLIFF importer is treating the .stringsdict file as if its a property list rather than an XML document.


It looks like I'm going to have to apply all of the translations manually, which is quite a pain. Better to just give the .stringsdict file itself to the translators, rather than using the XLIFF until Apple fixes this.

It looks like I'm going to have to apply all of the translations manually, which is quite a pain. Better to just give the .stringsdict file itself to the translators, rather than using the XLIFF until Apple fixes this.

Did you file a bug about this? If so, what’s the number?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I am not the person above, but I have just filed three bugs related to Xliff stringsdict export and import.

nr. 35092463 - Xcode localization import turns stringsdict file into ASCII property list format) - is the same bug as Oranda describes above.

nr. 35092702 - Xcode localisation export doesn't include new stringsdict entries in the exported xliff

nr. 35092348 - Localization export to xliff includes stringsdict plural rules that do not apply to the target language

Unfortunately due to these issues, as of Xcode 9.0.1 (9A1004), the support for import/export of stringsdict entries is pretty much unusable.

Thanks for filing your bugs and posting them numbers here. Looking for similar bugs I’m not sure that any of the other folks on this thread actually filed bugs about their problems, which is a shame )-:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have just encountered a problem simirar to 35092702, except, I am not able to see any strings from Localizable.stringsdict in the resulting XLIFF file after exporting development language.