Download the PHP package zymeli/yii2-translate-manager without Composer

On this page you can find all versions of the php package zymeli/yii2-translate-manager. 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 yii2-translate-manager

Yii2 - Translate Manager

Latest Version on Packagist Total Downloads

Translation management extension for Yii 2

Introduction

This module provides a simple translating interface for the multilingual elements of your project. It can auto-detect new language elements (project scan). Duplications are filtered out automatically during project scanning. Unused language elements can be removed from the database with a single click (database optimisation) and translations can be imported and exported. It is possible to translate client side messages too (those stored in JavaScript files) as the project scan collects language elements to be translated from JavaScript files as well.

It also allows you to translate text on the client side (on the live webpage) without having to log in to the translating interface. (frontendTranslation).

On the server side it can handle database or one-dimensional/multidimensional array elements and Yii::t functions. You can exclude files, folders or categories to prevent them from being translated.

Contributing

Please read and follow the instructions in the Contributing guide.

Installation

Via Composer

Migration

Run the following command in Terminal for database migration:

Or use the namespaced migration (requires at least Yii 2.0.10):

Then run:

Config

A simple exmple of turning on Yii database multilingual.

Turning on the TranslateManager Module:

Simple example:

A more complex example including database table with multilingual support is below:

Configuring the scan root

The root path can be an alias or a full path (e.g. @app or /webroot/site/).

The file scanner will scan the configured folders for translatable elements. The following two options determine the scan root directory: root, and scanRootParentDirectory. These options are defaults to values that works with the Yii 2 advanced project template. If you are using basic template, you have to modify these settings.

The root options tells which is the root folder for project scan. It can contain a single directory (string), or multiple directories (in an array).

The scanRootParentDirectory is used only if a single root directory is specified in a string.

IMPORTANT: Changing these options could cause loss of translated items, as optimize action removes the missing items. So be sure to double check your configuration!

a) Single root directory:

It is possible to define one root directory as string in the root option. In this case the scanRootParentDirectory will be used when determining the actual directory to scan.

If scanRootParentDirectory is set to true (which is the default value), the scan will run on the parent directory. This is desired behavior on advanced template, because the @app is the root for the current app, which is a subfolder inside the project (so the entire root of the project is the parent directory of @app).

For basic template the @app is also the root for the entire project. Because of this with the default value of scanRootParentDirectory, the scan runs outside the project folder. This is not desired behavior, and changing the value to false solves this.

IMPORTANT: Changing the scanRootParentDirectory from true to false could cause loss of translated items, as the root will be a different directory.

For example:

root value scanRootParentDirectory value Scanned directory
/webroot/site/frontend true /webroot/site
/webroot/site/frontend false /webroot/site/frontend

b) Multiple root directories:

Multiple root directories can be defined in an array. In this case all items must point to the exact directory, as scanRootParentDirectory will be omitted.

For example:

Using of authManager

Examples:

PhpManager:

DbManager:

Front end translation:

Usage

Register client scripts

To translate static messages in JavaScript files it is necessary to register the files.

To register your scripts, call the following method in each action:

A simple example for calling the above method at each page load:

ToggleTranslate button

Simple example for displaying a button to switch to front end translation mode. (The button will only appear for users who have the necessary privileges for translating!)

A more complex example for displaying the button:

Placing multilingual elements in the source code.

JavaScript:

PHP methods:

PHP functions for front end translation:

IMPORTANT: The zymeli\TranslateManager\helpers\Language::t() (Lx::t()) function currently does not support the translation of HTMLattributes

PHP arrays:

PHP Database:

URLs

URLs for the translating tool:

Example implementation of the Yii2 menu into your own menu.

Console commands

Register the command

Use it with the Yii CLI

Known issues

Coding style

The project uses the PSR-2 coding standard.

Coding style issues can be fixed using the following command:

You can check the code, without affecting it:

Change log

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

Screenshots

List of languages

translate-manager-0 2-screen-1

Scanning project

translate-manager-0 2-screen-2

Optimise database

translate-manager-0 2-screen-3

Translate on the admin interface

translate-manager-0 2-screen-4

Front end in translating mode

translate-manager-0 2-screen-6

Translate on the front end

translate-manager-0 2-screen-7

Links


All versions of yii2-translate-manager with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-simplexml Version *
yiisoft/yii2 Version ~2.0.38
yiisoft/yii2-bootstrap5 Version ~2.0.2
kartik-v/yii2-widgets Version ^3.4
kartik-v/yii2-helpers Version ^1.3
yiisoft/yii2-jui Version ~2.0.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 zymeli/yii2-translate-manager contains the following files

Loading the files please wait ....