chubin / wttr.in

:partly_sunny: The right way to check the weather
https://wttr.in
Apache License 2.0
24.69k stars 1.11k forks source link

Arabic translation #430

Open chubin opened 4 years ago

chubin commented 4 years ago

Current translation is available at:

https://ar.wttr.in

To do:

chubin commented 4 years ago

The initial support was added; @akai54 is working on lib/translations.py at the moment

chubin commented 4 years ago

That is how it looks like in browser:

Screenshot_2020-04-14_20-36-29

That is how it looks like in terminal:

Screenshot_2020-04-14_20-36-03

I think that in browser the RTL-script is broken

akai54 commented 4 years ago

My terminal : Screenshot 2020-04-14 22:06:01

the browser : Screenshot 2020-04-14 22:08:05

chubin commented 4 years ago

Do I understand it right, that it is correct in three cases of four?

Correct:

Incorrect:

akai54 commented 4 years ago

Exactly

chubin commented 4 years ago

What terminal do you use? Have you configured it in some special way?

akai54 commented 4 years ago

I use tilix and no actually i just changed the themes that's all nothing special.

akai54 commented 4 years ago

Try to put your locales to utf8 usually that works in text documents sudo dpkg-reconfigure locales

chubin commented 4 years ago

Now I see that it depends on the terminal, and its support of bidirectional texts:

A couple of additional examples:

vte-based terminal + bidi:

Screenshot_2020-04-16_11-24-37

mlterm:

Screenshot_2020-04-16_11-25-00

akai54 commented 4 years ago

let's avoid the hustle and bustle, how about telling the people who wants to use the Arabic version that they should use this or that terminal to get the best results.

chubin commented 4 years ago

I think that they will not change the terminal they are get used to just because of wttr.in. Also, it is a good opportunity to make good implementation of Arabic for all potential web service for the terminal, because all of them will have the same problem

egmontkob commented 4 years ago

BiDi in terminals is a truly hairy story.

Some don't do any BiDi at all.

Some others automatically shuffle the cells based on the BiDi algorithm (note that these two kinds are already incompatible, you can't get the same result in these two); correctly realizing that such a behavior is inevitable for certain apps; however, not realizing that in the mean time it's hopelessly, unfixably broken by design for certains other apps. By the way, the implementations in all such BiDi-shuffling terminals suffer from plenty of other BiDi-related bugs.

Some terminals even allow the user to choose in the preferences: enable or disable BiDi, as if it was anywhere near an acceptable user experience to have to fiddle with the terminal's settings.

I tried to clean this up by studying the situation and coming up with the proposal at https://terminal-wg.pages.freedesktop.org/bidi/ . According to this, terminals should do BiDi by default, but this can be disabled upon an app's request via escape sequences (there are other mode switches too, available for applications to pick whichever suits them the most). This spec is implemented in VTE 0.58 and in Mintty. That is, in Tilix (if used with VTE >= 0.58) and similar terminals, it's you (the author of wttr.in) who gets to choose whether you want the terminal to shuffle around the characters or not, tell it to the terminal, and format the data accordingly.

chubin commented 3 years ago

I moved the rendering subtasks to #676, and so this issue is only about translation now, and problably it can be closed because Arabic translation is done.

@egmontkob I think that the best approach here would be to distinguish between three types of media:

  1. terminal (text);
  2. PNG;
  3. Browser.

Theoretically, if (2) is properly solved, it could be used for (3) too. That's how we do it for v2.wttr.in: it just uses rendered PNG inside HTML and that's it.

Anyway, the most complext task would be to support the terminal properly.

Also, what would be possible for the terminal, is some additional parameter for the query, that would specify what type of bidi-handing is currently in use, so that the server could prepare the data accordingly.

chubin commented 2 years ago

@nakanakaii thank you for your help offer.

If you would like to fix some translation errors, the translations are here:

https://github.com/chubin/wttr.in/blob/master/share/translations/ar.txt https://github.com/chubin/wttr.in/blob/master/share/translations/ar-help.txt

Please feel free to create pull-requests with the fixes

chubin commented 2 years ago

@nakanakaii corrected some translation errors: #742, #743. Some errors are still there:

https://github.com/chubin/wttr.in/blob/master/lib/translations.py https://github.com/chubin/wttr.in/blob/master/lib/translations_v2.py