Skip to content
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

RTL punctuation in JSON #5340

Closed
maggie44 opened this issue Feb 5, 2021 · 8 comments
Closed

RTL punctuation in JSON #5340

maggie44 opened this issue Feb 5, 2021 · 8 comments
Labels
question This is more a question for the support than an issue.

Comments

@maggie44
Copy link

maggie44 commented Feb 5, 2021

I have an Arabic JSON file which has punctuation such as periods at the end of the sentence (which is the left): https://github.com/LearnersBlock/learners-block/blob/master/frontend/apps/file-manager/src/i18n/ar.json

Yet in Weblate it reads it the file and puts the punctuation on the far right, and reporting it as incorrect and missing a period (because it isn't on the left) (https://hosted.weblate.org/translate/learners-block/file-manager/ar/?q=state%3A%3E%3Dtranslated&offset=2).

I already tried removing the file, adding it back in, and doing a reset under the 'Maintenance' menu.

Is this a JSON thing, Github or Weblate?

@nijel nijel added the question This is more a question for the support than an issue. label Feb 5, 2021
@nijel
Copy link
Member

nijel commented Feb 5, 2021

To me, it looks that the strings are wrong in the JSON file - the period is really an initial character there, while it should be the last one.

Why it looks differently is because the RTL rendering is tricky and depends on context.

In Weblate editor the textarea for RTL languages is marked as RTL, and it renders the whole string as RTL.

When looking at the JSON file on GitHub, the string is LTR and the browser automatically switches to RTL upon first char. That's why the period seems to be in the correct position - it is rendered LTR and the rest of the text RTL.

You can see it yourself if you try to select the text char by char - it will behave correctly in Weblate, but the selection behaves weird on GitHub because of mixed text direction:

image

That confirms that the period is still rendered LTR and rest of the string RTL.

@github-actions
Copy link

github-actions bot commented Feb 5, 2021

This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but purchasing the support subscription is not only more responsible and faster for your business but also makes Weblate stronger. In case your question is already answered, making a donation is the right way to say thank you!

@maggie44
Copy link
Author

maggie44 commented Feb 6, 2021

Thanks for the info. Very confusing using RTL across the platforms. At the end of the day when processing the Json file in an app should I stick with how Weblate generates it or as it is? Note that when Weblate generates, it appears to have the same issue just the other way around: LearnersBlock/learners-block@a865e42#diff-c784c56faa9d7f71ca3db6fe9a64c914471b40593d0ce0d6f1a16e85cc64b56a

@nijel
Copy link
Member

nijel commented Feb 6, 2021

Just don't look at the JSON file as whole - it is mixed RTL/LTR content and won't display properly. I have no clue how the app handles this in the end, and that's probably what you should check instead.

@maggie44
Copy link
Author

maggie44 commented Feb 6, 2021

Just don't look at the JSON file as whole - it is mixed RTL/LTR content and won't display properly. I have no clue how the app handles this in the end, and that's probably what you should check instead.

Thanks for the info. I tested in within the app, and unsurprisingly it displays the string as it appears in the JSON (i.e. with the punctuation not he wrong end).

I'm struggling to see how this isn't Weblate related. If you export the files directly from the Weblate interface to either CSV, JSON, or anything else (i.e. taking out the GitHub dimension), the punctuation still appears on the wrong side.

@nijel
Copy link
Member

nijel commented Feb 6, 2021

In that case, most likely the app doesn't correctly set text direction for RTL languages. I have no clue how big deal is that as my knowledge of RTL languages is purely theoretical.

@maggie44
Copy link
Author

maggie44 commented Feb 6, 2021

In that case, most likely the app doesn't correctly set text direction for RTL languages. I have no clue how big deal is that as my knowledge of RTL languages is purely theoretical.

So it seems, although I was unsure how it was going to identify what went where. Top tip for anyone coming across the issue, open the JSON file in Firefox, it seems to render RTL JSON properly and now I can see it as expected.

Thanks for your input.

@maggie44 maggie44 closed this as completed Feb 6, 2021
@github-actions
Copy link

github-actions bot commented Feb 6, 2021

The issue you have reported is resolved now. If you don’t feel it’s right, please follow it’s labels to get a clue and take further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is more a question for the support than an issue.
Projects
None yet
Development

No branches or pull requests

2 participants