Download the PHP package wavevision/namespace-translator without Composer

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

Wavevision s.r.o.

Namespace Translator

Build Status Coverage Status PHPStan

Translations manager for Nette framework using contributte/translation. It allows you to have your translation files located where they are really used (e.g. next to a component or a model).

No more global translations mess! 💪

Installation

Via Composer

Note: This will automatically install contributte/translation too.

Usage

Register required extensions in your project config:

You can configure namespaceTranslator as follows (default values):

Note: Refer to Contributte docs for further info about configuring translation.

With this setup, you can start managing your translations like a boss 🤵.

The best thing is the translator keeps full backwards compatibility with contributte/translation setup, so you can still use your translations as you are used to and migrate to namespaces step-by-step. Any translation not found by namespace translator will fallback to translation resources.

Translated components

Your components (or presenters) can use Wavevision\NamespaceTranslator\TranslatedComponent trait.

Make sure your component has inject allowed.

The trait will provide your component class / template with $translator property / variable. The translator will look for resources in configured dir names inside component's namespace.

Note: The translate macro in component templates will, of course, work too.

Translated models

Even your services can use the translator. Simply use Wavevision\NamespaceTranslator\NamespaceTranslator.

Make sure your service is registered with inject: true in your config.

After that, it works the same as with your components.

Loaders

There are three resource loaders included by default:

Using PHP classes is useful when you want to refer to your translations using constants so changes in your resources get propagated throughout the whole project.

Classes containing translations must implement Wavevision\NamespaceTranslator\Resources\Translation.

You can also create and register your own loader, just make sure it implements Wavevision\NamespaceTranslator\Loaders\Loader.

Export \ Import

For exporting \ importing translations to \ from CSV or GoogleSheet (or both) update configuration file

Set locales whitelist from contributte/translation. Whitelist is used for creating translation columns in export.

Run command to export translations

Update translations, then run command to import them

Google Sheet

For accessing Google sheet you will need server-to-server API key and sheet ID.

Export example

From files

export should look like this

columns file, key and format shouldn't be modified.

For details see example export.csv.

Limitation of TranslationClass

Examples

See tests for example app implementation.


All versions of namespace-translator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
contributte/console Version ^0.9
contributte/translation Version ^0.8
google/apiclient Version ^2.7
nette/application Version ^3.1
nette/di Version ^3.0
nette/neon Version ^3.0
nikic/php-parser Version ^4.9
wavevision/di-service-annotation Version ^4.0
wavevision/utils Version ^2.1
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 wavevision/namespace-translator contains the following files

Loading the files please wait ....