StatCan / kubeflow-containers-desktop

Experimental containers to be used with Kubeflow for a Desktop experience
Other
1 stars 2 forks source link

Add i18n to Remote Desktop #46

Closed blairdrummond closed 3 years ago

blairdrummond commented 4 years ago

See if we can configure bilingualism options in the remote desktop image.

Jose-Matsuda commented 4 years ago

Looked into this while waiting for my image to build. Using one of my older images for testing Jupyter which had the Lang env variables set to French, as well as the French locale being installed I found that most of it was able to be internationalized with video demonstrating some of the options here.

I've taken a look through what we base this proj on as well as the actual noVNC project and there's almost nothing on i18n.

Having said that for the noVNC proj there are some language files (no French file, but it is pretty short) and these correspond to a few of the extra messages such as "Connected (encrypted) to" "Failed to connect to server" etc. Users would probably run into around 10 of the translations that are provided by the po file.

This matches with what Nancy was thinking of doing before she ran into issues with running and testing her changes

IF this approach is wanted, it is very likely a small change that fits with #48 as well as what Wendy has talked to me about PodDefaults and getting a language through there. I still need to check exactly which ENV needs to be set to French or English for the language to be applied but it may be a change in the init.sh to then change LANG to fr_FR.utf8 or en_US.utf8 through an env var set through the PodDefault

Jose-Matsuda commented 4 years ago

Commenting for future Jose / whoever

Aside from the comment above, to get the vscode instance inside novnc remote desktop to display in French, similar to vscode in browser you need to add an argv.json file but the path is now /home/jovyan/.vscode/argv.json. If that file is there with say "locale":"fr" then upon starting up you will be greeted with vscode, but in French

7/12/2020: This file does not matter. It gets covered by the export LANG..etc phrases. The user can still change the display language to English if they want. But the default is determined by the start-vnc-server file where once a user hits the landing page, the browser language is checked, if it does not match 'en' then vnc needs to be killed, and then restarted to get to French.

Jose-Matsuda commented 4 years ago

Similar to other implementations of i18n in remote desktop, to have the noVNC change language (as seen in the video above) while the user is connected is to have some sort of export LC_ALL=fr_FR or en_EN in the start-vnc-server. This would likely again read from the argv.json file used by vscode. The service would just need to be killed when the browser language and a refresh on the landing page followed by an auto-restart courtesy of supervisord. The 'kill' of the service is a shell command of kill $(lsof -t -i:5901) where5901 is the port that the vnc_server runs on. The default signal sent by kill is the SIGTERM which is trapped by line 33 to have the shutdown signal be sent.

Jose-Matsuda commented 3 years ago

All apps so Vscode, Firefox, LibreOffice Calc, Netdata should be starting in French. Again leverage Wendy's work on passing an environment variable in. For now, test with manually setting environment variables to French and seeing what else needs to be done

VSCODE: Requires the LANG to be fr_FR Firefox: Requires an if in firefox.sh to get the right installation of FF, if LANG == fr_fr... then French install else English Netdata: No plans for multilingual support and as noted by the comments, they have moved away from the localization project which is now a read-only repo LibreOffice: pretty simple. just need to add apt-get install libreoffice-help-fr libreoffice-l10n-fr after the apt-get install libreoffice... area and the locales will take care of it. I have made the locales "english" while keeping the apt-get install line in and it was English (and with locales being French it would start in French)

Jose-Matsuda commented 3 years ago

Programs which have translations and I know how to access

Programs which have translations but I don't know how to leverage them yet These are essentially the programs whose projects have a .po file for the French langauge

Programs which do not have translations

Jose-Matsuda commented 3 years ago

Attempting to set the locales of the ENV at a deeper level because when I replaced the en_US with fr_FR some configuration settings stayed "English"

The item that I thought was the big cheese was when you ran debconf-show locales and the result would be image "None" for default_environment_locale

However, even after getting it to show up as "fr_CA" applications continued to stay in English image

As well as looking at /etc/locale.gen where fr_CA is uncommented out image and of course in /etc/default/locale image

Sources tried were wiki.debian (did not try the optional part). Looked again at the SO post in the code, confirming checking locale in the env and going through files

Jose-Matsuda commented 3 years ago

Set up my own xfce4 in a vm and was able to get it into French by selecting "French" at install and it modified the two files I expected. image still has the application menu in French image Locales image

Grasping a bit and looked at novnc. I don't think there's anything here unless there's some setting in our setup that has the current novnc installation take precedence over the xfce4 variables in the remote desktop that makes thunar and them not be localized

Jose-Matsuda commented 3 years ago

Sprung up a basic image of xcfe based on x11docker simply adding the locale. As this video shows, at least with no outside interference xcfe.

Jose-Matsuda commented 3 years ago

Update, it appears that the localization will work on Ubuntu:16.04 but will not on Ubuntu:18.04. I found this out after checking Blair's image (which uses 16.04) with the current "locale" setting method and then trying it with the exact same image except using ubuntu:18.04.

Upon suggestion by Blair/Brendan will check about gtk2, gtk3, check out ubuntu:20.04 (should be updating anyways), KDE

Jose-Matsuda commented 3 years ago

Ok, well gtk2 support is dropped in xfce 4.16 so for now I'm going to try and update to that version (as well as Ubuntu 20.04) in my own smaller remote desktop project (goodbye insanely long build times) and see if that resolves it first. Edit: at least on ubuntu packages, for 20.04 its just version 4.14 for now. 4.16 was just released at the end of last year. Ubuntu 18 also only has packages up to 4.12

Jose-Matsuda commented 3 years ago

Have a way to get something like Thunar translated for sure. Just to try out I copied over an mo file from my ubuntu:16.04 installation using Blair's image placing it in the /usr/share/locale-langpack/fr/LC_MESSAGES folder
image

The mo file can also be placed in the /usr/share/locale/fr_LC_MESSAGES folder (in fact the mo file for tigervnc is here) and it would have the same effect.

Jose-Matsuda commented 3 years ago

Also wild, I can use msgfmt messages.po -o messages.mo for some applications that for whatever reason did not generate a mo file in my ubuntu:16.04 (in my case it was gdebi). I took the po file from the gdebi project listed above, downloaded the fr.po, ran it through doing msgfmt fr.po -o gdebi.mo and copied it over and bam I have gdebi in French. image

The total size of an mo folder containing the translations would be around 2 mb.

Jose-Matsuda commented 3 years ago

Regarding the r and geomatics images Rstudio here is in a similar spot where the UI is not translated, only the console is. Geomatics with QGIS will work if the environment variables are set to French image

Jose-Matsuda commented 3 years ago

Few outstanding areas of note related to these applications; Baobab (disk usage analyzer), EOG (Eye Of Gnome image viewer), DB Browser for SQLite.

For DB Browser, just the title is untranslated, everything else is image IMO this is fine as it is the name of the application.

Baobab and EOG have the same issue where again the application title is in English only in the access area. image Note that the descriptions for these two applications in the "Search for applications" area here is in English as well. I have the same feeling here as from above.

Things I have tried: I have tried installing from a ppa repo to find a more "up to date" version but it did not help, I have tried giving the applications the most up to date mo file and again no luck.

These are very easy to remove so if its not wanted gone.