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] Hebrew #909

Open
itsik-b opened this issue Jul 3, 2018 · 9 comments
Open

[RTL] Hebrew #909

itsik-b opened this issue Jul 3, 2018 · 9 comments
Labels

Comments

@itsik-b
Copy link

itsik-b commented Jul 3, 2018

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

@tobozo
Copy link
Collaborator

tobozo commented 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 »

@tobozo tobozo added the translation Traduko label Jul 3, 2018
@tobozo tobozo changed the title Hebrew Translation Hebrew Jul 3, 2018
@tobozo tobozo changed the title Hebrew [RTL] Hebrew Jul 3, 2018
@itsik-b
Copy link
Author

itsik-b commented 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 ?

@tobozo
Copy link
Collaborator

tobozo commented 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.

@itsik-b
Copy link
Author

itsik-b commented 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

@itsik-b
Copy link
Author

itsik-b commented 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.

@itsik-b
Copy link
Author

itsik-b commented Jul 4, 2018

Is there a way to make the text right alignment ?

screenshot_2018-07-04-10-33-46

@tobozo
Copy link
Collaborator

tobozo commented 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 
}

@itsik-b
Copy link
Author

itsik-b commented Jul 4, 2018

I don't want to mess the other LTR languages.
I can add before every RTL text ‮ (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 ?

@tobozo
Copy link
Collaborator

tobozo commented 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();
}

tobozo added a commit that referenced this issue Jul 5, 2018
so that language-specific CSS can be applied (see #909)
@stale stale bot added the wontfix label Jun 16, 2020
@spacehuhn spacehuhn removed the wontfix label Jun 16, 2020
@SpacehuhnTech SpacehuhnTech deleted a comment from stale bot Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants