PHPackages                             mattivdweem/translate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. mattivdweem/translate

ActiveLibrary[Localization &amp; i18n](/categories/localization)

mattivdweem/translate
=====================

Simple translation class set for PHP

v1.0.0(10y ago)566MITPHPPHP &gt;=5.4.2

Since May 25Pushed 10y ago1 watchersCompare

[ Source](https://github.com/MattivdWeem/Translate)[ Packagist](https://packagist.org/packages/mattivdweem/translate)[ Docs](http://github.com/MattivdWeem/Translate)[ RSS](/packages/mattivdweem-translate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Translate
=========

[](#translate)

A simple translation library for php, leans on components. Fully leans on composer for loading, easy extandable. MIT license :).

[![Matti vd Weem](https://camo.githubusercontent.com/a1357c96dd567676f491567f13f1265e0a95c667e88b277787dad4e02cc8cad6/687474703a2f2f6d6174746976616e64657765656d2e6e6c2f63692f7472616e736c6174652d6d617474692e6a7067)](http://mattivandeweem.nl/ci/translate-matti.jpg)

ToolResult / badgePackagist[![Latest Stable,Version](https://camo.githubusercontent.com/d83ce63d05ea074ea7d13274dc5583d1a4beb06d80b8a3949aa3d8dfae54b1ce/68747470733a2f2f706f7365722e707567782e6f72672f6d6174746976647765656d2f7472616e736c6174652f762f737461626c65)](https://packagist.org/packages/mattivdweem/translate) [![Total,Downloads](https://camo.githubusercontent.com/ef44e155313a6f4b31cea13cc323c46ec6e64249caea818733cb65c4832e090c/68747470733a2f2f706f7365722e707567782e6f72672f6d6174746976647765656d2f7472616e736c6174652f646f776e6c6f616473)](https://packagist.org/packages/mattivdweem/translate) [![Latest Unstable,Version](https://camo.githubusercontent.com/0a380435a1d3bfa2512cd81e8e2fc7ee3981397ab9c5f6a2ac32b121bbf76de8/68747470733a2f2f706f7365722e707567782e6f72672f6d6174746976647765656d2f7472616e736c6174652f762f756e737461626c65)](https://packagist.org/packages/mattivdweem/translate) [![License](https://camo.githubusercontent.com/38c968cae66631df6df8f0819517ef131f7a1ea456ecd2fa3051427e68bf6785/68747470733a2f2f706f7365722e707567782e6f72672f6d6174746976647765656d2f7472616e736c6174652f6c6963656e7365)](https://packagist.org/packages/mattivdweem/translate)CodeStyle[![SensioLabsInsight](https://camo.githubusercontent.com/fd6d858b572a30566eebf46bd70dd9ac0c107f503c5df864bca13a11c8a40281/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f65336338373965652d613436332d343966372d623034312d6264356164656163393364622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/e3c879ee-a463-49f7-b041-bd5adeac93db) [![StyleCI](https://camo.githubusercontent.com/636b40ab3221250f875309e322646ceac90224c5611161f5b3733d284cdf3e16/68747470733a2f2f7374796c6563692e696f2f7265706f732f33363132383937372f736869656c64)](https://styleci.io/repos/36128977)Travis[![Build Status](https://camo.githubusercontent.com/8ab58b233b5ee63bbd012a5f3687468ed8c00a40ad0c1fde7d577a87664b4725/68747470733a2f2f7472617669732d63692e6f72672f4d6174746976645765656d2f5472616e736c6174652e737667)](https://travis-ci.org/MattivdWeem/Translate)Scrutinizer[![Code Coverage](https://camo.githubusercontent.com/0314191b18b4d59d67777d34de0493a9d6cab34eace1a0b383aa448b80e635fe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174746976645765656d2f5472616e736c6174652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MattivdWeem/Translate/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/00355a188a325efdbf9a9526755df99c3658917be32112643cf34303a8b4f635/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174746976645765656d2f5472616e736c6174652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MattivdWeem/Translate/?branch=master) [![Build Status](https://camo.githubusercontent.com/f84261ccf93ee445cc598be4138b47ee29fa8c76a1db6a1389b959611930de08/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174746976645765656d2f5472616e736c6174652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MattivdWeem/Translate/build-status/master)How to use
----------

[](#how-to-use)

Create a new instance, register your language and done. Well just take a look at the json example below.

Composer.json
-------------

[](#composerjson)

Everything should be loadable via composer. Make shure the translate is required first and the strategy's after the main class. This should be pretty strait forward. When you like your own strategy more, it's fine just use that one.

```
{
    "require": {
        "mattivdweem/translate": "^1.0",
        "mattivdweem/translate-json-strategy": "^1.0"
    }
}

```

php example
-----------

[](#php-example)

Once evertying is loaded via comopser, you should require the autoloader and register a new instance of the translation class, the example below i register a `$dutch` translation with the json strategy, this will make shure i'm getting all the dutch translations from the nl.json file.

```
