A script to auto install firefoxesr and libreoffice language packs

Forum Forums General Software A script to auto install firefoxesr and libreoffice language packs

  • This topic has 5 replies, 4 voices, and was last updated Oct 3-8:17 pm by Xecure.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #66153
    Member
    PPC

      Hi! This is for everyone that is not a native English speaker- I just created a small script to try to automate the installation of firefox-esr and libreoffice language packs to the detected system language.
      I sent it to anticapitalista, but, please, if you can, please test it in your system (it was tested and it works in pt-pt).
      You can copy and paste the code to a terminal and check if the language packs are installed, were already installed, or if there’s any error…

      The code is over at
      https://gitlab.com/antix-contribs/contribs-goodies/-/blob/master/auto-language-packs.sh

      (sorry for using the gitlab page as a testing grounds for my scripts, Xecure!)

      P.

      #66160
      Member
      Robin
        Helpful
        Up
        0
        ::

        Hi PPC,
        I consider your new script as a valuable addition to antiX. But I believe, in its current state it does actually need some hard work before it can be integrated as a default antiX tool (but this is my personal opinion from the point of view of an ordinary user merely, just wait what anticapitalista will say).

        My impression:
        In the first place, the script should check the user interface language you extract from system in the beginning against the list of available languages of the program provided by apt. You could use something like
        apt-cache search firefox-esr-l10n | sed 's/^firefox-esr-l10n-//' | cut -d ' ' -f 1
        to retrieve the available languages for e.g. firefox. Same goes for other programs using this way of internationalisation.

        Secondly I think the process of determining whether two-character-language-code or four-significant-character-language-code is needed should be automatised. It needs a simple check which one is present, and fall back to two-letter if no four letter-code fitting to the user interface language of system is found.

        Thirdly, in case this decision fails to be performed automatically you could present (as fallback) the list retrieved by the command
        apt-cache search firefox-esr-l10n | sed 's/^firefox-esr-l10n-//' | cut -d ' ' -f 3- | sed 's/ f[oü]r Firefox ESR//'
        (maybe this command needs some additional fine tuning to work with any language of user interface, I’ve checked it works fine on English and also on German system language)
        From this list user could chose what is most convenient and most closely to what is his language and what he can read.

        And finally, the script really should check by itself whether the language pack in question is installed already. This could be done by checking the result of the command
        apt-cache policy firefox-esr-l10n-fr | grep Installiert: | tr -s ' ' | cut -d ' ' -f 3
        before starting the installation. But this command needs also to get fine tuned to work in other languages. Simply replace “Installiert” by a variable containing the correct translation from transifex, which must match the expression used by apt system. You can place a developer note for this in the .pot file before uploading to transifex so translators know what is needed to do exactly here. Same goes for the result of this command, which would be “(keine)”, in any language, if the package was not installed previously, so here you need also to use a variable containig the translation from transifex for automatised comparison). Maybe there is an easier way to find out…

        I would suggest generally, to start projects like this (in respect of integration as well as translation) as antiX-community projects first, and let it ripen there some time before asking developers to integrate it to official antiX. This gives the opportunity to mend out all errors and malfunctioning routines, and moreover fine tuning of handling and design of the script, to achieve the best result possible for the users.
        So I consider »antix-contibs« on gitlab and transifex as a good choice of place for the current state of your project.

        Thank you very much for your great efforts creating this approach to solve a pressing problem of many non-english speaking antiX users. Your script is really worth to get some improvements.

        So long
        Robin

        P.S.: You should really add versioning (e.g. at least a line like »#antiX-community-autoinstall-langpacks ver. 0.1, ver. 0.2, … ver. 0.27 … ver. 0.69 … ver. 1.0 …«, please chose any name you like best and incrementing the numbers in each update shiped) to your script code. This makes it much easier to handle different development steps, and also this makes sure everybody will be able to correlate the correct version of its corresponding .po language files to the correct version of the script. (Ver. 1.0 and above means you are satisfied and your script is perfectly working, meaning really ready for use by unexperienced users.)

        Windows is like a submarine. Open a window and serious problems will start.

        #66162
        Member
        marcelocripe
          Helpful
          Up
          0
          ::

          PPC, I thank you for another important initiative.
          I started doing the tests and then I send you the results via private message.

          Robin, I appreciate you participating in this important topic.

          My suggestion is to keep the programs separate, that is, not to be all in a single “goodies” package.

          Thank you very much.

          – – – – –

          PPC, eu agradeço por mais esta importante iniciativa.
          Eu comecei a fazer os testes e depois eu te envio os resultados através da mensagem particular.

          Robin, eu agradeço por você participar deste importante tópico.

          A minha sugestão é de manter os programas separados, ou seja, para não estrarem todos em um único pacote “goodies”.

          Muito obrigado.

          #66350
          Member
          PPC
            Helpful
            Up
            0
            ::

            Robin- your ideas sound really nice. Currently I dont have much free time to dedicate to this script… So your help is welcome and apreciated. I started the ball rolling, you can pick it up and make it better.
            My script is not meant to be a full version, only a testing grounds for my ideas, to see how well this works in real life.
            I did not include any routine to check if the language packs are already installed because this script is meant to be run after instalation or at first boot. Even if it ends up on the control centre, so users can run it any time they need, trying to check if the a pack is already installed spends about the same time as trying to run install it, but you are correct- checking for unneded action is always a code practice!
            the best part of your check is that is may help out with checking what version of LO is installed – the default one or a more modern one, my scrip seems to not work on more modern versions – but I did not have time to correctly analize Marcelos tests…
            In Marcelos tests firefox-esr localizations were always installed, but there were fails in LO localizations…

            As always, all help is welcome – this automatic localization of flagship software may be important to our efforts of spreading antiX across the world, making it revive even more old computers!

            P.

            #66374
            Member
            Robin
              Helpful
              Up
              0
              ::

              Well, unfortunately I also do not have that much spare time, and I can’t lift weights of improving this script solitarily. But I will volunteerly help writing it as much I can. Let’s start right away. Here are my first proposals for the structure of the script, the so called pseudocode. Please feel free to add your ideas, additions and modifications in any concern:

              0. Preliminaries: Set and define variables, arrays, functions, read command line options etc.
              
              1. Gather and analyse information needed
              Read language of antiX user interface
              	Extract language identifier
              		Check whether there are 4 or 2 significant Language code characters present
              Read which programs are installed on this PC, which are feasible for this way of installation of language packages, and write result in an array.
              	For each program found do:
              		Extract Version numbers of programs found and store them in the array.
              update program database
              	If no connection to packet server possible then
              		User dialog: Make user aware of necessity of internet connection (Retry/Abort)
              	Else
              		perform apt-get update
              	check whether update has been successful.
              Check whether program found are most recent version
              	For each program found do:
              	If Versionnumber stored in array is not the most recent version available
              		User dialog: Ask whether program should get actualised to the most recent version available?
              		If true then
              			prebook program for update
              			correction of program version in array
              
              2. Selection of packagages to be installed
              2.1. Language Packages
              User dialog: automatic or manual choice favoured?
              	2.1.1 manual choice
              	If manual choice selected:
              		For each program found in array do:
              			Create list of available language packages
              			User choice dialog: Display list of language packages found
              			Read user selection
              				If selection is made then
              				prebook language package(es) for installation in array.
              			Else
              				Set flag in array, that there is no language package to be installed for this program
              	Else
              	2.1.2 Automatic choice:	read out, whether there exist language packages for the programs prebooked in array as to be installed
              		For each program found in array do:
              			If no language package was found being installed already
              				Read out whether there exists a suitable language package
              				If there is found a correlating installable language package with 4 significant letters language code then
              					prebook language package for installation in array.
              				Elseif there is found a correlating installable language package with two letter language code then
              					prebook language package for installation in array.
              				Else
              					Read out whether there are any other language packages available for suitable program version
              					User choice dialog: Display list of all not installed language packages for this program and version
              					Read user selection
              						If selection is made then
              							prebook language package for installation in array.
              						Else
              							Set flag in array, that there is no language package to be installed for this program
              
              2.2. Additional packages (Dictionary, Thesaurus, Grammar etc.) Read out whether there are installed already additional packages in language of user interface for the programs in array
              		For each program found in array do:
              			User choice dialog: Display list of available dictionaries grammar thesauri etc.
              			Read user selection
              				If selection is made then
              					prebook additional packages for installation in array.
              				Else
              					Set flag in array, that there are no additional packages to be installed for this program
              
              3. Installation of all packages prebooked in array
              	journalise installation errors
              
              4. Check whether installation was successful
              	If true then
              		User dialog: Summary of freshly installed languages and additional packages for each program from array
              	Else
              		User dialog: Display summary of errors
              
              5. Cleanup and exit.

              And now I’ll add some first obstacles I noticed while writing the pseudocode:

              1.) We possibly can’t use apt for this task:

              apt list --installed | grep libreoffice
              WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

              Obviously we have to look for an alternative way to retrieve all the needed pieces of information. Unfortunately apt is the single package manager I am familiar with, so here we need urgently the help of people familiar with other methods.

              2.) May be we have to check, whether additional character sets and fonts are to be installed for languages not using the latin characters. I would count that the language packages should have dependencies already solving this, can we rely on this? Any experiences?

              3.) We have to prepare a list of programs in need of this service.
              apt-cache search l10n
              displays a long list, but I am not sure whether all of them need to be included.
              Here are some which caught my attention.

              Libreoffice
              Firefox
              Firefox-esr
              Iceweasle
              Thunderbird
              chromium
              vlc
              gnupg

              Please add or remove from this list whatever you consider as necessary. I’m not sure whether l10n packages without language identifier contain all languages, so we’ll have to find out and treat them separately. In this case a routine is to be added to the pseudocode for handling this.

              So long
              Robin

              Windows is like a submarine. Open a window and serious problems will start.

              #68286
              Member
              Xecure
                Helpful
                Up
                0
                ::

                I have built on the efforts here and created a script to check for possible localization packages, and suggest them.

                $ LANGUAGE=de_DE check-lang-support 
                firefox-esr-l10n-de firefox-l10n-xpi-de libreoffice-help-de libreoffice-l10n-de chromium-l10n e2fsprogs-l10n gnupg1-l10n libgpg-error-l10n libgphoto2-l10n menu-l10n vlc-l10n libjs-jquery-i18n libparted-i18n

                I have included it in locale-antix. I was thinking of having this output a ready list to simply send to apt install. I need to separate the GUI from locale-antix script so it can live on its own.
                I need to make it so the user can specify (optionally) the language code, and core apps vs suggestions vs spellcheck/Thesaurus, etc.

                2.2. Additional packages (Dictionary, Thesaurus, Grammar etc.)

                This is a thing I am missing and I should be easy to do. I also need to fix the false results (wrong language recommendations for some languages), and possibly also add font and other recommendations for non-latin languages.

                antiX Live system enthusiast.
                General Live Boot Parameters for antiX.

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.