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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    LibreTranslate with Cloudron Mastodon Server

    LibreTranslate
    4
    9
    123
    Loading More Posts
    • 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.
    • shanelord01
      shanelord01 last edited by

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

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

      Thanks,
      Shane.

      shanelord01 1 Reply Last reply Reply Quote 2
      • shanelord01
        shanelord01 @shanelord01 last edited by 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?

        nichu42 girish 3 Replies Last reply Reply Quote 4
        • Referenced by  shanelord01 shanelord01 
        • nichu42
          nichu42 @shanelord01 last edited by

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

          admin @ https://blueplanet.social
          Matrix: @nichu42:blueplanet.social

          shanelord01 1 Reply Last reply Reply Quote 0
          • shanelord01
            shanelord01 @nichu42 last edited by

            @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.

            nichu42 1 Reply Last reply Reply Quote 3
            • nichu42
              nichu42 @shanelord01 last edited by

              @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.

              admin @ https://blueplanet.social
              Matrix: @nichu42:blueplanet.social

              1 Reply Last reply Reply Quote 2
              • girish
                girish Staff @shanelord01 last edited by

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

                1 Reply Last reply Reply Quote 3
                • girish
                  girish Staff @shanelord01 last edited by

                  @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 Reply Quote 1
                  • nebulon
                    nebulon Staff last edited by

                    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.

                    nichu42 1 Reply Last reply Reply Quote 5
                    • nichu42
                      nichu42 @nebulon last edited by

                      @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.

                      admin @ https://blueplanet.social
                      Matrix: @nichu42:blueplanet.social

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post
                      Powered by NodeBB