Download the PHP package rinkattendant6/json-i18n without Composer

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

JsonI18n

Packagist License Build Status GitHub Issues Packagist Version Packagist Downloads

Simple PHP internationalization library using JSON data.

License

This library is made available under the Mozilla Public License, version 2.0.

Usage

Installation

Using Composer

JsonI18n is available through the Packagist repository and can be installed using Composer:

Example

The addResource method can also take an array that represents the JSON object as described below.

Sub-resources

The addSubresource method works in a similar manner to addResource. Sub-resources can be a JSON file containing one top-level object with key-value pairs or a PHP array representative of that (a flat, associative array).

Since there is no locale information within a sub-resource, a locale must be specified when adding a sub-resource:

This feature allows you to split your translations into multiple files.

Resource file format

Since comments are not allowed in JSON, the @metadata object can be used for any data that is not a message. Everything inside @metadata is ignored with the exception of the arrayGroups property which is used to flatten arrays.

Every locale is its own property in the JSON file with a value object containing key-value pairs for translation.

Setting and getting the default language

The default language is initially specified in the constructor. You may call the getLanguage and setLanguage methods to get and set the default language, respectively.

Working with localized text

The methods __ (two underscores), _e, _f, and _ef allow you to work with localized text.

By default, these methods will output text in the language specified in the constructor. You may explicitly specify the output language as the last parameter of these methods. For example:

Localizing arrays

In addition to localizing strings, JsonI18n can localize arrays. Values for each language must be in separate keys in the array. The localizeDeepArray method will collapse the groups as necessary, returning an array with fewer keys.

The $depth argument of the method can be set to 1 for two-dimensional arrays, 2 for three-dimensional arrays, and so on. This is useful for localizing data returned from a database via PDO, where different fetch types can return arrays of 1, 2, or 3 dimensions.

Debugging

To view all of the data in the JsonI18n object, call the debug() method.


All versions of json-i18n with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.1
ext-intl Version *
ext-json 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 rinkattendant6/json-i18n contains the following files

Loading the files please wait ...