Download the PHP package leaseweb/gettext-translation-bundle without Composer

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

LswGettextTranslationBundle

The LswGettextTranslationBundle adds gettext translation support to your Symfony4 application. It is aimed to be faster and more user-friendly than the built-in translation support of Symfony4.

Requirements

Installation

Installation is broken down in the following steps:

  1. Download LswGettextTranslationBundle using composer
  2. Enable the Bundle
  3. Install the needed locales
  4. Set the language in your application

Step 1: Download LswGettextTranslationBundle using composer

Add LswGettextTranslationBundle in your composer.json:

Now tell composer to download the bundle by running the command:

Composer will install the bundle to your project's vendor/leaseweb directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

Step 3: Install the needed locales

As described here you can list the locales that you have installed on your (Linux) system with the command 'locale -a'. If you want to support Dutch, English and German you should execute the following commands:

`

More language codes can be found here

Step 4: Set the language in your application

Use the standard $request->setLocale('en'); to set the locale in your application.

Edit the following file to define 2 letter shortcuts for the locales (this is recommended):

Usage

Usage is broken down in the following steps:

  1. Use gettext (convenience) functions in your code
  2. Extract the strings from a bundle that need to translated by gettext (.pot file)
  3. (First time only) Initialize the languages you want to support in the bundle (.po file)
  4. (Skip first time) Update the language (.po) files with the new gettext template (.pot) file
  5. Translate the language files using the excellent Poedit application
  6. Combine all translations into one file (.mo file)

Step 1: Use gettext (convenience) functions in your code

You can use the following functions:

Step 2: Extract the strings from a bundle

Use the ./app/console gettext:bundle:extract command to search a bundle for translation strings and to store them into a gettext template (.pot) file.

Step 3: (First time only) Initialize the languages you want to support

Use the ./app/console gettext:bundle:initialize command to copy the gettext template (.pot) file into the language specific (.po) files.

Step 4: (Skip first time) Update the gettext language (.po) files with the template

Use the Poedit application to load a gettext language (.po) file. Choose the "Update from template" option and point Poedit to the generated gettext template (.pot) file. Review and confirm the changes.

Step 5: Translate the language files using the excellent Poedit application

Use the Poedit application to load a gettext language (.po) file. Translate all missing strings (shown in blue) and check and correct all fuzzy translated strings (shown in yellow).

Step 6: Combine all translation

Use the ./app/console gettext:combine command combine all gettext language (.po) files into one compiled gettext (.mo) file.


All versions of gettext-translation-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
symfony/framework-bundle Version ^2.1|^3.0
twig/twig Version ~1.12
symfony/process Version ^2.5|^3.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 leaseweb/gettext-translation-bundle contains the following files

Loading the files please wait ....