Float: add unlocalized float to string#12086
Conversation
|
I don't think this is the right approach, because it misses things where path are first assigned to a string property or stuff like that. I think the way out is to check if the string contains the decimal separator in there: slint/internal/core/graphics/path.rs Line 307 in 8777f7f and do a string replacement to . if that's the case.
|
Yes this is true but for complex strings you have to iterate over all characters which would make it slow on embedded systems.
|
Reason: Because otherwise the path parser is not able to parse it properly
40c74de to
dd74126
Compare
I don't think we need to be particularly concerned about dynamic path generation on MCU. And on MPU and higher I think that's just fine. |
Reason: This does not work reliable, because if the svg command will be assigned to the path not in the init it will fail. The idea now is add an explicit localization function This reverts commit dd74126.
#Conflicts: # internal/compiler/expression_tree.rs # internal/core/string.rs # tests/cases/translations/decimal_separator.slint
|
(can you please update the PR title and description?) |
ogoffart
left a comment
There was a problem hiding this comment.
Looks good.
Just some notes regarding the documentation:
- The documentation of conversion from float to string could reference this function
- Not sure if we really need to mention it in the documentation of Path. @tronical what's your opinion?
Add possibility to cast a float to a string unlocalized.
This is required for the
Path::commandpropertyThe problem is that Path::command float values must not be casted localized to string because the final svg string shall contain only "." as decimal separator