Giter Club home page Giter Club logo

fuel_i18n's Introduction

#FuelPHP Internationalization Package

  • Version 0.8

Description

This package provide i18n capabilities to php and twig templates.

##Development Team

Usage

1 - Copy config\i18n.php in APPPATH/config and set the desidered values

2 - Use following tags in templates

2.1 - PHP

Intl::_t("Text in original language")

2.2 - TWIG

{{ _t(Text in original language) }}

3 - Put

<?php
    if(Config::get(i18n.active,true)){
        Intl::forge()->setLanguage(<language>);
    }
?>

Where you want to set language for the first time (usually in a method that run early during app bootstrap). The language can be a ISO 639-1 code (it,en,es) or a full locale (it_IT,en_US,en_EN). If not specified, the browser highest priority language is taken.

Methods

Intl::getCurrentLanguage();

Get current language:

Intl::getClientLanguage();

Get client language (from browser):

Example:

<?php
    if(Config::get(i18n.active,true)) Intl::forge()->setLanguage(Intl::getClientLanguage());
?>

Intl::isSupportedLanguage();

Check if a language is supported; it looks in locales directory if there is a folder named after the language. This step is done automatically in setLanguage();

Intl\Uri

This class overwrites core's Uri create() method, make it able to adds // before actual uri.

You can use it like this:

if(<you want to prepend language to uri>){
    $class = '\Intl\Uri';
}else{
    $class = '\Uri';
}

$link = $class::create("uri/path");

fuel_i18n's People

Contributors

lostcore avatar

Watchers

 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.