Download the PHP package jefs42/libretranslate without Composer
On this page you can find all versions of the php package jefs42/libretranslate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jefs42/libretranslate
More information about jefs42/libretranslate
Files in jefs42/libretranslate
Package libretranslate
Short Description PHP interface for the open source LibreTranslate project
License GPL-3.0-or-later
Informations about the package libretranslate
libretranslate
PHP Interface to the open source LibreTranslate project
Install
Composer (recommended)
Manual
Download the LibreTranslate.php file from src/ directory and place somewhere in you project.
Include the file in your project:
Usage
By default, this class will try to connect to and use a local installation of the LibreTranslate server at http://localhost:5000
Pass host and optionally port, source and/or target parameters to override defaults.
Set API Key
Depending on the server settings, you may need to provide a valid API key to make translation request.
Set Default Languages
The default source and target languages are set by the server. You may override these settings when constructing the class, or as needed:
Each translation function also supports specifying the languages to use when calling the function.
Detect Language
LibreTranslate will attempt to determine the language of the string passed to it.
Translate Text
Translate a string of text, or an array of multiple texts. A server may or may not have a character limit set. For larger texts see Translate File.
Translate File
Translate a file of text.
Check $translator->Settings(), current supported formats appear to be - .txt, .odt, .odp, .docx and .pptx
- Translation server may have max size limits on post/files size.
- Could pass $_SERVER['FILES']['formfield']['tmp_name'] if using for a web form.
Suggest
Submit a suggested translation to the server.
Sugesstions must be enabled on the LibreTranslate server.
Get Available Languages
Get the list of languages available on the current server.
Check Server Settings
Get settings current server is running with.
See LibreTranslate Arguments for server settings.
LTManage
If you are running a locally hosted LibreTranslate server, you may have access to ltmanage
. This allows you to view current keys and their request limits, as well as create new keys and delete current keys.
See LibreTranslate Manage Keys for details.
If ltmanage
is found in the local path then the following additonal functions will be available for use:
listKeys
Will return an array of current keys and their request limits.
addKey
Create a new key for local server with optional request limit.
removeKey
Delete an existing key from the available keys.
All versions of libretranslate with dependencies
ext-json Version *
ext-curl Version *