Download the PHP package phpmyadmin/motranslator without Composer

On this page you can find all versions of the php package phpmyadmin/motranslator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package motranslator

motranslator

Translation API for PHP using Gettext MO files.

Test-suite codecov.io Scrutinizer Code Quality Packagist

Features

Limitations

Installation

Please use Composer to install:

Documentation

The API documentation is available at https://develdocs.phpmyadmin.net/motranslator/.

Object API usage

Low level API usage

Translator API usage

Gettext compatibility usage

Using APCu-backed cache

If you have the APCu extension installed you can use it for storing the translation cache. The .mo file will then only be loaded once and all processes will share the same cache, reducing memory usage and resulting in performance comparable to the native gettext extension.

If you are using Loader, pass it an ApcuCacheFactory before getting the translator instance:

If you are using the low level API, instantiate the ApcuCache directly:

By default, APCu will cache the translations until next server restart and prefix the cache entries with mo_ to avoid clashes with other cache entries. You can control this behaviour by passing $ttl and $prefix arguments, either to the ApcuCacheFactory or when instantiating ApcuCache:

If you receive updated translation files you can load them without restarting the server using the low-level API:

You should ensure APCu has enough memory to store all your translations, along with any other entries you use it for. If an entry is evicted from cache, the .mo file will be re-parsed, impacting performance. See the apc.shm_size and apc.shm_segments documentation and monitor cache usage when first rolling out.

If your .mo files are missing lots of translations, the first time a missing entry is requested the .mo file will be re-parsed. Again, this will impact performance until all the missing entries are hit once. You can turn off this behaviour by setting the $reloadOnMiss argument to false. If you do this it is critical that APCu has enough memory, or users will see untranslated text when entries are evicted.

History

This library is based on php-gettext. It adds some performance improvements and ability to install using Composer.

Motivation

Motivation for this library includes:

Why not to use native gettext in PHP?

We've tried that, but it's not a viable solution:

Why use Gettext and not JSON, YAML or whatever?

We want translators to be able to use their favorite tools and we want us to be able to use wide range of tools available with Gettext as well such as web based translation using Weblate. Using custom format usually adds another barrier for translators and we want to make it easy for them to contribute.


All versions of motranslator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
symfony/expression-language Version ^4.0 || ^5.0 || ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpmyadmin/motranslator contains the following files

Loading the files please wait ....