Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Translate
  3. LibreTranslate with Cloudron Mastodon Server

LibreTranslate with Cloudron Mastodon Server

Scheduled Pinned Locked Moved Translate
9 Posts 4 Posters 1.5k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • shanelord01S Offline
    shanelord01S Offline
    shanelord01
    wrote on last edited by
    #1

    OK I have LT setup and running, API key configured.

    How do I now edit the Cloudron Mastodon config to use it?

    Thanks,
    Shane.

    shanelord01S 1 Reply Last reply
    2
    • shanelord01S shanelord01

      OK I have LT setup and running, API key configured.

      How do I now edit the Cloudron Mastodon config to use it?

      Thanks,
      Shane.

      shanelord01S Offline
      shanelord01S Offline
      shanelord01
      wrote on last edited by shanelord01
      #2

      @shanelord01 OK - worked it out.

      1. Open the web UI for LibreTranslate after setting it up.
      2. In the "Request" box, there is a line with "const res = await fetch("https://translate.your.domain/translate", "
      3. Copy the main domain URL (ie https://translate.your.domain" )without the /translate and without quotation marks.
      4. Open your Cloudron Mastodon app, and open its file manager and edit "env.production"
      5. At the bottom, add the "#translate section" below here:
      # Optionally change default language
      # DEFAULT_LOCALE=en
      
      # translate
      LIBRE_TRANSLATE_ENDPOINT=https://translate.your.domain
      LIBRE_TRANSLATE_API_KEY=YOUR_API_KEY
      

      Save this. Restart the Mastodon app.

      API Key
      If you don't have your API key, open the LibreTranslate Cloudron App Terminal, and issue:

      su - cloudron -c 'ltmanage keys --api-keys-db-path /app/data/api_keys.db add 120'
      

      You'll get a key like "f67d5afe-aa14-4d37-90f7-f7d9636b721e" in response - use the one you got in reponse.

      Optional; set your default language:

      # Optionally change default language
      DEFAULT_LOCALE=en
      

      Update:
      After completing setup and ensuring everything works, if you want to stop people from using the Web UI to translate, you can disable it by editing the LibreTranslate "env.sh" file via its Cloudron File Manager, and adding this (then save env.sh and restart LT):

      export LT_DISABLE_WEB_UI=true
      

      Note: After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine. Not sure if this is a health check failing in the Cloudron app? @nebulon Any way to do this without causing this issue?

      nichu42N girishG 3 Replies Last reply
      4
      • shanelord01S shanelord01 referenced this topic on
      • shanelord01S shanelord01

        @shanelord01 OK - worked it out.

        1. Open the web UI for LibreTranslate after setting it up.
        2. In the "Request" box, there is a line with "const res = await fetch("https://translate.your.domain/translate", "
        3. Copy the main domain URL (ie https://translate.your.domain" )without the /translate and without quotation marks.
        4. Open your Cloudron Mastodon app, and open its file manager and edit "env.production"
        5. At the bottom, add the "#translate section" below here:
        # Optionally change default language
        # DEFAULT_LOCALE=en
        
        # translate
        LIBRE_TRANSLATE_ENDPOINT=https://translate.your.domain
        LIBRE_TRANSLATE_API_KEY=YOUR_API_KEY
        

        Save this. Restart the Mastodon app.

        API Key
        If you don't have your API key, open the LibreTranslate Cloudron App Terminal, and issue:

        su - cloudron -c 'ltmanage keys --api-keys-db-path /app/data/api_keys.db add 120'
        

        You'll get a key like "f67d5afe-aa14-4d37-90f7-f7d9636b721e" in response - use the one you got in reponse.

        Optional; set your default language:

        # Optionally change default language
        DEFAULT_LOCALE=en
        

        Update:
        After completing setup and ensuring everything works, if you want to stop people from using the Web UI to translate, you can disable it by editing the LibreTranslate "env.sh" file via its Cloudron File Manager, and adding this (then save env.sh and restart LT):

        export LT_DISABLE_WEB_UI=true
        

        Note: After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine. Not sure if this is a health check failing in the Cloudron app? @nebulon Any way to do this without causing this issue?

        nichu42N Offline
        nichu42N Offline
        nichu42
        wrote on last edited by
        #3

        @shanelord01
        What do you think about performance and quality? I was quite disappointed and returned to DeepL for now.

        Matrix: @nichu42:blueplanet.social

        shanelord01S 1 Reply Last reply
        0
        • nichu42N nichu42

          @shanelord01
          What do you think about performance and quality? I was quite disappointed and returned to DeepL for now.

          shanelord01S Offline
          shanelord01S Offline
          shanelord01
          wrote on last edited by
          #4

          @nichu42 Compared to what I had (nothing) it's quite good. Speed hasn't been an issue so far - I guess because I over-spec'd the machine it's running on so it has extra CPU available.

          nichu42N 1 Reply Last reply
          3
          • shanelord01S shanelord01

            @nichu42 Compared to what I had (nothing) it's quite good. Speed hasn't been an issue so far - I guess because I over-spec'd the machine it's running on so it has extra CPU available.

            nichu42N Offline
            nichu42N Offline
            nichu42
            wrote on last edited by
            #5

            @shanelord01 My VPS is at ~ 30% most of the time, but I found the LT API to be awfully slow. Mastodon also gave too many 503 errors (due to timeouts? I don't know). And the translation quality is just too poor compared to DeepL. However, I'm happy to have LT available via Cloudron and will certainly give it another try at a later time. I still like the idea of in-house translation without submitting data to a third party.

            Matrix: @nichu42:blueplanet.social

            1 Reply Last reply
            2
            • shanelord01S shanelord01

              @shanelord01 OK - worked it out.

              1. Open the web UI for LibreTranslate after setting it up.
              2. In the "Request" box, there is a line with "const res = await fetch("https://translate.your.domain/translate", "
              3. Copy the main domain URL (ie https://translate.your.domain" )without the /translate and without quotation marks.
              4. Open your Cloudron Mastodon app, and open its file manager and edit "env.production"
              5. At the bottom, add the "#translate section" below here:
              # Optionally change default language
              # DEFAULT_LOCALE=en
              
              # translate
              LIBRE_TRANSLATE_ENDPOINT=https://translate.your.domain
              LIBRE_TRANSLATE_API_KEY=YOUR_API_KEY
              

              Save this. Restart the Mastodon app.

              API Key
              If you don't have your API key, open the LibreTranslate Cloudron App Terminal, and issue:

              su - cloudron -c 'ltmanage keys --api-keys-db-path /app/data/api_keys.db add 120'
              

              You'll get a key like "f67d5afe-aa14-4d37-90f7-f7d9636b721e" in response - use the one you got in reponse.

              Optional; set your default language:

              # Optionally change default language
              DEFAULT_LOCALE=en
              

              Update:
              After completing setup and ensuring everything works, if you want to stop people from using the Web UI to translate, you can disable it by editing the LibreTranslate "env.sh" file via its Cloudron File Manager, and adding this (then save env.sh and restart LT):

              export LT_DISABLE_WEB_UI=true
              

              Note: After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine. Not sure if this is a health check failing in the Cloudron app? @nebulon Any way to do this without causing this issue?

              girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #6

              @shanelord01 thanks for the great write up! I will try to enable this on our instance as well.

              1 Reply Last reply
              3
              • shanelord01S shanelord01

                @shanelord01 OK - worked it out.

                1. Open the web UI for LibreTranslate after setting it up.
                2. In the "Request" box, there is a line with "const res = await fetch("https://translate.your.domain/translate", "
                3. Copy the main domain URL (ie https://translate.your.domain" )without the /translate and without quotation marks.
                4. Open your Cloudron Mastodon app, and open its file manager and edit "env.production"
                5. At the bottom, add the "#translate section" below here:
                # Optionally change default language
                # DEFAULT_LOCALE=en
                
                # translate
                LIBRE_TRANSLATE_ENDPOINT=https://translate.your.domain
                LIBRE_TRANSLATE_API_KEY=YOUR_API_KEY
                

                Save this. Restart the Mastodon app.

                API Key
                If you don't have your API key, open the LibreTranslate Cloudron App Terminal, and issue:

                su - cloudron -c 'ltmanage keys --api-keys-db-path /app/data/api_keys.db add 120'
                

                You'll get a key like "f67d5afe-aa14-4d37-90f7-f7d9636b721e" in response - use the one you got in reponse.

                Optional; set your default language:

                # Optionally change default language
                DEFAULT_LOCALE=en
                

                Update:
                After completing setup and ensuring everything works, if you want to stop people from using the Web UI to translate, you can disable it by editing the LibreTranslate "env.sh" file via its Cloudron File Manager, and adding this (then save env.sh and restart LT):

                export LT_DISABLE_WEB_UI=true
                

                Note: After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine. Not sure if this is a health check failing in the Cloudron app? @nebulon Any way to do this without causing this issue?

                girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #7

                @shanelord01 said in LibreTranslate with Cloudron Mastodon Server:

                After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine

                This seems like maybe the box cron job got stuck for some reason. Can you try if systemctl restart box fixes the state?

                1 Reply Last reply
                1
                • nebulonN Offline
                  nebulonN Offline
                  nebulon
                  Staff
                  wrote on last edited by
                  #8

                  I have enabled this also with our cloudron mastodon instance now and it works mostly. For some reason mastodon does not always show the translate button and sometimes it also shows it for english posts, which then results in a 503 response error, since libretranslate got the request to translate from en -> en which is wrong.

                  Just sharing this here, to set expectations.

                  nichu42N 1 Reply Last reply
                  5
                  • nebulonN nebulon

                    I have enabled this also with our cloudron mastodon instance now and it works mostly. For some reason mastodon does not always show the translate button and sometimes it also shows it for english posts, which then results in a 503 response error, since libretranslate got the request to translate from en -> en which is wrong.

                    Just sharing this here, to set expectations.

                    nichu42N Offline
                    nichu42N Offline
                    nichu42
                    wrote on last edited by
                    #9

                    @nebulon
                    I think Mastodon's translate button only appears if the poster has set a language for his / hear toot that's different from your language settings.
                    It could be that the LT API relies on the source and destination language settings that are submitted by Mastodon. That could be an explanation for the errors I received, b/c not everyone sets the language correct. Maybe the DeepL API is more flexible here.

                    Matrix: @nichu42:blueplanet.social

                    1 Reply Last reply
                    2
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Bookmarks
                    • Search