Download the PHP package / without Composer

On this page you can find all versions of the php package /. 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?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

Gettext

Latest Version on Packagist ![ico-ga] Total Downloads

Note: this is the documentation of the new 5.x version. Go to 4.x branch if you're looking for the old 4.x version

Created by Oscar Otero http://oscarotero.com [email protected] (MIT License)

Gettext is a PHP (^7.2) library to import/export/edit gettext from PO, MO, PHP, JS files, etc.

Installation

Classes and functions

This package contains the following classes:

Usage example

Translation

The Gettext\Translation class stores all information about a translation: the original text, the translated text, source references, comments, etc.

Translations

The Gettext\Translations class stores a collection of translations:

Loaders

The loaders allow to get gettext values from multiple formats. For example, to load a .po file:

As of version 5.7.0, a StrictPoLoader has been included, with a parser more aligned to the GNU gettext tooling with the same expectations and failures (see the tests for more details).

The usage is basically the same as the PoLoader:

This package includes the following loaders:

And you can install other formats with loaders and generators:

Generators

The generators export a Gettext\Translations instance to any format (po, mo, etc).

This package includes the following generators:

And you can install other formats with loaders and generators:

Scanners

Scanners allow to search and extract new gettext entries from different sources like php files, twig templates, blade templates, etc. Unlike loaders, scanners allows to extract gettext entries with different domains at the same time:

This package does not include any scanner by default. But there are some that you can install:

Merging translations

You will want to update or merge translations. The function mergeWith create a new Translations instance with other translations merged:

But sometimes this is not enough, and this is why we have merging options, allowing to configure how two translations will be merged. These options are defined as constants in the Gettext\Merge class, and are the following:

Constant Description
Merge::TRANSLATIONS_OURS Use only the translations present in $translations1
Merge::TRANSLATIONS_THEIRS Use only the translations present in $translations2
Merge::TRANSLATIONS_OVERRIDE Override the translation and plural translations with the value of $translation2
Merge::HEADERS_OURS Use only the headers of $translations1
Merge::HEADERS_REMOVE Use only the headers of $translations2
Merge::HEADERS_OVERRIDE Overrides the headers with the values of $translations2
Merge::COMMENTS_OURS Use only the comments of $translation1
Merge::COMMENTS_THEIRS Use only the comments of $translation2
Merge::EXTRACTED_COMMENTS_OURS Use only the extracted comments of $translation1
Merge::EXTRACTED_COMMENTS_THEIRS Use only the extracted comments of $translation2
Merge::FLAGS_OURS Use only the flags of $translation1
Merge::FLAGS_THEIRS Use only the flags of $translation2
Merge::REFERENCES_OURS Use only the references of $translation1
Merge::REFERENCES_THEIRS Use only the references of $translation2

Use the second argument to configure the merging strategy:

There are some typical scenarios, one of the most common:

For this scenario, you can use the option Merge::SCAN_AND_LOAD with the combination of options to fit this needs (SCAN new entries and LOAD a .po file).

More common scenarios may be added in a future.

Related projects

Contributors

Thanks to all contributors specially to @mlocati.


Please see CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.


All versions of with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
gettext/languages Version ^2.3
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 / contains the following files

Loading the files please wait ....