Giter Club home page Giter Club logo

l10n's Introduction

Panda Localization Package

This is the localization package of the Panda Platform. It provides a simple translation structure and process for your code.

StyleCI

Installation

This package is part of the Panda Framework but it's also available as a single package.

Through the composer

Add the following line to your composer.json file:

"panda/l10n": "^2.0"

Usage

The Translation class works using a given FileProcessor for the translation files. It uses the FileProcessor as a getter to get translations.

Each Processor can have its own implementation of handling files based on locale and packages.

Translator

The Translator interface can be used across the entire application. You have to define the application's FileProcessor first and then you can load your translations freely.

Example:

use Panda\Localization\Translation\JsonProcessor;
use Panda\Localization\Translator;

// Initialize the desired processor
$processor = new JsonProcessor('your_base_directory_for_translations');

// Initialize the Translator
$translator = new Translator($processor);

// Get a desired translation
$translation = $translator->translate('translation-key', 'package-name', 'en_US', 'default-translation-value-if-empty');

JsonProcessor

When using the JsonProcessor, the translation files should be in the given structure:

BASE_DIRECTORY/{locale}/{package}.json

If no package name is given (or an empty package name), the 'default' package will be used (default.json).

l10n's People

Contributors

ioannis-papikas avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.