Created attachment 373298 [details] Hebrew report headers showing Jibbrish Hi, I'm currently working on translating Gnucash GUI to Hebrew (Hebrew is RTL). During testing my translation, I noticed that the Reports do not support RTL while the GUI itself does. Meaning the whole page should have been RTL oriented. Also it seems that the reports do not retrieve the Hebrew strings from the report settings hence the are showing jibrish headings or completely broken. My Regards Avi
Created attachment 373299 [details] Income statement showing Gibberish header and not aligned RTL
Avi, can you update to 3.6, try a nightly https://code.gnucash.org/builds/flatpak/maint/?C=M;O=D or build gnucash yourself. I believe, a few UTF issues are already fixed.
The rtl fix should be easy, we just need to detect an rtl language and add the dir="rtl" attribute to the <html> tag at the top of the report.
Created attachment 373347 [details] v 3.6, reprt and main window showing Gibberish headers and not aligned RTL
@Avi - Would you mind modify html-document.scm and retry? We can figure out autodetect later on... modified gnucash/report/report-system/html-document.scm @@ -150,7 +150,7 @@ ;;./share/gnucash/scm/gnucash/report/taxinvoice.eguile.scm:<html> ;;./share/gnucash/scm/gnucash/report/balsheet-eg.eguile.scm:<html> - (push "<html>\n") + (push "<html dir='rtl'>\n") (push "<head>\n") (push "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n") (if style-text
Actually, I built 3.6 from the source a few days ago hoping this will go away but unfortunately it is still there... :) Here is a list of the main languages that use right to left scripts: Arabic Aramaic Azeri Dhivehi/Maldivian Hebrew Kurdish (Sorani) Persian/Farsi Urdu
PS alternatively "<html dir='auto'>\n" *may* be better...
hum... that partially took care of alleging the report direction to the right, but not text (account names) and not the gibberish (see attached screen caption)
Created attachment 373348 [details] aligned vendor aging report w/ gibbrish
I did not notice any difference between "<html dir='auto'>\n" and "<html dir='rtl'>\n"...
Ok sounds like rtl can be fixed; the gibberish looks like a guile string issue. Please send: exact locale, .html generated in /tmp, guile version...
Created attachment 373349 [details] no issue here Can't reproduce from my end. Try setting Report Options, screenshot, click reset options, screenshot?
one more thing, it only affects some reports not all, trial balance, balance sheet, and some others are still aligned to the left.
Created attachment 373350 [details] b4
Created attachment 373351 [details] after resetting fixes the problem temporarily until exiting the report. After relaunching, Gibberish is back too..
Created attachment 373352 [details] after re launching the repoert
sounds like a different form of bug 796754 -- we'd really need datasheets. guile version exact OS version exact build parameters version of dependencies
oh btw if you can upgrade your macOS guile to 2.2 it *should* fix gibberish
erratum- no idea why I thought you were using MacOS. Linux upgrade to 2.2 should fix. If I'm right, we'll need to consider how to fix this for users on guile-2.0
Created attachment 373356 [details] needs to be Align to the right Yupe looks like guil 2.2 did the job... gibberish is gone, the only other issue is to make sure all reports, title, and texts are aligned to the right
Good. It will *really* help to identify how to fix html. None of the regular devs use RTL. Perhaps File>Export>Report .html, amend in editor, and document how to fix to your suggestions?
Try the following patch, basically removing text-align:left in default styles: modified gnucash/report/report-system/html-fonts.scm @@ -140,7 +140,7 @@ (string-append "h3 { " title-font-info " }\n" "a { " account-link-font-info " }\n" - "body, p, table, tr, td { text-align: left; vertical-align: top; " text-cell-font-info " }\n" + "body, p, table, tr, td { vertical-align: top; " text-cell-font-info " }\n" "tr.alternate-row { background: " alternate-row-color " }\n" "tr { page-break-inside: avoid !important;}\n" "th.column-heading-left { text-align: left; " number-header-font-info " }\n"
Thanks Christopher, that took care of most of the reports but some still not aligning to the right; balance sheet, income statement, trial balance, equity statement... probably some more (i can go through all of them if it helps)
...and forgot to mention the journals, of course, they too need to right-aligned
I think some will remain LTR because the document-title is a mixture RTL and LTR. dir=auto doesn't seem to autodetect RTL if that's the case. eguile reports won't detect RTL either. This is a *hard* problem, solved via complex code. See: ICU BiDi, Harfbuzz.
fair enough, the gibberish was my main concern...
(In reply to Christopher Lam from comment #18) > oh btw if you can upgrade your macOS guile to 2.2 it *should* fix gibberish Chris, except in the rare case of a MacPorts user, MacOS users use an all-in-one bundle with all of the dependencies provided. It's provided Guile 2.2 since GnuCash 3.2.
(In reply to Christopher Lam from comment #25) > I think some will remain LTR because the document-title is a mixture RTL and > LTR. dir=auto doesn't seem to autodetect RTL if that's the case. eguile > reports won't detect RTL either. > > This is a *hard* problem, solved via complex code. See: ICU BiDi, Harfbuzz. Harfbuzz is about glyph shaping. FriBiDi (https://github.com/fribidi/fribidi) is the non-icu implementation that Gnome uses. Not that it matters, neither ICU nor FriBiDi will help with HTML where the (embedded) browser is responsible for rendering the text. https://www.w3.org/International/articles/inline-bidi-markup/ has some recommendations for HTML, but it's naturally oriented more towards PHP than Scheme or C.
So, many aspects to this bug 1. gibberish fixed by upgrading to guile-2.2. but guile-2.0 is still supported. this suggests we'd need to add the MarkWeaver's monkeypatch, eg. in utilities.scm 2. dir=auto may be added to top <html> 3. some reports fail the bidi autodetect, I think because the report-title amalgamates companyname+reportname; could be amended so that a localised reportname is rendered in its own <span> therefore triggers the RTL autodetect. but this is a brittle. alternatively try find locale->rtl (which doesn't seem to exist) and enforce <html dir=rtl> if this is true.
@Avi it would be of great help to temporarily downgrade guile to 2.0, check out my branch https://github.com/christopherlam/gnucash/tree/maint and retry; it incorporates both html dir=auto and the strings fix. We can then consider these matters closed and move on to try fixing other reports.
Here's what I did: -Uninstalled gnucash-3.6 -Downgraded guile to 2.0 -Checked out your branch from git -Ran make and got the following error: "Scanning dependencies of target gnc-module make[2]: *** No rule to make target 'libgnucash/gnc-module/CMakeFiles/gnc-module.dir/build'. Stop. CMakeFiles/Makefile2:6069: recipe for target 'libgnucash/gnc-module/CMakeFiles/gnc-module.dir/all' failed make[1]: *** [libgnucash/gnc-module/CMakeFiles/gnc-module.dir/all] Error 2 Makefile:162: recipe for target 'all' failed make: *** [all] Error 2 avi@avi-PC-Mint19:~/git/gnucash-maint/build-gnucash-maint$" Any idea
line 4, I ran cmake...
Should have exact same dependencies as v3.6, plus/minus a smidge; try follow https://wiki.gnucash.org/wiki/Building_On_Linux exactly
cmake resulted in these errors: CMake Error: CMake can not determine linker language for target: test-core-guile CMake Error: Cannot determine link language for target "test-core-guile". CMake Error: CMake can not determine linker language for target: gncmod-app-utils CMake Error: Cannot determine link language for target "gncmod-app-utils". CMake Error: CMake can not determine linker language for target: gnc-core-utils CMake Error: Cannot determine link language for target "gnc-core-utils". CMake Error: CMake can not determine linker language for target: gncmod-engine CMake Error: Cannot determine link language for target "gncmod-engine". CMake Error: CMake can not determine linker language for target: gnc-module CMake Error: Cannot determine link language for target "gnc-module". CMake Error: CMake can not determine linker language for target: gnc-gnome CMake Error: Cannot determine link language for target "gnc-gnome". CMake Error: CMake can not determine linker language for target: gncmod-gnome-utils CMake Error: Cannot determine link language for target "gncmod-gnome-utils". CMake Error: CMake can not determine linker language for target: gncmod-html CMake Error: Cannot determine link language for target "gncmod-html". CMake Error: CMake can not determine linker language for target: gncmod-report-gnome CMake Error: Cannot determine link language for target "gncmod-report-gnome". CMake Error: CMake can not determine linker language for target: gncmod-report-system CMake Error: Cannot determine link language for target "gncmod-report-system". -- Generating done -- Build files have been written to: /home/avi/git/gnucash-maint/build-gnucash-maint avi@avi-PC-Mint19:~/git/gnucash-maint/build-gnucash-maint$
I've got them all yet still cmake ends with errors...
I'm gonna give it a go on my Dell LP, it has less stuff piled up on it
Same errors on my LP... CMake Error at common/test-core/CMakeLists.txt:43 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/common/test-core/swig-unittest-support-guile.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at libgnucash/app-utils/CMakeLists.txt:94 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/libgnucash/app-utils/swig-app-utils-guile.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at libgnucash/core-utils/CMakeLists.txt:130 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/libgnucash/core-utils/swig-core-utils-guile.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at libgnucash/engine/CMakeLists.txt:225 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/libgnucash/engine/swig-engine.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at libgnucash/gnc-module/CMakeLists.txt:21 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/libgnucash/gnc-module/swig-gnc-module.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at gnucash/gnome/CMakeLists.txt:126 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/gnucash/gnome/swig-gnome.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at gnucash/gnome-utils/CMakeLists.txt:206 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/gnucash/gnome-utils/swig-gnome-utils.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at gnucash/html/CMakeLists.txt:37 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/gnucash/html/swig-gnc-html.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at gnucash/report/report-gnome/CMakeLists.txt:26 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/gnucash/report/report-gnome/swig-report-gnome.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error at gnucash/report/report-system/CMakeLists.txt:18 (add_library): Cannot find source file: /home/avi/git/gnucash-maint/gnucash/report/report-system/swig-report-system.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error: CMake can not determine linker language for target: test-core-guile CMake Error: Cannot determine link language for target "test-core-guile". CMake Error: CMake can not determine linker language for target: gncmod-app-utils CMake Error: Cannot determine link language for target "gncmod-app-utils". CMake Error: CMake can not determine linker language for target: gnc-core-utils CMake Error: Cannot determine link language for target "gnc-core-utils". CMake Error: CMake can not determine linker language for target: gncmod-engine CMake Error: Cannot determine link language for target "gncmod-engine". CMake Error: CMake can not determine linker language for target: gnc-module CMake Error: Cannot determine link language for target "gnc-module". CMake Error: CMake can not determine linker language for target: gnc-gnome CMake Error: Cannot determine link language for target "gnc-gnome". CMake Error: CMake can not determine linker language for target: gncmod-gnome-utils CMake Error: Cannot determine link language for target "gncmod-gnome-utils". CMake Error: CMake can not determine linker language for target: gncmod-html CMake Error: Cannot determine link language for target "gncmod-html". CMake Error: CMake can not determine linker language for target: gncmod-report-gnome CMake Error: Cannot determine link language for target "gncmod-report-gnome". CMake Error: CMake can not determine linker language for target: gncmod-report-system CMake Error: Cannot determine link language for target "gncmod-report-system". -- Generating done -- Build files have been written to: /home/avi/git/gnucash-maint/build-gnucash-maint avi@avi-Latitude-E7470:~/git/gnucash-maint/build-gnucash-maint$
I think something must have gone wrong in setting up the source code dir. If you built 3.6 (or later) from source (not flatpak) obtained via $git clone https://github.com/Gnucash/gnucash.git then you could $git remote add chris https://github.com/christopherlam/gnucash.git $git checkout chris/maint etc. If via flatpak then I'm sorry I can't generate it. Someone else may be able to assist.
Do you have swig installed ? It's a mandatory dependency when building from git. Can you post your full cmake output (when run in an empty build directory) ?
swig and all other dependencies are there, I was able to rebuild and install 3.6 smoothly without any problems. So this is probably something to do with getting the repo from git. let me try what Christopher suggested and see how goes it.
ok that was it, make is running now...
or not :( failed again with: Backtrace: In ice-9/eval-string.scm: 44: 19 [read-and-eval #<input: string 55f706ce9d00> #:lang ...] 37: 18 [lp (use-modules (gnucash engine))] In ice-9/eval.scm: 505: 17 [#<procedure 55f7066174e0 at ice-9/eval.scm:499:4 (exp)> (use-modules #)] In ice-9/psyntax.scm: 1106: 16 [expand-top-sequence ((use-modules (gnucash engine))) () ...] 989: 15 [scan ((use-modules (gnucash engine))) () ...] 279: 14 [scan ((# #) #(syntax-object *unspecified* # #)) () (()) ...] In ice-9/boot-9.scm: 3589: 13 [process-use-modules (((gnucash engine)))] 705: 12 [map #<procedure 55f7066d6d60 at ice-9/boot-9.scm:3589:25 (mif-args)> ((#))] 3590: 11 [#<procedure 55f7066d6d60 at ice-9/boot-9.scm:3589:25 (mif-args)> (#)] 2867: 10 [resolve-interface (gnucash engine) #:select ...] 2792: 9 [#<procedure 55f7066c9640 at ice-9/boot-9.scm:2780:4 (name #:optional autoload version #:key ensure)> # ...] 3068: 8 [try-module-autoload (gnucash engine) #f] 2404: 7 [save-module-excursion #<procedure 55f706e38ba0 at ice-9/boot-9.scm:3069:17 ()>] 3088: 6 [#<procedure 55f706e38ba0 at ice-9/boot-9.scm:3069:17 ()>] In unknown file: ?: 5 [primitive-load-path "gnucash/engine" ...] In engine.scm: 118: 4 [#<procedure 55f706e68ce0 ()>] In ice-9/boot-9.scm: 1727: 3 [%start-stack load-stack ...] 1732: 2 [#<procedure 55f706d08990 ()>] In unknown file: ?: 1 [primitive-load-path "gnucash/engine/gnc-numeric"] In ice-9/boot-9.scm: 109: 0 [#<procedure 55f706a7cbc0 at ice-9/boot-9.scm:100:6 (thrown-k . args)> misc-error ...] ice-9/boot-9.scm:109:20: In procedure #<procedure 55f706a7cbc0 at ice-9/boot-9.scm:100:6 (thrown-k . args)>: ice-9/boot-9.scm:109:20: In procedure primitive-load-path: Unable to find file "gnucash/engine/gnc-numeric" in load path libgnucash/engine/CMakeFiles/scm-engine-1.dir/build.make:80: recipe for target 'lib/x86_64-linux-gnu/guile/2.0/site-ccache/gnucash/engine/engine-utilities.go' failed make[2]: *** [lib/x86_64-linux-gnu/guile/2.0/site-ccache/gnucash/engine/engine-utilities.go] Error 1 CMakeFiles/Makefile2:5060: recipe for target 'libgnucash/engine/CMakeFiles/scm-engine-1.dir/all' failed make[1]: *** [libgnucash/engine/CMakeFiles/scm-engine-1.dir/all] Error 2 Makefile:162: recipe for target 'all' failed make: *** [all] Error 2
This might not be helpful at all but since I was unable to build from your repo, as a workaround, I manually copied and paste the raw code from the three files in your repo; html-fonts.scm, html-document.scm and utilities.scm into the gnucash-maint repo and built from that (which ended Successfully). With this installation, gnucash runs fine but the whole thing is left-aligned; main menu, tabs, reports (a few reports still aligns to the right). Again, I'm not sure that with this workaround, this even means anything...
I can't see how my .scm changes would modify the whole application RTL. Perhaps try reset to the main repository and try rebuild. Then try copy the .scm files again.
Remember, scheme is interpreted. You can copy the modified files into /usr/share/share/guile/site/2.2/gnucash/report and run GnuCash. As Chris says, this change won't affect the GUI, just the HTML display of the report itself. Note that with dir='auto' the text direction is determined by the characters in the title, so you may need to edit it in report options to make sure that it's all Hebrew in order to get an RTL report. Can you say which reports display RTL and which LTR, the latter in particular if it's even with an all-Hebrew title?
Copying the .scm to a clean build worked! So now it looks like all reports are right-aligned other than the Journals and eguile which was expected.
Ok I've replicated the <html dir='auto'> to the eguile reports in the following branch. https://github.com/christopherlam/gnucash/tree/maint-797279 I have also enabled translation for the general-ledger. Please let me know if any other reports are not rtl properly.
Created attachment 373359 [details] Bill Hi Christopher, Looks like you got most of them but a few: Bill, Charts legends, text-align in the eguils and the journal is still LTR. I'm attaching some screenshots
Created attachment 373360 [details] Eguil Bakance Sheet
Created attachment 373361 [details] Charts Legends
Created attachment 373362 [details] Journal
Ok the only one I'd fix now is the balance sheet (eguile). Others are UI (not my area) and charts (big changes imminent). Recheck my branch, CSS for balsheet-eg.css amended.
Great, many thanks Chris
balsheet-eg.css too looks good now!
Ok I will merge these fixes tonight. I presume these fixes are confirmed with guile-2.0. Please continue filing RTL bugs as they appear... however I cannot help for non-reports ones.
Sure, thanks a lot Chris...
Merged. Now maint has all changes already discussed. Further RTL issues please file new bugs. I know the register ("Journal" above) code is very difficult to understand, so, may not be fixable.
Hi Chris, Just a remainder that all new (beta) reports also need to right align... -Customer -Employee -Job -Vendor -Payable -Receivable
Where are your famous screenshots? :)
Created attachment 373465 [details] New beta reports here you go...
More than happy to add some, as lon they will not charge me for eating up all their storage space... ;)
Well the point of screenshots is to know which part exactly should be RTL...
Ping. Unless I have screenshot describing RTL components, I will not fix.
I did add one Chris, see my pose above, dated 2019-11-26 10:34:38 EST
But there's no handwritten drawing describing which parts need to be RTL.
Created attachment 373478 [details] New beta reports with annotations
Basically everything on the displayed report window needs to be RTL.
Did you *also* mean the column headers and contents? All of them?
Yes, That is correct, Just as you fixed all other reports a couple of months back
I've pushed a fix. It would seem RTL autodetect relies on the <title> tag being RTL. So, when "Receivable Aging (beta)" is translated, the aging report should be RTL.
As an alternative to translating these report names, perhaps it may be best to use reuse existing report names, and we only need to translate "(beta)" instead. Agreed?
(In reply to Christopher Lam from comment #71) > As an alternative to translating these report names, perhaps it may be best > to use reuse existing report names, and we only need to translate "(beta)" > instead. Agreed? That should be "%s (beta)" in C notation, so translators can adjust the format. Apparently it needs a translator comment: This string is used to mark beta versions of reports, where %s is the report name.
I already translated the report titles altogether with some other stuff from the updated POT file and will push the he.po file soon.
https://www.w3.org/International/questions/qa-html-dir#dirauto states the first Strongly-typed char sets the RTL autodetect. Hence the report-title fix in https://github.com/Gnucash/gnucash/commit/60765e388ac69c4ae95223562de1108bc1a9f43e is an adequate fix for the new-owner-reports. new-aging reports are not yet fixed -- addition of more i18n strings is one approach, or you can modify the reportname to hebrew in options, or I can modify report code to reuse existing strings.
This is not happening in 3.10 any more, so i guess it is ok to close this one?
Yes, thanks a lot for reporting back.