Search Issue Tracker
Fixed
Fixed in 1.5.x
Votes
0
Found in [Package]
1.5.4
Issue ID
LOC-1224
Regression
No
Pluralization fails when "Use Custom Formatter" locale differs from current Locale and has different plural rules
Reproduction steps:
1. Open the attached “IN-104953.zip” project
2. Open the “SampleScene”
3. Select “English (en).asset” from the Project Window
4. In the Inspector, enable the “Use Custom Formatter” property
5. From the Hierarchy, select the ‘Canvas > Example’ GameObject
6. In the Inspector, find the “Localize String Event” Component
7. Find the “Local Variables” field
8. Change either or both “Integer” values to 5 (or higher)
9. Disable and re-enable the “Example” GameObject to trigger a refresh of the String
10. Observe the Game view
Expected result: Text is correctly pluralized following the pluralization rules of the current locale
Actual result: Text is rendered as such “The brown fox{foxcount:p:|es} jumps over the lazy dog{dogcount:p:|s}”, following the locale’s custom formatter override
Reproducible with: 1.4.5, 1.5.4 (2022.3.63f1, 6000.0.51f1, 6000.1.8f1, 6000.2.0b5)
Reproducible on: Windows 11
Not reproducible on: no other environment tested
Notes:
- Also reported in discussions: [https://discussions.unity.com/t/pluralization-rules-custom-formatters-issue/1654890|https://discussions.unity.com/t/pluralization-rules-custom-formatters-issue/1654890|smart-link]
- In the example, English is the current locale and text is displayed with "The brown foxes jumps over the lazy dogs"
The amount of "foxes" and "dogs" can be changed in the Inspector of the “Examples” text GameObject. Changing the values will correctly pluralize the amount of foxes and dogs in the sentence
- The issue most likely stems from the "PluralLocalizationFormatter" script, which handles pluralization based on the locale. Here it is incorrectly enforcing Russian pluralization rules, because the formatter override is set to "ru-RU", despite the current locale actually being English. This is because Russian pluralization has three different forms: one, few, and many. In the string, no third option (aka "many") is defined, so it fails (5 being considered "many")
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Memory usage rises when switching scenes with GRD enabled and a loaded texture in URP
- [Quality Hackweek] Terrain Brush Size value is not serialized after deselecting the terrain when using the first instance of multiple Inspectors
- "NullReferenceException" is thrown when setting a long string in TMP with "Atlas Population Mode" set to "Dynamic" and "Multi Atlas Textures" enabled
- TextMeshPro text is misaligned when alignment is set via script
- A DX11 shader error is thrown when compiling shaders for platforms without DX11 support
Add comment