User Rating 0.0
Total Usage 0 times
JSON Input
Stringsdict Output
Is this tool helpful?

Your feedback helps us improve.

About

Apple's NSStringPluralRuleType system requires .stringsdict files - verbose XML plists that encode pluralization rules per the Unicode CLDR specification. A single key with six plural categories (zero, one, two, few, many, other) expands to roughly 25 lines of XML. Hand-editing these files invites malformed plist errors that Xcode reports cryptically at runtime, not compile time. Handing raw XML to translators increases the risk of accidentally broken tags and lost work.

This tool accepts a structured JSON input and produces a valid Localizable.stringsdict plist. The JSON format is compact enough for translators to work with directly. The converter validates every key, enforces required other categories, and generates the DTD-compliant XML that Xcode expects. It approximates the output of the jts CLI tool but runs entirely in the browser with no install. Limitation: this tool does not validate that your plural categories match the target locale's CLDR rules - you must verify that independently.

json to stringsdict ios localization xcode stringsdict apple plist converter nsstringpluralruletype ios pluralization stringsdict generator

Formulas

The converter maps a flat JSON object into Apple's nested plist XML. Each top-level JSON key becomes a <dict> entry in the plist. For each key, the tool generates:

JSON key <key>name</key> + <dict>{ NSStringLocalizedFormatKey, variable_dict }</dict>

The format key pattern uses Apple's variable substitution syntax:

NSStringLocalizedFormatKey = %#@varName@

Each variable dictionary follows this structure:

variable_dict = { NSStringFormatSpecTypeKey: NSStringPluralRuleType, NSStringFormatValueTypeKey: specifier, zero?: string, one?: string, two?: string, few?: string, many?: string, other: string }

Where specifier is a C printf format code (default d for integers). The other category is mandatory per Apple documentation. All other categories are optional and language-dependent per Unicode CLDR plural rules.

JSON input schema expected:

{ "key_name": { "variable": "varName", "specifier"?: "d", "one"?: "string", "other": "string", ... } }

Reference Data

CLDR Plural CategoryNSStringFormatSpecTypeKey ValueExample LanguagesTypical Numeric RangeRequired
zeroNSStringPluralRuleTypeArabic, Latvian, Welsh0No
oneNSStringPluralRuleTypeEnglish, German, Spanish, French1No
twoNSStringPluralRuleTypeArabic, Hebrew, Slovenian2No
fewNSStringPluralRuleTypePolish, Czech, Russian, Arabic2 - 4 (varies)No
manyNSStringPluralRuleTypePolish, Russian, Arabic, Welsh5 - 20 (varies)No
otherNSStringPluralRuleTypeAll languages (fallback)Everything elseYes
Plist Structure Elements
NSStringLocalizedFormatKeyFormat string referencing variables, e.g. %#@count@
NSStringFormatSpecTypeKeyAlways NSStringPluralRuleType for plural entries
NSStringFormatValueTypeKeyPrintf format specifier: d (integer), f (float), lu (unsigned long)
Common Format Specifiers
dSigned integer (Int / NSInteger)
uUnsigned integer (UInt)
fFloating point (Double / Float)
luUnsigned long (UInt on 64-bit)
ldSigned long (Int on 64-bit)
.2fFloat with 2 decimal places

Frequently Asked Questions

Apple requires the other category as the fallback for any numeric value not covered by explicit rules. If omitted, Xcode will use an empty string at runtime, which typically displays nothing. This converter flags missing other keys as validation errors and refuses to generate output until corrected.
This depends on Unicode CLDR plural rules. English needs only one and other. Russian needs one, few, many, and other. Arabic uses all six categories. Providing extra categories causes no errors - iOS simply ignores unused ones. Omitting a needed category causes the other fallback to display instead.
Yes. Set the NSStringLocalizedFormatKey to reference multiple variables, e.g. %#@files@ in %#@folders@. Each referenced variable must have its own plural rule dictionary in the same key's dict. In the JSON input for this tool, use an array of variable objects under the key to achieve this.
The specifier is a C printf format code that tells the system how to format the numeric value being substituted. The default d handles signed integers. Use f for floating-point values (e.g. 1.5 items), lu for unsigned long integers, or .2f for two decimal places. Mismatching the specifier with your Swift/ObjC type causes undefined behavior.
Yes. The output begins with the standard <?xml version="1.0" encoding="UTF-8"?> declaration followed by the Apple DTD: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...>. This matches the exact format Xcode generates when creating stringsdict files through the GUI.
Use positional specifiers in your format strings: %1$#@count@ instead of %#@count@. The 1$ prefix locks the argument position regardless of string reordering. This tool preserves positional specifiers in your JSON values and passes them through to the plist unchanged.