-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix persian characters on chrome and safari #3707
Conversation
There's no comments, text in this PR, or issue links which describe what the current problem is that this is supposed to fix. |
This is for #3491 @miladkdz, Thank you!! I took a quick look and have a few questions...
@mapmeld can you take a quick pass at this and let me know if it seems like a good approach? I'm totally happy to finish up the changes to the code listed above. |
|
Hi @bhousel,
Many thanks for your complete review. |
…le name. User regex to detect arabic characters. Fix editing bugs.
@bhousel |
Is it possible to change the flip to happen in the code where the textPath is being created, rather than changing the name of the object? Here are some issues which I saw in Tunisia (looking for Arabic language and bidi compatibility)
|
Changes I was talking about in the OSM PR
Fixed kaf. |
The only problem now is when the name parameter has both persian/arabic and other latin characters. |
I think I have a PR for @miladkdz which fixes latin + Arabic character issues. Main concerns for me at this point would be:
|
delete changes.deleted[i].tags.real_name; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this change? I don't think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. I will remove them.
@pnorman @bhousel here's my write-up (mostly for non-OSM / non-i18n people) on what this problem is and what this solution is https://gist.github.com/mapmeld/556b09ddec07a2044c76e1ef45f01c60 |
@mapmeld Awesome writeup, thank you! @miladkdz Thanks for the PR! I've been lurking here but I want to jump in and note the overlap in this problem to one we've been working on over in Mapbox GL, and cc @ChrisLoer, who has been working on it over there. In particular, the current proposal to improve Arabic text rendering in Mapbox GL JS uses the same approach here, of replacing normal Arabic code points with the appropriate presentation forms. It does so using ICU, which has a robust algorithm for this, compiled to JavaScript via emscripten. The drawback to this approach is that the compiling the ICU C and C++ code to JavaScript has substantial size overhead. Maybe we could combine forces here and port the relevant ICU code to native and idiomatic JavaScript in a standalone library. That would address the issue of comprehensiveness that @mapmeld brings up, and the size issue that we're facing in GL JS. |
digest combined LTR and RTL words
@mapmeld Thanks a lot for your quick fix. 👍 |
Thanks @mapmeld for the writeup and @miladkdz for the fixes too! In order to move this forward I'll try to merge the code to master later today. Then people try it out in their browser to see if there are any follow-on tasks per #3707 (comment). Sound good? |
@mapmeld @miladkdz This is awesome! I don't have a lot to add but here are some of the things ICU gives us that may or may not be necessary for iD:
|
Thanks again, I just merged this! I've tested on Chrome and I do see the difference. Haven't tested with Safari / Edge / IE11 (will leave it up to those fluent in Arabic to test). We have a mirror of the current master code here that can be used to test the Arabic linestring labels: https://openstreetmap.us/iD/master I did refactor this into 2 functions: This also allowed me to remove the "highway" and "railway" conditionals, because I think the purpose of these was to perform the reversals only on the linestrings. We also label waterways and aeroways with this code, and some highway and railway features may be point or vertex labeled, and we might eventually label other linestrings in the future (like boundaries #2414) so it's better to not hardcode these tags. |
To achieve this purpose, we created a mapping for characters in fix-string.js.
In order to display the names correctly, a temporary tag is created named real_name which is terminated while putting changesets to the server.