Download the PHP package datalinx/gettext-context without Composer

On this page you can find all versions of the php package datalinx/gettext-context. 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 gettext-context

gettext-context

Implementation of context functions for the PHP gettext extension

Packagist Version Packagist PHP Version Support Packagist Downloads Tests codecov Conventional Commits Packagist License

About

PHP still lacks full support for gettext, because it does not implement the context functions. Until this is sorted out, you can use this package to add context support to your localization efforts.

For example, in English, both persons and products have a "name" attribute. So using a simple gettext:

... would yield "Ime" in Slovenian, which is wrong.

To solve this, you can use a context function provided by this package:

Requirements

It can be used on lower versions of PHP, but you won't be able to install it with composer (or run tests).

This package is tested for Linux, but it should work for other systems too. Any Windows and Mac feedback is highly welcome. It would be great if you could make a pull request for testing on those platforms (including the GitHub workflow).

Installing

  1. Download it with composer: composer require datalinx/gettext-context
  2. Include the vendor/datalinx/gettext-context/src/gettext-context.php file when you need it*

* It's not added to the autoload directive, since you might not need or want to always include it in runtime. If you want to always load it, just add the source file to your composer.json autoload files list:

Usage

See the documented src/gettext-context.php file for the list of functions and their parameters.

Extracting messages with context support

With xgettext

You can add extra keyword parameters to your xgettext call to include the context functions. For example, this would be used in our package:

With Poedit

If you're using Poedit, add the following keywords in your Catalog > Properties > Sources Keywords:

Then run the "Update from code" procedure :)

Contributing

If you have some suggestions how to make this package better, please open an issue or even better, submit a pull request.

Should you want to contribute, please see the development guidelines in the DataLinx PHP package template.

Changelog

All notable changes to this project are automatically documented in the release-please GitHub action.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

For all this to work, commit messages must follow the Conventional commits specification, which is also enforced by a Git hook.

Credits


All versions of gettext-context with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-gettext Version *
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 datalinx/gettext-context contains the following files

Loading the files please wait ....