Download the PHP package iridescent-dev/pico-multilanguage-plugin without Composer

On this page you can find all versions of the php package iridescent-dev/pico-multilanguage-plugin. 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 pico-multilanguage-plugin

Pico MultiLanguage

Pico plugin for multi-language support.

Usage

A plugin to support content and theme in different languages.

You can define the languages available for your site and translate your content pages and your theme into those languages.


NOTES:


Getting Started

Install

Add the plugin in the plugins directory of your Pico installation (e.g. /var/www/html/pico/plugins/)

Pico MultiLanguage plugin requires PHP >=7.0.

Integration with other plugins

The MultiLanguage plugin filters the list of pages to keep only pages in the current language. If you are using a plugin which processes the list of pages, it may be necessary to add MultiLanguage to it as a dependency.
Take the example of Pagination: filtering pages by language must be done before paging.

You must add or edit the following line in this plugin:

Configuration settings

You can change the default configuration by adding values to your config file. Here are the options available and what they do.

For reference, these values are set in config/config.yml using the following format:

Content translation

The plugin introduces Language and pid page headers. Essentially, each language version gets a separate content file with a different Language but the same pid.

You can organize your content directory with one folder per language, then you can use the language_base_url variable instead of base_url. See Template variables defined for Twig.

Each language folder can contain index.md and 404.md files. These files must have the corresponding Language header and the same pid. All Markdown files can be placed in the folder corresponding to their language.

The structure should be as follows:

Sample of content/en/index.md

Sample of content/fr/index.md

Below we've shown some examples of locations and their corresponding URLs: URL Physical Location
/ content/index.md if the file exists or content/[lang]/index.md *
/en content/en/index.md
/fr content/fr/index.md
/fr/sub/page content/fr/sub/page.md
/badurl content/404.md if the file exists or content/[lang]/404.md *
/en/badurl content/en/404.md

* To replace [lang], the plugin uses the browser language if it is one of the available languages, otherwise the default_language is used.

Template variables defined for Twig

All this can be used to build a language switcher:

Here, we use {{ language|link }} because the homepage URL for each language matches the language code (e.g. /en or /fr). See Content translation.

Theme translation

This Twig filter can be used in your theme templates:

You must add a language directory in your Pico installation, with one file per language. Each file must contain all the keys used by the translate Twig filter in your templates.

The structure should be as follows:

Sample of language/en.php

Changing the site title automatically

In addition to the regular site_title defined in config.yml, the MultiLanguage plugin can adjust the {{ site_title }} twig variable according to the language of the given page.

This creates an array called site_titles (as opposed to the default site_title). site_titles uses the same language codes used within individual pages. If there is no entry given for a page's language, it will default to the original site_title variable set.

Changing the page date formatted automatically

In addition to the regular date_format defined in config.yml, the MultiLanguage plugin can adjust the {{ date_formatted }} twig variable according to the language of the given page. You can define a date format and which locale (available on your server) you want to use for each language of the site.

This creates an array called date_formats (as opposed to the default date_format). date_formats uses the same language codes used within individual pages. If there is no entry given for a page's language, it will default to the original date_format variable set.

An other array called date_locales is created, which uses the same language codes used within individual pages. If there is no entry given for a page's language, the server locale will be used by default.

Changelog

1.0

License

http://opensource.org/licenses/MIT


All versions of pico-multilanguage-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 iridescent-dev/pico-multilanguage-plugin contains the following files

Loading the files please wait ....