Download the PHP package seablast/i18n without Composer

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

Seablast I18n

Total Downloads Latest Stable Version Polish the code

A lightweight internationalization (i18n) module for apps using the Seablast for PHP framework. It provides a Latte translation filter, a language-selection API, optional Universal Language Selector templates, and Phinx migrations for translation data. Installable via Composer, it integrates seamlessly and activates only when needed, allowing you to effortlessly provide multilingual support and manage user language preferences.

Usage

UI

The Latte filter translate uses the dictionary loaded by Seablast\I18n\SeablastTranslate. Seablast registers it in Seablast\SeablastView::renderLatte() from the SeablastConstant::TRANSLATE_CLASS setting defined in app.conf.php.

Use as: const back = {="Zpět"|translate};

Note: In Latte, SB:LANGUAGE is defined lazily by the translator. For that reason, {=''|translate} in views/uls.menu.latte runs before SB:LANGUAGE is read.

To display the language selector, include the three uls.*.latte files as follows:

Note: The I18n:SHOW_LANGUAGE_SELECTOR flag controls whether the contents of all uls.*.latte templates are rendered. As a result, you do not need to wrap uls.*.latte includes in custom Latte conditions; include them, and the application decides whether they take effect.

Instead of using the language selector, you can switch the language programmatically by calling:

The caller is responsible for reloading or re-rendering the page so translated strings update:

The window.languageSelector function is declared in uls.js.latte. That function returns jQuery.Promise (a promise-like object with .then(), .done(), .fail(), .always()) and in the fulfillment value, there's JSON, e.g. {message: 'en'}.

The language switching endpoint exists independently, but the UI selector is gated by I18n:SHOW_LANGUAGE_SELECTOR to prevent exposing unfinished or tenant-specific i18n:

Note: only languages from the configuration (e.g. ->setArrayString(I18nConstant::LANGUAGE_LIST, ['en', 'cs'])) are accepted. The first configured language is the default.

Database structure

To create the expected database table structure (for dictionary and localised items), just add the seablast/i18n migration path to your phinx.php configuration, e.g.

Dictionary table: translations

Column Type Attributes Description
id integer Primary key, auto-increment (identity) Unique identifier for each translation entry.
language string(5) Indexed, part of unique constraint Configured language code (for example en or cs).
translation_key string(255) Indexed, part of unique constraint The lookup key used in the application (e.g., "Save PDF", "Back").
translation_value text Localized string corresponding to the key in the given language.

Integration

Language API

Language selector

Localised data access

Extend the class FetchLocalisedItemsModel with preset of these three properties

in order to access the localised items filtered by their type.

The full class looks like this:

TODO: Find a way to initialise mysqli() automatically, so that it is not dependent on the Seablast\Auth presence.

(See Seablast\Dist BlogModel.php.)

This MODEL yields items one by one from the database in a lazy, memory efficient, way. The VIEW can display it as follows:

This code can be seen live in Seablast\Dist blog-readonly.latte. The texts can also be directly editable by admins as seen in Seablast\Dist blog-editable.latte. (This of course requires users to be logged in, hence Seablast\Auth is required.)


All versions of i18n with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2 <8.6
nette/utils Version ^3.2.10 || ^4.0.5 || ^4.1.0
robmorgan/phinx Version ^0.12.13 || ^0.13.4 || ^0.14.0 || ^0.15.5 || ^0.16.5
tracy/tracy Version ^2.9.8 || ^2.10.9 || ^2.11.0
webmozart/assert Version ^1.10.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 seablast/i18n contains the following files

Loading the files please wait ...