[GH-ISSUE #909] [RTL] Hebrew #392

Open
opened 2026-02-28 00:01:59 +03:00 by kerem · 9 comments
Owner

Originally created by @itsik-b on GitHub (Jul 3, 2018).
Original GitHub issue: https://github.com/SpacehuhnTech/esp8266_deauther/issues/909

I've translated lang file for HEBREW language. I've managed to create the he.lang.gz file and created the webfile.h with the webConverter.py utility.
but it doesn't seem to work. I've set the WEBSPIFFS option in SETTINGS and confirmed that the file he.lang.gz copied to SPIFFS.

  • before coping the files to SPIFFS, I got msg "lang he.lang.gz file not found" on serial monitor. after copying it there isn't any message for missing lang file, but still works in english.

What am I missing ?
he.lang.gz
he.lang.txt

Originally created by @itsik-b on GitHub (Jul 3, 2018). Original GitHub issue: https://github.com/SpacehuhnTech/esp8266_deauther/issues/909 I've translated lang file for HEBREW language. I've managed to create the he.lang.gz file and created the webfile.h with the webConverter.py utility. but it doesn't seem to work. I've set the WEBSPIFFS option in SETTINGS <enabled> and confirmed that the file he.lang.gz copied to SPIFFS. * before coping the files to SPIFFS, I got msg "lang he.lang.gz file not found" on serial monitor. after copying it there isn't any message for missing lang file, but still works in english. What am I missing ? [he.lang.gz](https://github.com/spacehuhn/esp8266_deauther/files/2158840/he.lang.gz) [he.lang.txt](https://github.com/spacehuhn/esp8266_deauther/files/2158849/he.lang.txt)
Author
Owner

@tobozo commented on GitHub (Jul 3, 2018):

Some of the slashed quotes are mistyped (found one with a space between / and "), this makes the JSON parsing fail and the webUI loads the default language.

image

You can use this tool to pre-validate your JSON.
Or lazy fix: replace all slashed " quotes by directional signs such as « and »

<!-- gh-comment-id:402117636 --> @tobozo commented on GitHub (Jul 3, 2018): Some of the slashed quotes are mistyped (found one with a space between / and "), this makes the JSON parsing fail and the webUI loads the default language. ![image](https://user-images.githubusercontent.com/1893754/42217040-096bccf0-7ec4-11e8-9158-436f1bbb604b.png) You can use [this tool](https://jsoneditoronline.org/) to pre-validate your JSON. Or lazy fix: replace all slashed \" quotes by directional signs such as « and »
Author
Owner

@itsik-b commented on GitHub (Jul 3, 2018):

I removed all escape signs... still not good.
I've tried to change to RU lang, didn't change either, may be the problem is the lack of support on utf-8 files ?

<!-- gh-comment-id:402168140 --> @itsik-b commented on GitHub (Jul 3, 2018): I removed all escape signs... still not good. I've tried to change to RU lang, didn't change either, may be the problem is the lack of support on utf-8 files ?
Author
Owner

@tobozo commented on GitHub (Jul 3, 2018):

Please submit your changes so we can cross-verify (i.e use gist or json validator online or pastebin).

I doubt there's a problem with utf8 otherwise we'd already know.

If the file is valid JSON and correctly zipped then it's a full browser problem, but I guess you already have Hebrew installed on the phone you're using to test this, right ?

One way to test the ESP is doing its part is to directly access the he.lang(.gz) file from your mobile browser.

Another lazy test: overwrite a language file you know is working (e.g. German) with the hebrew file, then load this language from the webUI, and tell us what you get.

<!-- gh-comment-id:402188227 --> @tobozo commented on GitHub (Jul 3, 2018): Please submit your changes so we can cross-verify (i.e use gist or json validator online or pastebin). I doubt there's a problem with utf8 otherwise we'd already know. If the file is valid JSON and correctly zipped then it's a full browser problem, but I guess you already have Hebrew installed on the phone you're using to test this, right ? One way to test the ESP is doing its part is to directly access the he.lang(.gz) file from your mobile browser. Another lazy test: overwrite a language file you know is working (e.g. German) with the hebrew file, then load this language from the webUI, and tell us what you get.
Author
Owner

@itsik-b commented on GitHub (Jul 4, 2018):

Attached the clean lang file, I can't find errors in it.

Hebrew lang installed on my browsers :) (desktop and mobile phone)

I've tested it from the ESP (http://deauth.me/web/lang/he.lang.gz) the JSON file was loaded O.K. :
screenshot_2018-07-04-09-58-51

he_clean.lang.txt
he.lang.gz

<!-- gh-comment-id:402383401 --> @itsik-b commented on GitHub (Jul 4, 2018): Attached the clean lang file, I can't find errors in it. Hebrew lang installed on my browsers :) (desktop and mobile phone) I've tested it from the ESP (http://deauth.me/web/lang/he.lang.gz) the JSON file was loaded O.K. : ![screenshot_2018-07-04-09-58-51](https://user-images.githubusercontent.com/33322719/42261516-2f3f8c66-7f71-11e8-8b08-ca0a054def39.png) [he_clean.lang.txt](https://github.com/spacehuhn/esp8266_deauther/files/2162095/he_clean.lang.txt) [he.lang.gz](https://github.com/spacehuhn/esp8266_deauther/files/2162096/he.lang.gz)
Author
Owner

@itsik-b commented on GitHub (Jul 4, 2018):

got it to work. wifi.h needed to be fixed:
wifih-fix

Now I'll be able to format it better... I'll upload the fixed lang file when I'm done.

<!-- gh-comment-id:402388369 --> @itsik-b commented on GitHub (Jul 4, 2018): got it to work. wifi.h needed to be fixed: ![wifih-fix](https://user-images.githubusercontent.com/33322719/42262391-d7020404-7f73-11e8-8c6a-6cce92face2f.jpg) Now I'll be able to format it better... I'll upload the fixed lang file when I'm done.
Author
Owner

@itsik-b commented on GitHub (Jul 4, 2018):

Is there a way to make the text right alignment ?

screenshot_2018-07-04-10-33-46

<!-- gh-comment-id:402390989 --> @itsik-b commented on GitHub (Jul 4, 2018): Is there a way to make the text right alignment ? ![screenshot_2018-07-04-10-33-46](https://user-images.githubusercontent.com/33322719/42263198-f431c508-7f75-11e8-884b-1f381d96dc0c.png)
Author
Owner

@tobozo commented on GitHub (Jul 4, 2018):

there are different approaches to that

  1. RTL page html { direction: rtl; }
  2. RTL layout section { direction: rtl; }
  3. RTL blocks span { direction :rtl; }

Note that depending on the layout you sometimes have to use both directions in the same document:

 html { direction: ltr; } 
 span { direction: rtl; }

Full RTL page will probably trigger the directional anomalies you usually find on LTR-only layouts, where parts are explicitely using text-align:left.

If you come to modify the css, make sure you prefix all your extra directives like this:

[lang="he"] div.blah > span.meh { 
  direction: rtl; 
  text-align:left 
}
<!-- gh-comment-id:402394621 --> @tobozo commented on GitHub (Jul 4, 2018): there are different approaches to that 1) RTL page `html { direction: rtl; }` 2) RTL layout `section { direction: rtl; }` 3) RTL blocks `span { direction :rtl; }` Note that depending on the layout you sometimes have to use both directions in the same document: ``` html { direction: ltr; } span { direction: rtl; } ``` Full RTL page will probably trigger the directional anomalies you usually find on LTR-only layouts, where parts are explicitely using text-align:left. If you come to modify the css, make sure you prefix all your extra directives like this: ``` [lang="he"] div.blah > span.meh { direction: rtl; text-align:left } ```
Author
Owner

@itsik-b commented on GitHub (Jul 4, 2018):

I don't want to mess the other LTR languages.
I can add before every RTL text &#x202E; (Unicode Bidirectional) which will work as RTL text.
But I need to change the alignment of the paragraphs. any ideas how to do it without affecting the other LTR langs ?

<!-- gh-comment-id:402415169 --> @itsik-b commented on GitHub (Jul 4, 2018): I don't want to mess the other LTR languages. I can add before every RTL text `&#x202E;` (Unicode Bidirectional) which will work as RTL text. But I need to change the alignment of the paragraphs. any ideas how to do it without affecting the other LTR langs ?
Author
Owner

@tobozo commented on GitHub (Jul 4, 2018):

the bidi byte won't fix the left/right alignment problems, and it's implicitly inserted anyway

if things are made correctly on the layout when you switch languages, all you need is CSS, you can use it in a way it won't interfer with LTR languages.

e.g. html[lang="he"] your.directive.here

in order to get the right lang attribute to the <html> tag, you need to modify a function in site.js as follows:

function parseLang(fileStr){
	langJson = JSON.parse(fileStr);
	if(langJson["lang"] != "en"){// no need to update the HTML	
		var elements = document.querySelectorAll("[data-translate]");
		for (i = 0; i < elements.length; i++) {
			var element = elements[i];
			element.innerHTML = lang(element.getAttribute("data-translate"));
		}
	}
        document.querySelector('html').setAttribute("lang", langJson["lang"] );
	if(typeof load !== 'undefined') load();
}

<!-- gh-comment-id:402420914 --> @tobozo commented on GitHub (Jul 4, 2018): the bidi byte won't fix the left/right alignment problems, and it's implicitly inserted anyway if things are made correctly on the layout when you switch languages, all you need is CSS, you can use it in a way it won't interfer with LTR languages. e.g. `html[lang="he"] your.directive.here` in order to get the right `lang` attribute to the `<html>` tag, you need to modify a function in [site.js](https://github.com/spacehuhn/esp8266_deauther/blob/master/web_interface/js/site.js#L93) as follows: ``` function parseLang(fileStr){ langJson = JSON.parse(fileStr); if(langJson["lang"] != "en"){// no need to update the HTML var elements = document.querySelectorAll("[data-translate]"); for (i = 0; i < elements.length; i++) { var element = elements[i]; element.innerHTML = lang(element.getAttribute("data-translate")); } } document.querySelector('html').setAttribute("lang", langJson["lang"] ); if(typeof load !== 'undefined') load(); } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/esp8266_deauther#392
No description provided.