Lokalise: How to change default NSStringFormatValueTypeKey

276 Views Asked by At

The default NSStringFormatValueTypeKey property in Lokalise always returns the string li. In my code, the string d.

When exporting the modified stringsdict file from Lokalise to Github, the NSStringFormatValueTypeKey is always li. Currently, there is no way to change this hardcoded value in the Lokalise platform. What is a trick to change the value besides manually changing them in the stringsdict file in Xcode? I want to change the value to d

Export from Lokalise:

<key>plural.day</key>
<dict>
      <key>NSStringLocalizedFormatKey</key>
      <string>%#@day@</string>
      <key>day</key>
      <dict>
        <key>NSStringFormatSpecTypeKey</key>
        <string>NSStringPluralRuleType</string>
        <key>NSStringFormatValueTypeKey</key>
        <string>li</string>
        <key>one</key>
        <string></string>
        <key>other</key>
        <string></string>
      </dict>
    </dict>

Desired outcome:

<key>plural.day</key>
    <dict>
        <key>NSStringLocalizedFormatKey</key>
        <string>%#@day@</string>
        <key>day</key>
        <dict>
            <key>NSStringFormatValueTypeKey</key>
            <string>d</string>
            <key>NSStringFormatSpecTypeKey</key>
            <string>NSStringPluralRuleType</string>
            <key>one</key>
            <string>%d day ago</string>
            <key>other</key>
            <string>%d days ago</string>
        </dict>
    </dict>
1

There are 1 best solutions below

0
matt On

I want to change the value to d

I'd say: Stop wanting that. li is correct and there's no harm in the change. Basically what's happened is that this is passed into Lokalise's own internal format which simply says "it's an integer" in a totally different way, and is then regenerated, and when that happens, it's expressed as li which is fine.