Download the PHP package popphp/pop-i18n without Composer

On this page you can find all versions of the php package popphp/pop-i18n. 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 pop-i18n

pop-i18n

Build Status Coverage Status

Join the chat at https://popphp.slack.com Join the chat at https://discord.gg/TZjgT74U7E

Overview

pop-i18n is a component for internationalization and localization. It provides the features for translating and managing different languages and locales that may be required for an application. It also provides for parameters to be injected into the text for personalization.

pop-i18n is a component of the Pop PHP Framework.

Top

Install

Install pop-i18n using Composer.

composer require popphp/pop-i18n

Or, require it in your composer.json file

"require": {
    "popphp/pop-i18n" : "^4.0.0"
}

Top

Quickstart

First, you will have to create your language and locale files. The accepted formats are either XML or JSON:

fr.xml
fr.json

From there, you can create your I18n object and give it the folder with the language files in it. It will auto-detect which file to load based on the language passed.

Bonjour, mon nom est Nick. Je aime programmer PHP.

Alternatively, you can directly echo the string out like this:

You can set the language and locale when you instantiate the I18n object like above, or if you prefer, you can set it in your application as a constant POP_LANG and the I18n object will look for that as well. The default is en_US.

Top

Advanced

The pop-i18n component comes with the functionality to assist you in generating your required language files. Knowing the time and possibly money required to translate your application's text into multiple languages, the component can help with assembling the language files once you have the content.

You can give it arrays of data to generate complete files:

Also, if you have a source text file and an output text file with a 1:1 line-by-line ratio, then you can create the language files in fragment set and merge them as needed. An example of a 1:1 ratio source-to-output text files:

source/en.txt output/de.txt
This field is required. Dieses Feld ist erforderlich.
Please enter your name. Bitte geben Sie Ihren Namen ein.

So then, you can do this:

And merge the fragments into a main language file.


All versions of pop-i18n with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
ext-json Version *
ext-simplexml Version *
ext-libxml 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 popphp/pop-i18n contains the following files

Loading the files please wait ....