moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

iOS - in plural files, %lt; escapes to <, causing XML to become invalid

Open sgazzard-meetup opened this issue 2 years ago • 1 comments

On our project, plurals had stopped working. We eventually narrowed down the cause to the fact that in our plurals, we had a plural like so:

<plural name="event_bottom_bar_open_days_before">
        <item quantity="zero">Opens in &lt;one day</item>
        <item quantity="one">Opens in one day</item>
        <item quantity="two">Opens in two days</item>
        <item quantity="other">Opens in %d days</item>
    </plural>

in iOS, this came through as:

<key>event_bottom_bar_open_days_before</key>
		<dict>
			<key>NSStringLocalizedFormatKey</key>
			<string>%#@pluraled@</string>
			<key>pluraled</key>
			<dict>
				<key>NSStringFormatSpecTypeKey</key>
				<string>NSStringPluralRuleType</string>
				<key>NSStringFormatValueTypeKey</key>
				<string>d</string>
				<key>zero</key>
				<string>Opens in <one day</string>
				<key>one</key>
				<string>Opens in one day</string>
				<key>two</key>
				<string>Opens in two days</string>
				<key>other</key>
				<string>Opens in %%d days</string>
			</dict>
		</dict>

as can be seen,the &lt; was replaced with <, so the the XML is invalid as a result. The escaping should revert the < to &lt;

sgazzard-meetup avatar Aug 25 '23 20:08 sgazzard-meetup

Please try to 0.24.0-beta-5 after release

ExNDY avatar May 21 '24 17:05 ExNDY