LengthFormatter uses inconsistent unit strings for meters in Hebrew

Originator:mxn
Number:rdar://38028709 Date Originated:01-Mar-2018
Status:Open Resolved:
Product:iOS + SDK Product Version:
Classification:Other Bug Reproducible:Always
 
Area:
Foundation

Summary:

When the system locale is set to he-IL (Hebrew, Israel), -[LengthFormatter stringFromMeters:] uses a different word to represent “meters” than what either -[LengthFormatter unitStringFromValue:unit:] or -[LengthFormatter unitStringFromValue:usedUnit:] returns. This is problematic, because -[LengthFormatter unitStringFromValue:unit:] is often used to find and format the unit differently than the rest of the length string in an attributed string.

Steps to Reproduce:

1. Set the system locale to Hebrew and the system region to a country that uses the metric system, such as Israel.
1. Call -[LengthFormatter stringFromMeters:] and -[LengthFormatter unitStringFromValue:unit:].

	let formatter = LengthFormatter()
	formatter.unitStyle = .medium // or .short
	print(formatter.string(fromMeters: 5))
	print(formatter.unitString(fromValue: 5, unit: .meter))
	print(formatter.unitString(fromMeters: 5, usedUnit: nil))

Expected Results:

5 מ׳
מ׳
מ׳

Actual Results:

5 מ׳
מטר
מטר

Notes:

Reproduces when the unit style is either short or medium, but not when the unit style is long. Reproduces when using meters but not when using feet.

Version/Build:

iOS 11.2 simulator
Simulator 10.0 (SimulatorApp-835.5 CoreSimulator-494.33)

Configuration:

System language: Hebrew
System region: Israel

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!