material-components-android
material-components-android copied to clipboard
[CollapsingToolbarLayout] End punctuation marks in LTR text are incorrectly positioned in RTL mode
Description:
- "Force RTL layout direction" -> ON
- Open "TopAppBarCollapsingMultilineDemoFragment" demo (Material Catalog app)
- Pay attention to the full stop position.
Expected behavior: The full stop should be at the end of the sentence.
Actual behavior: The full stop is at the beginning of the third line:

Material Library version: 1.7.0-alpha03 Device: Pixel 4a 5G (API 32)
Hi @pubiqq, I think the Force RTL layout direction developer option should only be used to test out the alignment of Views within their parent ViewGroups, as opposed to content within Views. This is because Force RTL layout direction doesn't actually change the locale / internationalization, as opposed to using string translations and changing the device language, which is a more valid test.
Closing this for now but feel free to provide any more information.
Well… okay, here's a more "valid" test (Device language: Persian (Iran)):

That's still not a valid setup because the strings in the catalog are not translated.
So that's the point, I want the LTR text to be displayed correctly in RTL environment. Like, if I have a store called "Yummy!", I don't want its name to turn into "!Yummy" for RTL locale.
Gotcha, so you found a way to do that without breaking the overall alignment?
Maybe. I don't know what the original problem was, so it's hard to say (description of 841f229 didn't clarify anything to me).
It's basically the following, for short LTR text with an RTL device config, we want the alignment to be on the right:
Before https://github.com/material-components/material-components-android/commit/841f2295921b4eed8bd16bb72b28d4ef7ca7cfa5 | After https://github.com/material-components/material-components-android/commit/841f2295921b4eed8bd16bb72b28d4ef7ca7cfa5 |
---|---|
![]() |
![]() |
Can you test that case with your latest changes, and also update your PR to have Before vs After screenshots of the Collapsing Toolbar demos?
Sorry can you also post an After video with the device language set to an RTL language? (not just Force RTL)