Coder Social home page Coder Social logo

browserlanguage's Introduction

BrowserLanguage

Description

BrowserLanguage is a PHP function to detect the browser language (via the HTTP Accept-Language format).

Quick Example

<?php

require 'Pagawa/BrowserLanguage/browserLanguage.php';

// For the example, the PHP header will be like this :
// $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'

$browserLanguage = browserLanguage($_SERVER['HTTP_ACCEPT_LANGUAGE']);

print_r($browserLanguage);

This above example will output :

Array
(
    [0] => Array
        (
            [lang] => fr
            [qvalue] => 1
        )

    [1] => Array
        (
            [lang] => fr
            [full] => fr-FR
            [qvalue] => 0.8
        )

    [2] => Array
        (
            [lang] => en
            [full] => en-US
            [qvalue] => 0.5
        )

    [3] => Array
        (
            [lang] => en
            [qvalue] => 0.3
        )
)

Requirements

PHP 5 (>= 5.0.0)

Contributing

All issues or pull requests must be submitted through GitHub.

  • To report an issue or a feature request, please use GitHub Issues.
  • To make a pull request, please create a new branch for each feature or issue.

ChangeLog

  • 2014-06-26 - First commit

browserlanguage's People

Stargazers

 avatar Kallef Alexandre avatar Kevin Magne avatar  avatar Jonathan Piat avatar

Watchers

James Cloos avatar Jonathan Piat avatar

Forkers

shortymc

browserlanguage's Issues

How use it ?

Hello :)
Thanks for your work

I want to make something like :

if $browserLanguage = en

{ echo = "anglais";

}

else

{ echo = "fonctionne pas "; }

Can you help me ?

Thanks you for your support

Best regards

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.