LaravelLang

Summary

No public properties found
No private methods found
No private properties found
N/A
File
lang.php
Package
Default
Class hierarchy
LaravelLang

Tags

None found

Constants

loader

loader

The language loader event name.

Tags

None found

Properties

$key

$key : string

The key of the language line being retrieved.

Type

string

Tags

None found

$replacements

$replacements : array

The replacements that should be made on the language line.

Type

array

Tags

None found

$language

$language : string

The language in which the line should be retrieved.

Type

string

Tags

None found

$lines

$lines : array

All of the loaded language lines.

The array is keyed by [$bundle][$language][$file].

Type

array

Tags

None found

Methods

line()

line(string  $key, array  $replacements = array(), string  $language = null) : \Laravel\Lang

Create a new language line instance.

// Create a new language line instance for a given line $line = Lang::line('validation.required');

// Create a new language line for a line belonging to a bundle
$line = Lang::line('admin::messages.welcome');

// Specify some replacements for the language line
$line = Lang::line('validation.required', array('attribute' => 'email'));

Parameters

string $key
array $replacements
string $language

Returns

LaravelLang

static

Tags

None found

has()

has(string  $key, string  $language = null) : boolean

Determine if a language line exists.

Parameters

string $key
string $language

Returns

boolean

static

Tags

None found

get()

get(string  $language = null, string  $default = null) : string

Get the language line as a string.

// Get a language line $line = Lang::line('validation.required')->get();

// Get a language line in a specified language
$line = Lang::line('validation.required')->get('sp');

// Return a default value if the line doesn't exist
$line = Lang::line('validation.required')->get(null, 'Default');

Parameters

string $language
string $default

Returns

string

Tags

None found

load()

load(string  $bundle, string  $language, string  $file) : boolean

Load all of the language lines from a language file.

Parameters

string $bundle
string $language
string $file

Returns

boolean

static

Tags

None found

file()

file(string  $bundle, string  $language, string  $file) : array

Load a language array from a language file.

Parameters

string $bundle
string $language
string $file

Returns

array

static

Tags

None found

__toString()

__toString() : string

Get the string content of the language line.

Returns

string

Tags

None found

__construct()

__construct(string  $key, array  $replacements = array(), string  $language = null) : void

Create a new Lang instance.

Parameters

string $key
array $replacements
string $language

Tags

None found

parse()

parse(string  $key) : array

Parse a language key into its bundle, file, and line segments.

Language lines follow a {bundle}::{file}.{line} naming convention.

Parameters

string $key

Returns

array

Tags

None found

path()

path(string  $bundle, string  $language, string  $file) : string

Get the path to a bundle's language file.

Parameters

string $bundle
string $language
string $file

Returns

string

static

Tags

None found