Download the PHP package lehadnk/translation-merge-tool without Composer

On this page you can find all versions of the php package lehadnk/translation-merge-tool. 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 translation-merge-tool

Introduction

i18n_mrg is the helper tool that scans your project's codebase for translated strings and synchronizes translations with a popular translation tool named Weblate and back.

Installation

The software you need to install the translation merge tool:

You require php>=8.1 to run the software. Also, you require to have a PHP packet manager (composer), which you may get here.

Run the following command to install the tool:

Running the tool

Run the following command under your project root:

Project setup

First, you need to prepare your codebase to work with i18n_mrg:

  1. Configure your project to work with translation files. We'd suggest you use GNU gettext format, but i18n_mrg could also compile JSON files as well if you prefer, which works better for web applications. You need to set up a directory in your project and store your translation files in it, naming each subfolder with the language code you're planning to use. Example file tree structure:

  2. Use the wrapper function named __() to mark your translation strings. Implement the function to return the corresponding string from your storage, e.g.:

  3. Add .translate-config.json to your project root. The example contents of the file:

  4. Next, define the translation branch in your repository. Usually, you want it to be managed by translation tools (i18n_mrg and Weblate) only, and never touch it: git checkout -b translations && git push --set-upstream origin translations
  5. Set up the Weblate platform and define the component for your project.
  6. Now run i18n_mrg to scan your project for translation strings and initially upload them to Weblate. i18n_mrg will parse your codebase for every string wrapped in __() decorator and add it to translation files, the pull updates from Weblate automatically.

Developer workflow

For developers working with i18n_mrg on your project, I'd suggest the following workflow:

  1. When you're about to be done with your working branch, which contains translation strings, run i18n_mrg and push new translation strings to Weblate.
  2. Notify the person in your team responsible for handling translation that new strings are added to Weblate.
  3. Once translations are done, run i18n_mrg again to pull translated strings from Weblate and add updated translated files to your branch.

In big teams, you may also want translations files compilation to be a part of your CI cycle.

Updating the tool

Handling authorization tokens

To use the tool with various VCS providers, you must set up authorization.

Gitlab

  1. Create the key using your profile settings > Access Tokens.
  2. Your key must have the next scopes: api, read_repository, write_repository
  3. Export your token to I18N_MRG_GITLAB_AUTH_TOKEN env variable: export I18N_MRG_GITLAB_AUTH_TOKEN=<token>

Github

  1. Goto Settings > Developer Settings > Personal access tokens
  2. Create a token with scope: repo
  3. Export your token to I18N_MRG_GITHUB_AUTH_TOKEN env variable: export I18N_MRG_GITHUB_AUTH_TOKEN=<token>

BitBucket

  1. Go to repository settings
  2. Issue the repository access token with read/write permissions in the "Access Tokens" section
  3. Place your token in I18N_MRG_BITBUCKET_AUTH_TOKEN env variable: export I18N_MRG_BITBUCKET_AUTH_TOKEN=<token>

How to add it to the project

First, you need to create a.translate-config.json configuration file under the project's root. Example contents of the config file:

Troubleshooting

Some Mac users reported that they had issues with the gettext tool installed through Brew. Unlinking and linking it again resolves the issue:


All versions of translation-merge-tool with dependencies

PHP Build Version
Package Version
No informations.
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 lehadnk/translation-merge-tool contains the following files

Loading the files please wait ....