Download the PHP package bluepsyduck/factorio-translator without Composer

On this page you can find all versions of the php package bluepsyduck/factorio-translator. 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 factorio-translator

Factorio Translator Library

GitHub release (latest SemVer) build Codecov

The Factorio Translator Library is a library implementing the translator of Factorio in PHP. Given the locale files shipped with the mods it is able to translate the localised strings used by Factorio into any locale provided by the mods.

Features

Installation

The library is available through composer. Install the package using the following command:

Usage

The translator requires some setup steps before it can actually be used. Otherwise it won't do much at all.

1. Create instance

Creating the actual instance is straight forward: It does not need any dependencies:

2. Add mod loaders

To be able to actually add mods (or rather their locale files) to the translator, mod loaders must be added first.

The library ships with two loaders, covering the most common use cases:

3. Load the mods

After the loaders have been added, it is now time to load the mods to use for the translations. Simply add the paths to the mods to the translator, and the loaders will take care of the rest:

Some notes on loading mods:

4. Add text processors

The translator uses text processors to process translated strings further. An example of such processing is to replace special references in the string with their actual values. While the translator ships with some basic processors, it may be required to implement your own processors to get all the features out of the translators.

Standard processors

The translator comes with some standard processors. It is recommended to always add these to the translator, as they handle very basic features of localised strings.

Add these processors as following:

Advanced processors

The translator also provides some abstract processor classes, which needs further implementation before they can actually be used. These abstract processors include:

The following example shows how to implement and use the control placeholder processor:

5. Usage

After all these steps, it is time to actually use the translator to translate localised strings. This is rather simple:

The first parameter is the locale to translate the localised string into. The values are the same as used by Factorio. A list of all locales can be obtained by calling $translator->getAllLocales().

If a translation is not available, translate() will return an empty string. If you want to fallback to English instead, use the method translateWithFallback() instead.

Note that the localised strings must be specified in PHP syntax, i.e. the lua tables must be transformed to PHP arrays. The translator does not understand the lua syntax.

Further reading

Further information and documentations on how the localised strings and the translation system works in Factorio can be found on the following websites:


All versions of factorio-translator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-zip Version *
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 bluepsyduck/factorio-translator contains the following files

Loading the files please wait ....