Wish [Suggestion] Comment translator

LucaMs

Expert
Licensed User
Longtime User
This isn't a wish, it's just a... crazy idea that came to mind, a suggestion to Anywhere Software.


Imagine if you had:

1758404171220.png


(It would be even better without the dialogue, direct translation, but I wanted to explain well what I mean).

I asked an AI if there's a Google Translator API. It said yes. I understood, however, that you need to create an account. Clearly, to implement this functionality in Anywhere Software's IDE editors, it would have to create its own account and all IDEs would have to use that single account. This, however, comes at a cost; it's free for up to 500,000 characters per month.

So I asked the same AI if there's a free alternative.

There is.
LibreTranslate: It is an open source project that offers free APIs and can be self-hosted, so it does not incur pay-per-use translation costs.


(Me:)
How does LibreTranslate work? What should Anywhere Software install on its servers, and how?

(That AI:)
LibreTranslate is an open-source machine translation API that Anywhere Software can install and run on its servers to provide translations at no cost to use.

How LibreTranslate Works​

  • It is a software API server that can be installed locally or on cloud servers, which provides REST endpoints for translation.
  • It does not depend on external proprietary services like Google or Microsoft, so it has no translation costs.
  • It supports multiple languages and you can use it to translate text by sending HTTP POST requests with source text, source language, and target language.

What Anywhere Software should install​

  • The project is available on GitHub at: https://github.com/LibreTranslate/LibreTranslate
  • This is a Python (Flask) or Docker-based application, with translation models included.
  • It can be installed on a Linux server or in a Docker container for easy deployment.
  • Requires adequate server resources (preferably a good CPU and at least 16GB of RAM for optimal performance).

How to install it (quick example)​

  • With Docker (recommended method for simplicity):

bash
docker run -d -p 5000:5000 libretranslate/libretranslate
  • Or clone the repository and follow the instructions to install the Python dependencies and start the server manually.

How to use it​

  • Once the server is started, REST APIs are available at http://your-server:5000/translate
  • You can call the API with POST containing text to translate, source language, target language.
  • No API key is required if you use it locally or on a private network.
In short, Anywhere Software can host LibreTranslate on its own server, connect to that REST endpoint from its IDE, and offer unlimited translation at no additional cost, while managing server maintenance and request load resources itself.

-------------------------------------------------------------

EOCS
(End Of the Crazy Suggestion 😄)
 

LucaMs

Expert
Licensed User
Longtime User
No API key is required if you use it locally or on a private network.
I asked:
But doesn't that statement contradict what we said, about the free nature and therefore the possibility of using Anyhwere Software for its IDE-TextEditor?

AI answer:
The statement "No API key required when using on-premises or a private network" refers to the fact that LibreTranslate, when installed and managed independently by Anywhere Software on its own servers, does not require an API key to authenticate requests. This means that in a controlled environment (on-premises or a private corporate network), direct access can be allowed without authentication and at no additional cost.

However, LibreTranslate supports the ability to configure API keys to manage request limits, user or application quotas, and security. This option is optional and primarily intended for public or shared instances. If Anywhere Software wants to limit access or control usage, it can enable API key management and enforcement, but it is not mandatory for private or self-managed use.

So there is no contradiction between free/self-management and optional API key management: the key is a control and limitation tool rather than an essential technical requirement.

In summary:
  • Private/local use: no API key required, free and open source.
  • Public/shared use or with limits/quota controls: You can enable mandatory use of API keys.
Anywhere Software could then offer the translation feature in their IDEs without API costs as they will use a self-managed LibreTranslate server without API keys, unless they want to add specific controls.
 

fernando1987

Active Member
Licensed User
Example free Translation:
Sub Button1_Click
Test_Translation
End Sub

Sub Test_Translation
    Get_api2("hello", "en", "es") ' Translates "hello" from English to Spanish
    Wait For Translate(world As String)
    Log("Translated: " & world) ' Outputs: Translated: hola
End Sub

Sub Get_api2(word As String, lang1 As String, lang2 As String) As ResumableSub
    Try
        ' Validate inputs
        If word = "" Or lang1 = "" Or lang2 = "" Then
            Return ""
        End If

        ' Initialize HttpJob and JSONParser
        Dim j As HttpJob
        Dim parser As JSONParser
        j.Initialize("", Me)
        
        ' Construct the Google Translate API URL
        Dim url As String = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" & lang1 & "&tl=" & lang2 & "&dt=t&q=" & word
        
        ' Send the HTTP request
        j.Download(url)
        
        ' Wait for the job to complete
        Wait For (j) JobDone(j As HttpJob)
        
        If j.Success Then
            ' Parse the JSON response
            Dim s As String = j.GetString.Trim
            parser.Initialize(s)
            Dim outerList As List = parser.NextArray
            
            ' Extract the translated word
            If outerList.Size > 0 Then
                Dim innerList As List = outerList.Get(0)
                If innerList.Size > 0 Then
                    Dim firstNonNullElement As List = innerList.Get(0)
                    If firstNonNullElement <> Null And firstNonNullElement.Size > 0 Then
                        Dim translatedWord As String = firstNonNullElement.Get(0)
                        j.Release
                        If SubExists(Me,"Translate") Then
                            CallSubDelayed2(Me,"Translate",translatedWord)
            
                        Else
            
                        End If
                        Return translatedWord
                    End If
                End If
            End If
        End If
        
        ' Release the HttpJob
        j.Release
        
        ' Return empty string on failure
        Return ""
        
    Catch
        Log("Exception: " & LastException.Message)
        Return ""
    End Try
End Sub

What if I suggest using an unlimited service based on the Google API?
 

LucaMs

Expert
Licensed User
Longtime User
What if I suggest using an unlimited service based on the Google API?
I asked an AI
The service at https://translate.googleapis.com/translate_a/single?client=gtx&sl= is an unofficial call often used for translations via Google Translate, but it is not an official Google API and is not intended for public or commercial use under Google's terms of service.

This "free and unlimited service" found in some code or script is essentially an internal endpoint used by the Google Translate website itself, accessible via HTTP calls without an API key. However:

  • It is not officially documented or supported by Google.
  • May be subject to limitations, blocks, or termination without notice.
  • It does not guarantee reliability, security or continuity over time.
  • Using it may violate Google's terms of service.
  • It is not recommended for commercial use or applications distributed as an IDE, because Google can block access at any time.
For commercial or professional use, Google recommends using the official Google Cloud Translation API, which requires registration, an API key, and a pay-per-use pricing model.

In short, that unofficial service is not a reliable or sustainable solution for Anywhere Software, while the official API provides stability, support, and legality, but at variable costs based on usage.
 

aeric

Expert
Licensed User
Longtime User
I remember a member has made something similar that translate the library XML into Chinese.
 
Top