Download the PHP package delboy1978uk/bone-i18n without Composer

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

bone-i18n

Latest Stable Version Total Downloads Latest Unstable Version License
build status Code Coverage Scrutinizer Code Quality

I18n package for Bone Framework

installation

bone-i18n is a core dependency of delboy1978uk/bone, and so it is installed by default.

setup

The skeleton app has a directory for translations (usually data/translations but you can set this to anything), which will contain locale folders such as en_US etc.

Drop in your .mo and .po files. Open config/bone-i18n.php and tweak to suit:

For any package you have that will contain translation files, edit your package class and make it implement Bone\I18n\I18nRegistrationInterface. Create the method public function getTranslationsDirectory(): string that will return the translations directory path.

usage

locale view helper

You can have routes prepended with the current locale by calling

Or more conveniently

in your view files. A link such as /user would then become /en_US/user. Bone Framework uses i18n middleware to fetch the locale and it strips the locale from the URL and sets it as a Request Attribute, so you do not need to define routes with a locale parameter.

controllers

In a controller action if you need the locale you can say:

To get a translator into your controller, make it implement Bone\I18n\I18nAwareInterface and use the Bone\I18n\Traits\HasTranslatorTrait. If you package's Package class returns the controller without going through the Bone\Mvc\Controller\Init class, change it now to this:

You can now call $this->getTranslator() which will return an instance of the translator.

translation view helper

To translate text in your view, call the following:

Or again, more conveniently

i18n aware forms

Bone Framework uses delboy1978uk/form for its form functionality. However, instead of extending Del\Form, you can create a form extending Bone\I18n\Form, which takes the translator as a second argument.


All versions of bone-i18n with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
delboy1978uk/barnacle Version ^2.3
delboy1978uk/form Version ^2.4
laminas/laminas-i18n Version ^2.26
laminas/laminas-servicemanager Version ^3.3
psr/http-message Version ^2.0
psr/http-server-middleware Version ^1.0
delboy1978uk/bone-http Version ^2.3
delboy1978uk/bone-view Version ^v1.7
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 delboy1978uk/bone-i18n contains the following files

Loading the files please wait ....