g-Off/stringray

Support String Dict files with `NSStringVariableWidthRuleType`

kudalies opened this issue · 2 comments

Support .stringdict files with string rule type: NSStringVariableWidthRuleType

See the example below which doesn't load during lint operation.

?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CLAM_CHOWDER</key>
	<dict>
		<key>NSStringVariableWidthRuleType</key>
		<dict>
			<key>1</key>
			<string>Clam Chowder</string>
			<key>25</key>
			<string>New England Clam Chowder</string>
		</dict>
	</dict>
	<key>CHICKEN_NOODLE_SOUP</key>
	<dict>
		<key>NSStringVariableWidthRuleType</key>
		<dict>
			<key>1</key>
			<string>Chicken Noodle</string>
			<key>25</key>
			<string>Chicken Noodle Soup</string>
		</dict>
	</dict>
</dict>
</plist>

After more research on this NSStringVariableWidthRuleType in conjunction with the pluralization string format;
They do not operate together on the same key, NSStringLocalizedFormatKey always takes precedence and will be processed instead of NSStringVariableWidthRuleType if both are present.

Therefore a stringsdictentry can be either a pluralization format string or a variable width string.

Thinking the best solution for this is to provide a model that combines these two types together.
In the meantime, we can maybe just ignore NSStringVariableWidthRuleType entries until we can support both.