Ok, this will look almost useable when i chave completely localized the operators:
Post
Replies
Boosts
Views
Activity
ok, this looks a bit better. I now do it only on operations and stuff the result into a HStack:
HStack {
ForEach(elements) { item in
textFromElement(element: item).flipsForRightToLeftLayoutDirection(item.type == .OPERATION)
}
}
}
The result looks a bit nearer to what I want:
Now I have to make a distinction between operators that have to be mirrored (parentheses, arithmetic operatiors...) and operators that show arabic text and hve to stay how they are....
I am not sure if that really is the best solution, but it may produce some acceptable result in the end.
The trouble with .flipsForRightToLeftLayoutDirection at this point is that it returns a View and not a Text, so I can't apply it to operator components in the Text addition operation, if I am not missing anything
Ah well, found something... I had to explicitly add .flipsForRightToLeftLayoutDirection(true) to the "baked" Text at the end. That is
func makeText(stuff) -> Text {
result: Text = Text("") + Text(number) - Text(op) + ... + Text(...)
return result
...
GridRow {
makeText(stuff).font(...).flipsForRightToLeftLayoutDirection(true)
...
and the result looks different. now two consecutive Text items in arabic are put in the wrong order and arabic text and numbers are going the wrong way.
So this is mainly useful for mirroring, with the parentheses and such
when I add a translation for ln, the result for 0.5 [ln] looks correct:
But do I want to add localizations for the arithmetic function symbols? Are there specific arabic rtl versions in unicode for those too? I guess calligraphically it would make sense.
What happened to the images?
first one, english:
second one: arabic:
Here, "π /" is correctly layed out as ""
Solved it. It turns out, WKWebKit not only does not need to be wrapped in a ScrollView, it apparently does not work in a ScrollView, and (more or less) does not work only when wrapped in a ScrollView. I put every other tab in a ScrollView before, so did the same with this one. When I simply add it in a VStack instead, it displays fine.