PHPackages                             dees040/loca - 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. dees040/loca

ActiveLibrary

dees040/loca
============

Localization class for easy translation management.

06PHP

Since Nov 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/dees040/loca)[ Packagist](https://packagist.org/packages/dees040/loca)[ RSS](/packages/dees040-loca/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Loca
====

[](#loca)

**README will be fully filled after development of the class.**

Created a class for handling translations. I though maybe somebody finds this useful.

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usages](#usages)
- [Examples](#examples)

Installation
------------

[](#installation)

Install the latest version using composer:

```
composer require dees040/loca

```

Make sure you require the autoload.

Configuration
-------------

[](#configuration)

Use `Loca::prepare()` to configure the class.

prepare() takes one argument which is an array.

**Options:**

- locale (string): The country code of the main language to use.
- fallbackLocale (string): The country code of the fallback language to use.
- langDir (string): The full path to the directory which contains the translations.

**Example:**

```
Loca::prepare([
    'locale' => 'fr',
    'fallbackLocale' => 'en',
    'langDir' => '/var/www/Loca/resources/languages',
]);

```

Usages
------

[](#usages)

Language strings are stored in files within the specified directory. Within this directory there should be a subdirectory for each language supported by the application:

```
/languageDirectory
    /en
        app.php
    /fr
        app.php

```

All language files simply return an array of keyed strings. For example:

```
